Skip to content

vishalagg/Data_Structure_Interview_Preperation

Repository files navigation

Array Questions


1.Find a pair in an array of size 'n', whose sum is X
2.Find a majority element in an array of size 'n' (must occur > n/2 times)
3.Find the number occuring odd number of times in a given array of size 'n'
4.Algorithm to reverse an array
5.Algorithm to rotate array of size 'n' by 'd' element
6.Algorithm to segregate 0's and 1's in an array
7.Find the maximum difference between two elements such that larger element appears after the smaller element
8.Algorithm to merge an array of size 'n' into another array of size 'm+n'.
9.Algorithm to find two repeating numbers in a given array
10.Algorithm to find duplicate elements in O(n) time and O(1) extra space, for a given array of size 'n'
11.Find the index in an array such that the sum of elements at lower indices is equal to the sum of elements at higher indices.(Equilibrium Index)
12.Algorithm to find the maximum difference of j - i such that a[j] > a[i], for a given an array of 'n' elements.
13.Algorithm to find the triplet whose sum is X
14.Algorithm to find a sub array whose sum is X
15.Algorithm to find the largest sub array with equal number of 0's and 1's
16.Algorithm to find the number of triangles that can be formed with three different array elements as three sides of triangles, for a given unsorted array of n elements
17.Algorithm to find the smallest integer value that can't be represented as sum of any subset of a given sorted array.
18.Algorithm to find the common element in given three sorted arrays
19.Algorithm to find the contiguous sub-array with maximum sum, for a given array of postive and negative numbers(kadane's algo)
20.Given an array of integers, sort the array into a wave like array and return it. (arrange the element into a sequence such that a1>=a2<=a3>=a4<=a5----etc.)
21.Algorithm to find the next greater number formed after permuting the digits of given number
21.

Linked List Questions


1.Linked List Implementation
2.Algorithm to find the nth node from end of the linked list
3.Algorithm to find the middle node in a linked list
4.Algorithm to find the intersection point of two linked lists
5.Reversal of linked list(Using Recursion)
6.Algorithm to detect loop in linked list
7.

Binary Tree


1.Binary tree Implementation, traversal-level order, inorder etc.
2.Implement inorder traversal without stack and recursion(Morris Traversal)
3.Convert a binary tree into its mirror tree
4.Check if a given binary tree is sum tree or not
5.Determine if the given two trees are identical or not
6.Print out all of its roof to leaf paths in a given binary tree
7.Find a lowest common ancestor of a given two nodes in a a binary search tree
8.Find a lowest common ancestor of a given two nodes in a binary tree
9.Level order traversal in spiral form
10.Convert an arbitrary binary tree to a tree that holds children sum property (You are not allowed to subtract from any node or node value must not decrease).
11.
12.
13.

Graph Questions


1.Implement Breadth First Search
2.Implement Depth First Search
3.Detect Cycle in a graph
4.Topological order in a graph
5.Calculate the Number of Nodes in a Given Graph Level
6.Print the Transpose of a Graph
7.Count all the paths that exist between given two nodes of an acyclic directed graph
8.Check if a directed Graph is Strongly Connected
9.Print all the Connected Components in a Undirected Graph
10.Given a undirected graph and an edge, check whether removing that edge creates components in the graph.
11.Check if a Given Graph is Bipartite(Graph Coloring Problem)
12.Find the topological sorting of a graph
13.Find Mother Vertex(From where all nodes are reachable) in a Directed Graph
14.Count the number of Edges in an Undirected Graph
15.Check if a Path Exists Between Two Vertices in an directed graph
16.Check if a Directed Graph is Tree or not