Binary Search Tree is a Binary Tree in which the left sub-tree of a node has a value less than or equal to its parent node's value and the right sub-tree of a node has a value greater than or equal to its parent node's value.
Level-order traversal goes level by level in a binary tree.
Post-order traversal first visits the Left Subtree, then the Right Subtree and lastly, the Root.
In-order traversal first visits the Left Subtree, then the Root and lastly, the Right Subtree.
Pre-order traversal first visits the Root, then the Left Subtree and lastly, the Right Subtree.
Given a (n,n) 2D matrix and a total cost to reach the destination cell, we need to start from (0,0) cell and go till (n-1,n-1) cell. Assuming that each cell has a cost associated and we can only go right or down from current cell. Find the number of ways to reach destination cell with given total cost.
Given a (n,n) 2D matrix, we need to start from **(0,0)** cell and go till (n-1, n-1) cell. Assuming that each cell has a cost associated and we can only go right or down from current cell, find the traversal in minimum cost.
Palindrome is a string that reads the same backwards as well as forward and can be odd or even length.
Given N, count the number of ways to express N as sum of 1,3 and 4.
Palindrome is a string that reads the same backwards as well as forward and can be odd or even length.
There are N houses built in a line, each containing some value. A thief is going to steal the maximum value from these houses. However, he can't steal in 2 adjacent houses. What is the maximum stolen value?
Given strings s1 and s2, convert s2 into s1 by deleting, inserting or replacing characters. Find out the minimum number of edit operations.
Quick sort is a Divide & Conquer algorithm. At each step, it finds the Pivot and then makes sure that all the smaller elements are left of Pivot and all larger elements are on the right. It continues to do so recursively until the entire array is sorted
Merge sort is a Divide & Conquer algorithm. It divides the input array into 2 halves, and recursively breaks those halves until they become so small that it can't be broken further. Then, each section of the pieces are merged together to inch towards the final answer.
DFS is an algorithm for traversing Graph data structures. It starts by selecting some arbitrary node and explores as far as possible along each edge before backtracking.
Given the weights and profits of N items, we are asked to put these items in a knapsack which as a capacity C.
Divide & Conquer algorithm can be used to solve Longest Common Subsequence problem . Let's explore how it works below.
BFS is an algorithm for traversing Graph data structures. It starts at some arbitrary node of a graph and explores the neighbour nodes (which are at current level) first, before moving to the next level neighbours.
This guide is curated to help prepare for technical interviews. I've complied all the useful information including how to calculate the complexity in this guide.