Contents tagged with algorithms

DP Intro
Four steps of dynamic programming, Characterize the structure of an optimal solution. Recursively define th evalue of an optimal solution. Compute the value of an optimal solution, typically in a … more

Longest Increasing Subsequence
Introduction Longest Increasing subsequence is called LIS in short. Intro to Algorithms, CLR, 3rd ed, p397: Ex15.46 asks, Give an O(n^2)time algorithm to find the longest monotonically … more

Longest Common Subsequence
Longest Common Subsequence is called LCS in short. The Problem Consider these two strings ( sequences of characters), A B C D A C D B We are to find the common strings/subsequences of them. … more

Quick Sort
Quick sort, one of the fundamental sorting algorithms of computer science sorts an array efficiently on average. A few important things about Quick Sort,  expected running time θ(n lg n)  sorts in … more

codeforces 455 A Boredom
The solution I have developed is a dynamic programming twist. From the problem specification it is obvious to see that we can run a loop upto 10^5 and calculate max points using a recurrence … more

Finding periodic string using Knuth Morris Prat Algorithm
Definition The problem https://uva.onlinejudge.org/external/102/p10298.pdf introduces the idea of concatenation of strings as multiplication and asks to find the highest power possible. For … more

Preparation for Coding Interviews
Intro This article will cover some ideas on preparation for coding interviews, useful related resources. Algorithm Problems to cover  Graph Problems  Binary Tree Extensively  Dynamic … more

Solving UVA 318  Domino Effects Problem
Introduction Domino Effects is an interesting shortest path problem. The problem description can be found at uva site. Description As per the description, following can be noted about the dominoes, … more

Algorithm Course  Quick Note 01
In this post, I'll be drawing some topics from an introductory lecture on Algorithms I have attended recently, Definition of algorithm An algorithm is a welldefined computational procedure that … more