Fibonacci sequence : It is the sum of the two preceding ones
Here we are going to start with basics of machine learning, Here we are going to write program to tech our machine to identify Apple or Orange.
Given a string s, form a shortest palindrome by appending characters at the start of the string abab = babab
This is small algorithm to generate binary search tree using given Root Value and Values to insert in root.
Given a sorted array keys[0.. n-1] of search keys and an array freq[0.. n-1] of frequency counts, where freq[i] is the number of searches to keys[i]. Construct a binary search tree of all keys such that the total cost of all the searches is as small as possible.
Generate topologically sorted order for directed acyclic graph, Here we are going to consider graph as a “Directed Graph”, Please visit my below article for more details about Directed and Undirected Graph Directed and Undirected Graph Input : Output : B > P > A > C > D > H > G > I… Read more
This is small notes about graphs, There are two types of graphs, By just looking at below image you will understand the different of these two graphs. In a directed graph direction matters. i.e. edge V2->V3 means that edge is directed. There is only an edge from V2 to V3 and no edge from V3… Read more
Given a sequence of matrices, find the most efficient way to multiply these matrices together. The problem is not actually to perform the multiplications, but merely to decide in which order to perform the multiplications. We have many options to multiply a chain of matrices because matrix multiplication is associative. In other words, no matter… Read more
Here this is a small notes for matrix multiplication, It is very useful for matrix related algorithms. Lets start with normal multiplication, For example we want to multiply 2 and 3, So normally we can do 2*3 = 6 OR 3*2 = 6 here you can see multiplication is commutative. But it is not always… Read more
Given a matrix of dimensions mxn having all entries as 1 or 0, find out the size of maximum size square sub-matrix with all 1s or 0s. Input : Output : Max square size for 1 is :3 Max square size for 0 is :2 Algorithm