Pattern Search Problem

There are several algorithm to solve pattern search from a provided string problem. To solve such problem using Naive method(for all the char of the provided string check whether the pattern  contains or not ). It takes O(m*n),here m = string length of pattern and n= string length of the text. There are several algorithm to solve

Longest Increasing Subsequence

LIS problem has a recursive solution and this also can be solved using DP. Recursive solution: #include <iostream> #include <cstdlib> using namespace std; int lis(int arr[],int length,int *max_length) { if(length==1) return 1; int res,max_end_here=1; //recursively we get all LIS those are ending with arr[0],arr[1] //…and arr[length-1] and if max ending with arr[length-1] //requires to be

Miscellaneous

Learning Sites: To learn Click Here Some Problems About Linked List Dynamic Memory Allocation: Code Snippet: int dim; cin>>dim; string **s = new string *[dim]; s[0] = new string[100]; s[1] = new string[100]; s[0][1]="ajksdhjkasdh"; s[1][0]="sswd"; cout<<s[1][0]<<" "<<s[0][1]<<"\n"; BellmanFord Algorithm: Take all the edge in a struct as: Struct Edge{int source,destination,cost}; Relax all the edge for