-
Root to leaf path sum equal to a given number
```java bool hasPathProduct(struct node* node, int prod) { if (node == NULL) { return (prod == 1); } else { bool ans = 1;
-
Print the first shortest root to leaf path in a Binary Tree
```java struct Node { struct Node* left; struct Node* right; int data; };
-
Print all the paths from root, with a specified sum in Binary tree
```java struct Node { int key; struct Node *left, *right; };
-
Fractional Knapsack Problem
```java double getMaxValue(int[] wt, int[] val, int capacity) { ItemValue[] iVal = new ItemValue[wt.length];
-
0-1 Knapsack Problem
```java int knapSack(int W, int wt[], int val[], int n) { int i, w; int K[][] = new int[n+1][W+1];
-
Longest Increasing Subsequence
```java int lis(int arr[],int n) { int lis[] = new int[n]; int i,j,max = 0;
-
Longest Common Subsequence
```java int lcsRecursive( char[] X, char[] Y, int m, int n ) { if (m == 0 || n == 0) return 0; if (X[m-1] == Y[n-1]) return 1 + lcs(X, Y, m-1, n-1); else return max(lcs(X, Y, m, n-1), lcs(X, Y, m-1, n)); }
-
Edit Distance
```java
-
Check if strings are rotations of each other or not
boolean areRotations(String str1, String str2) { return (str1.length() == str2.length()) && ((str1 + str1).indexOf(str2) != -1); }
-
Trie | (Insert and Search)
```java class TrieNode { TrieNode[] children = new TrieNode[ALPHABET_SIZE];