· 5 years ago · Feb 29, 2020, 01:00 PM
1
2Home
3Answer
4Spaces
5Notifications
61
7Search Quora
8Manju Thalor
9
10Techie Delight
11Huge collection of data structures articles for cracking technical interviews.
12Main
13People
14500 Data Structures and Algorithms interview questions and their solutions
15
16Vivek Srivastava
17Vivek Srivastava
18Admin · Posted Dec 27, 2016
19Array:
20
21Find pair with given sum in the array
22Check if subarray with 0 sum is exists or not
23Print all sub-arrays with 0 sum
24Sort binary array in linear time
25Find a duplicate element in a limited range array
26Find largest sub-array formed by consecutive integers
27Find maximum length sub-array having given sum
28Find maximum length sub-array having equal number of 0’s and 1’s
29Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)
30Inplace merge two sorted arrays
31Merge two arrays by satisfying given constraints
32Find index of 0 to replaced to get maximum length sequence of continuous ones
33Find maximum product of two integers in an array
34Shuffle a given array of elements (Fisher–Yates shuffle)
35Rearrange the array with alternate high and low elements
36Find equilibrium index of an array
37Find majority element in an array (Boyer–Moore majority vote algorithm)
38Move all zeros present in the array to the end
39Replace each element of array with product of every other element without using / operator
40Find Longest Bitonic Subarray in an array
41Find maximum difference between two elements in the array by satisfying given constraints
42Maximum subarray problem (Kadane’s algorithm)
43Print continuous subarray with maximum sum
44Maximum Sum Circular Subarray
45Find all distinct combinations of given length
46Find all distinct combinations of given length with repetition allowed
47Find maximum sequence of continuous 1’s formed by replacing at-most k zeroes by ones
48Find minimum sum subarray of given size k
49Find subarray having given sum in given array of integers
50Find the length of smallest subarray whose sum of elements is greater than the given number
51Find largest number possible from set of given numbers
52Find the smallest window in array sorting which will make the entire array sorted
53Find maximum sum path involving elements of given arrays
54Maximum profit earned by buying and selling shares any number of times
55Trapping Rain Water within given set of bars
56Longest Increasing Subsequence
57Longest Decreasing Subsequence Problem
58Find maximum product subarray in a given array
59Find maximum sum of subsequence with no adjacent elements
60Find minimum platforms needed in the station so to avoid any delay in arrival of any train
61Decode the array constructed from another array
62Sort an array using one swap
63Find Triplet with given sum in an array
64Length of longest continuous sequence with same sum in given binary arrays
65Rearrange array such that A[A[i]] is set to i for every element A[i]
66Reverse every consecutive m elements of the given subarray
67Maximum Product Subset Problem
68Find pairs with given difference k in the array
69Find pairs with given difference k in the array | Constant space solution
704 sum problem | Quadruplets with given sum
71Print all quadruplets with given sum | 4-sum problem extended
72Find odd occurring element in an array in single traversal
73Find two odd occurring element in an array without using any extra space
74Quickselect Algorithm
75Print all Triplets that forms Arithmetic Progression
76Print all triplets that forms Geometric Progression
77Print all combination of numbers from 1 to n having sum n
78Replace each element of the array by its corresponding rank in the array
79Print all Triplets in an array with sum less than or equal to given number
80Group elements of an array based on their first occurrence
81Find minimum difference between index of two given elements present in the array
82Find maximum absolute difference between sum of two non-overlapping sub-arrays
83Find all Symmetric Pairs in an Array of Pairs
84Partition an array into two sub-arrays with the same sum
85Find count of distinct elements in every sub-array of size k
86Find two numbers with maximum sum formed by array digits
87Print all sub-arrays of an array having distinct elements
88Find a Triplet having Maximum Product in an Array
89Find ways to calculate a target from elements of specified array
90Find Minimum Index of Repeating Element in an Array
91Generate Random Input from an Array according to given Probabilities
92Find pair in an array having minimum absolute sum
93Find Index of Maximum Occurring Element with Equal Probability
94Check if an Array is Formed by Consecutive Integers
95Find two non-overlapping pairs having same sum in an array
96Find Minimum Product among all Combinations of Triplets in an Array
97Replace every element of an array with the least greater element on its right
98Find all odd occurring elements in an array having limited range of elements
99Add elements of two arrays into a new array
100Count the distinct absolute values in the sorted array
101Print all combinations of positive integers in increasing order that sum to a given number
102Find all distinct combinations of given length - Part 2
103Find subarrays with given sum in an array
104Find the surpasser count for each element of an array
105Find maximum length sequence of continuous ones (Using Sliding Window)
106Find maximum length sequence of continuous ones
107Merging Overlapping Intervals
108Activity Selection Problem
109Job Sequencing Problem with Deadlines
110Introduction to Priority Queues using Binary Heaps
111Min Heap and Max Heap Implementation in C++
112Min Heap and Max Heap Implementation in Java
113Heap Sort (Out-of-place and In-place implementation in C++ and C)
114Check if given array represents min heap or not
115Convert Max Heap to Min Heap in linear time
116Find K’th largest element in an array
117Sort a K-Sorted Array
118Merge M sorted lists of variable length
119Find K’th smallest element in an array
120Find smallest range with at-least one element from each of the given lists
121Merge M sorted lists each containing N elements
122Insertion sort | Iterative & Recursive
123Selection sort | Iterative & Recursive
124Bubble sort | Iterative & Recursive
125Merge Sort
126Quicksort
127Iterative Implementation of Quicksort
128Hybrid QuickSort
129Quicksort using Dutch National Flag Algorithm
130Quick Sort using Hoare’s Partitioning scheme
131External merge sort
132Custom Sort | Sort elements by their frequency and Index
133Custom Sort | Sort elements of the array by order of elements defined by the second array
134Inversion Count of an array
135Segregate positive and negative integers in linear time
136Binary Search
137Ternary Search vs Binary search
138Interpolation search
139Exponential search
140Find number of rotations in a circularly sorted array
141Search an element in a circular sorted array
142Find first or last occurrence of a given number in a sorted array
143Count occurrences of a number in a sorted array with duplicates
144Find smallest missing element from a sorted array
145Find Floor and Ceil of a number in a sorted array
146Search in a nearly sorted array in O(logn) time
147Find number of 1’s in a sorted binary array
148Find the peak element in an array
149Maximum Sum Subarray using Divide & Conquer
150Find Minimum and Maximum element in an array using minimum comparisons
151Matrix Chain Multiplication
1520-1 Knapsack problem
153Maximize value of the expression
154Partition problem
155Subset sum problem
156Minimum Sum Partition problem
157Rod Cutting
158Coin change-making problem (unlimited supply of coins)
159Coin Change Problem (Total number of ways to get the denomination of coins)
160Longest alternating subsequence
161Combinations of words formed by replacing given numbers with corresponding alphabets
162Decode the given sequence to construct minimum number without repeated digits
163All combinations of elements satisfying given constraints
164Find Missing Term in a Sequence in log(n) time
165Print all distinct Subsets of a given Set
166Find Floor and Ceil of a number in a sorted array (Recursive solution)
167Set both elements of a binary array to 0 in single line
168K-Partition Problem | Printing all Partitions
1693 Partition Problem
1703-partition problem extended | Print all partitions
171Iterative Merge Sort Algorithm (Bottom-up Merge Sort)
172Find two duplicate elements in an limited range array (using XOR)
173Find missing number and duplicate elements in an array
174Find Minimum and Maximum element in an array by doing minimum comparisons
175Find Frequency of each element in a sorted array containing duplicates
176Difference between Subarray, Subsequence and Subset
177
178Backtracking:
179
180Print all possible solutions to N Queens problem
181Print all Possible Knight’s Tours in a chessboard
182Find Shortest Path in Maze
183Find Longest Possible Route in a Matrix
184Find path from source to destination in a matrix that satisfies given constraints
185Find total number of unique paths in a maze from source to destination
186Print All Hamiltonian Path present in a graph
187Print all k-colorable configurations of the graph (Vertex coloring of graph)
188Find all Permutations of a given string
189All combinations of elements satisfying given constraints
190Find all binary strings that can be formed from given wildcard pattern
191K-Partition Problem | Printing all Partitions
192Magnet Puzzle
193Find ways to calculate a target from elements of specified array
194Find minimum number possible by doing at-most K swaps
195Determine if a pattern matches with a string or not
196
197Binary:
198
199Bit Hacks – Part 1 (Basic)
200Bit Hacks – Part 2 (Playing with k’th bit)
201Bit Hacks – Part 3 (Playing with rightmost set bit of a number)
202Bit Hacks – Part 4 (Playing with letters of English alphabet)
203Bit Hacks – Part 5 (Find absolute value of an integer without branching)
204Bit Hacks – Part 6 (Random Problems)
205Brian Kernighan’s Algorithm to count set bits in an integer
206Compute parity of a number using lookup table
207Count set bits using lookup table
208Find the minimum or maximum of two integers without using branching
209Multiply 16-bit integers using 8-bit multiplier
210Round up to the next highest power of 2
211Round up to the previous power of 2
212Swap individual bits at given position in an integer
213Check if given number is power of 4 or not
214Reverse Bits of a given Integer
215Find odd occurring element in an array in single traversal
216Find two odd occurring element in an array without using any extra space
217Swap two bits at given position in an integer
218Add binary representation of two integers
219Swap Adjacent Bits of a Number
220Print all distinct Subsets of a given Set
221Perform Division of two numbers without using division operator (/)
222Check if adjacent bits are set in binary representation of a given number
223Conditionally negate a value without branching
224Find two duplicate elements in an limited range array (using XOR)
225Find missing number and duplicate elements in an array
226Check if given number is power of 8 or not
227Circular shift on binary representation of an integer by k positions
228Solve given set of problems without using multiplication or division operators
229Reverse Bits of an integer using lookup table
230Generate binary numbers between 1 to N
231Efficiently implement power function | Recursive and Iterative
232Find square of a number without using multiplication and division operator | 3 methods
233Generate power set of a given set
234Huffman Coding
235Find all odd occurring elements in an array having limited range of elements
236
237Binary Tree:
238
239Check if two given binary trees are identical or not | Iterative & Recursive
240Calculate height of a binary tree | Iterative & Recursive
241Delete given Binary Tree | Iterative & Recursive
242Inorder Tree Traversal | Iterative & Recursive
243Preorder Tree Traversal | Iterative & Recursive
244Postorder Tree Traversal | Iterative & Recursive
245Level Order Traversal of Binary Tree
246Spiral Order Traversal of Binary Tree
247Reverse Level Order Traversal of Binary Tree
248Print all nodes of a given binary tree in specific order
249Print left view of binary tree
250Print Bottom View of Binary Tree
251Print Top View of Binary Tree
252Find next node in same level for given node in a binary tree
253Check if given binary tree is complete binary tree or not
254Determine if given two nodes are cousins of each other
255Print cousins of given node in a binary tree
256In-place convert given binary tree to its sum tree
257Check if given binary tree is a sum tree or not
258Combinations of words formed by replacing given numbers with corresponding alphabets
259Determine if given binary tree is a subtree of another binary tree or not
260Find diameter of a binary tree
261Check if given binary Tree has symmetric structure or not
262Convert binary tree to its mirror
263Check if binary tree can be converted to another by doing any no. of swaps of left & right child
264Find Lowest Common Ancestor (LCA) of two nodes in a binary tree
265Print all paths from root to leaf nodes in given binary tree
266Find ancestors of given node in a Binary Tree
267Find the distance between given pairs of nodes in a binary tree
268Find Vertical Sum in a given Binary Tree
269Print nodes in vertical order of a given Binary Tree (Vertical Traversal)
270Find the diagonal sum of given binary tree
271Print Diagonal Traversal of Binary Tree
272Print corner nodes of every level in binary tree
273In-place convert convert given Binary Tree to Doubly Linked List
274Sink nodes containing zero to the bottom of the binary tree
275Convert given binary tree to full tree by removing half nodes
276Truncate given binary tree to remove nodes which lie on a path having sum less than K
277Find maximum sum root-to-leaf path in a binary tree
278Check if given binary tree is height balanced or not
279Convert normal binary tree to Left-child right-sibling binary tree
280Determine if given Binary Tree is a BST or not
281Convert a Binary Tree to BST by maintaining its original structure
282Invert given Binary Tree | Recursive and Iterative solution
283Print Right View of a Binary Tree
284Print leaf to root path for every leaf node in a binary tree
285Find maximum width of given binary tree
286Build Binary Tree from given Parent array
287C++ Program to Print Binary Tree Structure
288Find all nodes at given distance from leaf nodes in a binary tree
289Count all subtrees having same value of nodes in a binary tree
290Find Maximum Difference Between a Node and its Descendants in a Binary Tree
291Construct a Binary Tree from Ancestor Matrix
292Calculate height of a binary tree with leaf nodes forming a circular doubly linked list
293
294BST:
295
296Insertion in BST
297Search given key in BST
298Deletion from BST
299Construct balanced BST from given keys
300Determine if given Binary Tree is a BST or not
301Check if given keys represents same BSTs or not without building the BST
302Find inorder predecessor for given key in a BST
303Find Lowest Common Ancestor (LCA) of two nodes in a Binary Search Tree
304Find K’th smallest and K’th largest element in BST
305Floor and Ceil in a Binary Search Tree
306Find optimal cost to construct binary search tree
307Convert a Binary Tree to BST by maintaining its original structure
308Remove nodes from BST that have keys outside the valid range
309Find a pair with given sum in a BST
310Find inorder successor for given key in a BST
311Replace every element of an array with the least greater element on its right
312
313Divide & Conquer:
314
315Binary Search
316Find number of rotations in a circularly sorted array
317Search an element in a circular sorted array
318Find first or last occurrence of a given number in a sorted array
319Count occurrences of a number in a sorted array with duplicates
320Find smallest missing element from a sorted array
321Find Floor and Ceil of a number in a sorted array
322Search in a nearly sorted array in O(logn) time
323Find number of 1’s in a sorted binary array
324Find the peak element in an array
325Maximum Sum Subarray using Divide & Conquer
326Find Minimum and Maximum element in an array using minimum comparisons
327Efficiently implement power function | Recursive and Iterative
328Find Missing Term in a Sequence in log(n) time
329Division of Two Numbers using Binary Search Algorithm
330Find Floor and Ceil of a number in a sorted array (Recursive solution)
331Find Minimum and Maximum element in an array by doing minimum comparisons
332Find Frequency of each element in a sorted array containing duplicates
333Ternary Search vs Binary search
334Exponential search
335Interpolation search
336Merge Sort Algorithm
337Iterative Merge Sort Algorithm (Bottom-up Merge Sort)
338Merge Sort Algorithm for Singly Linked List
339Inversion Count of an array
340Quicksort Algorithm
341Iterative Implementation of Quicksort
342Hybrid QuickSort
343Quicksort using Dutch National Flag Algorithm
344Quick Sort using Hoare’s Partitioning scheme
345
346Dynamic Programming:
347
348Introduction to Dynamic Programming
349Longest Common Subsequence | Introduction & LCS Length
350Longest Common Subsequence | Space optimized version
351Longest Common Subsequence of K-sequences
352Longest Common Subsequence | Finding all LCS
353Longest Common Substring problem
354Longest Palindromic Subsequence using Dynamic Programming
355Longest Repeated Subsequence problem
356Implement Diff Utility
357Shortest Common Supersequence | Introduction & SCS Length
358Shortest Common Supersequence | Finding all SCS
359Shortest Common Supersequence | Using LCS
360Longest Increasing Subsequence using Dynamic Programming
361Longest Bitonic Subsequence
362Increasing Subsequence with Maximum Sum
363The Levenshtein distance (Edit distance) problem
364Find size of largest square sub-matrix of 1’s present in given binary matrix
365Matrix Chain Multiplication
366Find the minimum cost to reach last cell of the matrix from its first cell
367Find longest sequence formed by adjacent numbers in the matrix
368Count number of paths in a matrix with given cost to reach destination cell
3690-1 Knapsack problem
370Maximize value of the expression
371Partition problem
372Subset sum problem
373Minimum Sum Partition problem
374Find all N-digit binary strings without any consecutive 1’s
375Rod Cutting
376Maximum Product Rod Cutting
377Coin change-making problem (unlimited supply of coins)
378Coin Change Problem – Find total number of ways to get the denomination of coins
379Total possible solutions to linear equation of k variables
380Longest alternating subsequence
381Count number of times a pattern appears in given string as a subsequence
382Collect maximum points in a matrix by satisfying given constraints
383Count total possible combinations of N-digit numbers in a mobile keypad
384Find optimal cost to construct binary search tree
385Word Break Problem
386Word Break Problem | Using Trie Data Structure
387Determine Minimal Adjustment Cost of an Array
388Check if a string is K-Palindrome or not
389Wildcard Pattern Matching
390Find probability that a person is alive after taking N steps on the island
391Calculate sum of all elements in a sub-matrix in constant time
392Find maximum sum K x K sub-matrix in a given M x N matrix
393Find maximum sum submatrix present in a given matrix
394Find maximum sum of subsequence with no adjacent elements
395Maximum subarray problem (Kadane’s algorithm)
396Single-Source Shortest Paths – Bellman Ford Algorithm
397All-Pairs Shortest Paths – Floyd Warshall Algorithm
398Longest Decreasing Subsequence Problem
399Pots of Gold Game using Dynamic Programming
400Find minimum cuts needed for palindromic partition of a string
401Maximum Length Snake Sequence
4023 Partition Problem
403Calculate size of the largest plus of 1's in binary matrix
404Check if given string is interleaving of two other given strings
405Longest Increasing Subsequence using LCS
406Determine negative-weight cycle in a graph
407
408Graphs:
409
410Terminology and Representations of Graphs
411Graph Implementation using STL
412Graph Implementation in C++ without using STL
413Implement Graph Data Structure in C
414Graph Implementation in Java using Collections
415Breadth First Search (BFS) | Iterative & Recursive Implementation
416Depth First Search (DFS) | Iterative & Recursive Implementation
417Arrival and Departure Time of Vertices in DFS
418Types of edges involved in DFS and relation between them
419Bipartite Graph
420Determine if a given graph is Bipartite Graph using DFS
421Minimum number of throws required to win Snake and Ladder game
422Topological Sorting in a DAG
423Kahn's Topological Sort Algorithm
424Transitive Closure of a Graph
425Check if an undirected graph contains cycle or not
426Total paths in given digraph from given source to destination having exactly m edges
427Determine if an undirected graph is a Tree (Acyclic Connected Graph)
4282-Edge Connectivity in the graph
4292-Vertex Connectivity in the graph
430Check if given digraph is a DAG (Directed Acyclic Graph) or not
431Disjoint-Set Data Structure (Union-Find Algorithm)
432Chess Knight Problem – Find Shortest path from source to destination
433Check if given Graph is Strongly Connected or not
434Check if given Graph is Strongly Connected or not using one DFS Traversal
435Union-Find Algorithm for Cycle Detection in undirected graph
436Kruskal’s Algorithm for finding Minimum Spanning Tree
437Single-Source Shortest Paths – Dijkstra’s Algorithm
438Single-Source Shortest Paths – Bellman Ford Algorithm
439All-Pairs Shortest Paths – Floyd Warshall Algorithm
440Find Cost of Shortest Path in DAG using one pass of Bellman-Ford
441Least Cost Path in Weighted Digraph using BFS
442Find maximum cost path in graph from given source to destination
443Determine negative-weight cycle in a graph
444Print all k-colorable configurations of the graph (Vertex coloring of graph)
445Print All Hamiltonian Path present in a graph
446Greedy coloring of graph
447
448Heap:
449
450Introduction to Priority Queues using Binary Heaps
451Min Heap and Max Heap Implementation in C++
452Min Heap and Max Heap Implementation in Java
453Heap Sort
454Check if given array represents min heap or not
455Convert Max Heap to Min Heap in linear time
456Find K’th largest element in an array
457Sort a K-Sorted Array
458Merge M sorted lists of variable length
459Find K’th smallest element in an array
460Find smallest range with at-least one element from each of the given lists
461Merge M sorted lists each containing N elements
462External merge sort
463Huffman Coding
464Find first k maximum occurring words in given set of strings
465Find first k non-repeating characters in a string in single traversal
466
467Linked List:
468
469Introduction to Linked Lists
470Linked List Implementation | Part 1
471Linked List Implementation | Part 2
472Static Linked List in C
473Clone given Linked List
474Delete Linked List
475Pop operation in linked list
476Insert given node into the correct sorted position in the given sorted linked list
477Given a linked list, change it to be in sorted order
478Split the nodes of the given linked list into front and back halves
479Remove duplicates from a sorted linked list
480Move front node of the given list to the front of the another list
481Move even nodes to the end of the list in reverse order
482Split given linked list into two lists where each list containing alternating elements from it
483Construct a linked list by merging alternate nodes of two given lists
484Merge given sorted linked lists into one
485Merge Sort Algorithm for Singly Linked List
486Intersection of two given sorted linked lists
487Reverse linked list | Part 1 (Iterative Solution)
488Reverse linked list | Part 2 (Recursive Solution)
489Reverse every group of k nodes in given linked list
490Find K’th node from the end in a linked list
491Merge alternate nodes of two linked lists into the first list
492Merge two sorted linked lists from their end
493Delete every N nodes in a linked list after skipping M nodes
494Rearrange linked list in specific manner in linear time
495Check if linked list is palindrome or not
496Move last node to front in a given Linked List
497Rearrange the linked list in specific manner
498Detect Cycle in a linked list (Floyd’s Cycle Detection Algorithm)
499Sort linked list containing 0’s, 1’s and 2’s
500Stack Implementation using Linked List
501Queue Implementation using Linked List
502Remove duplicates from a linked list
503Rearrange the linked list so that it has alternating high, low values
504Rearrange a Linked List by Separating Odd Nodes from the Even Ones
505Calculate height of a binary tree with leaf nodes forming a circular doubly linked list
506
507Matrix:
508
509Print Matrix in Spiral Order
510Create Spiral Matrix from given array
511Shift all matrix elements by 1 in Spiral Order
512Find Shortest path from source to destination in a matrix that satisfies given constraints
513Change all elements of row i and column j in a matrix to 0 if cell (i, j) has value 0
514Print diagonal elements of the matrix having positive slope
515Find all paths from first cell to last cell of a matrix
516Replace all occurrences of 0 that are not surrounded by 1 in a binary matrix
517In-place rotate the matrix by 90 degrees in clock-wise direction
518Count negative elements present in sorted matrix in linear time
519Report all occurrences of an element in row wise and column wise sorted matrix in linear time
520Calculate sum of all elements in a sub-matrix in constant time
521Find maximum sum K x K sub-matrix in a given M x N matrix
522Find maximum sum submatrix present in a given matrix
523Find probability that a person is alive after taking N steps on the island
524Count the number of islands
525Flood fill Algorithm
526Find shortest safe route in a field with sensors present
527Find all occurrences of given string in a character matrix
528Shortest path in a Maze | Lee algorithm
529Check if given matrix is Toeplitz matrix or not
530In-place rotate the matrix by 180 degrees
531Fill Binary Matrix with Alternating Rectangles of 0 and 1
532Find all common elements present in every row of given matrix
533Construct a Binary Tree from Ancestor Matrix
534Find common elements present in all rows of a matrix
535Travelling Salesman Problem using Branch and Bound
536Collect maximum points in a matrix by satisfying given constraints
537Count number of paths in a matrix with given cost to reach destination cell
538Find longest sequence formed by adjacent numbers in the matrix
539Find the minimum cost to reach last cell of the matrix from its first cell
540Matrix Chain Multiplication
541Find size of largest square sub-matrix of 1’s present in given binary matrix
542Chess Knight Problem – Find Shortest path from source to destination
543Find Duplicate rows in a binary matrix
544Print all possible solutions to N Queens problem
545Print all Possible Knight’s Tours in a chessboard
546Find Shortest Path in Maze
547Find Longest Possible Route in a Matrix
548Calculate size of the largest plus of 1's in binary matrix
549Find the maximum value of M[c][d] – M[a][b] over all choices of indexes
550Find shortest distance of every cell from landmine in a Maze
551Find shortest route in a device to construct the given string
552
553Queue:
554
555Queue Implementation
556Queue Implementation using Linked List
557Chess Knight Problem – Find Shortest path from source to destination
558Shortest path in a Maze | Lee algorithm
559Find shortest safe route in a field with sensors present
560Flood fill Algorithm
561Count the number of islands
562Find Shortest path from source to destination in a matrix that satisfies given constraints
563Generate binary numbers between 1 to N
564Calculate height of a binary tree | Iterative & Recursive
565Delete given Binary Tree | Iterative & Recursive
566Level Order Traversal of Binary Tree
567Spiral Order Traversal of Binary Tree
568Reverse Level Order Traversal of Binary Tree
569Print all nodes of a given binary tree in specific order
570Print left view of binary tree
571Find next node in same level for given node in a binary tree
572Check if given binary tree is complete binary tree or not
573Print Diagonal Traversal of Binary Tree
574Print corner nodes of every level in binary tree
575Breadth First Search (BFS) | Iterative & Recursive Implementation
576Minimum number of throws required to win Snake and Ladder game
577Check if an undirected graph contains cycle or not
578Invert given Binary Tree | Recursive and Iterative solution
579Find maximum cost path in graph from given source to destination
580Find shortest distance of every cell from landmine in a Maze
581
582Sorting:
583
584Insertion sort | Iterative & Recursive
585Selection sort | Iterative & Recursive
586Bubble sort | Iterative & Recursive
587Merge Sort Algorithm
588Iterative Merge Sort Algorithm (Bottom-up Merge Sort)
589Quicksort Algorithm
590Iterative Implementation of Quicksort
591Hybrid QuickSort
592Quicksort using Dutch National Flag Algorithm
593Quick Sort using Hoare’s Partitioning scheme
594External merge sort
595Counting Sort Algorithm
596Custom Sort | Sort elements by their frequency and Index
597Custom Sort | Sort elements of the array by order of elements defined by the second array
598Inversion Count of an array
599Segregate positive and negative integers in linear time
600Efficiently Sort an Array with many Duplicated Values
601Find the smallest window in array sorting which will make the entire array sorted
602Find largest number possible from set of given numbers
603Move all zeros present in the array to the end
604Sort binary array in linear time
605Sort linked list containing 0’s, 1’s and 2’s
606Merge Sort Algorithm for Singly Linked List
607Group anagrams together from given list of words
608Activity Selection Problem
609Lexicographic sorting of given set of keys
610Heap Sort
611Merge M sorted lists of variable length
612Merge M sorted lists each containing N elements
613Find all palindromic permutations of a string
614Find all lexicographically next permutations of a string sorted in ascending order
615Merge two sorted linked lists from their end
616Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)
617Find pair with given sum in the array
618Inplace merge two sorted arrays
619Merge two arrays by satisfying given constraints
620Find maximum product of two integers in an array
621Find all distinct combinations of given length
622Find all distinct combinations of given length with repetition allowed
623Merging Overlapping Intervals
624Print all quadruplets with given sum | 4-sum problem extended
6254 sum problem | Quadruplets with given sum
626Find two numbers with maximum sum formed by array digits
627Find a Triplet having Maximum Product in an Array
628Find Minimum Product among all Combinations of Triplets in an Array
629Find all distinct combinations of given length - Part 2
630Find the surpasser count for each element of an array
631
632Stack:
633
634Stack Implementation
635Stack Implementation using Linked List
636Check if given expression is balanced expression or not
637Find duplicate parenthesis in an expression
638Evaluate given postfix expression
639Decode the given sequence to construct minimum number without repeated digits
640Inorder Tree Traversal | Iterative & Recursive
641Preorder Tree Traversal | Iterative & Recursive
642Postorder Tree Traversal | Iterative & Recursive
643Find ancestors of given node in a Binary Tree
644Check if two given binary trees are identical or not | Iterative & Recursive
645Reverse given text without reversing the individual words
646Find all binary strings that can be formed from given wildcard pattern
647Iterative Implementation of Quicksort
648Depth First Search (DFS) | Iterative & Recursive Implementation
649Invert given Binary Tree | Recursive and Iterative solution
650Print leaf to root path for every leaf node in a binary tree
651
652String:
653
654Check if given string is a rotated palindrome or not
655Longest Palindromic Substring (Non-DP Space Optimized Solution)
656Check if repeated subsequence is present in the string or not
657Check if strings can be derived from each other by circularly rotating them
658Check if given set of moves is circular or not
659Convert given number into corresponding excel column name
660Determine if two strings are anagram or not
661Find all binary strings that can be formed from given wildcard pattern
662Find all interleavings of given strings
663Isomorphic Strings
664Find all possible palindromic substrings in a string
665Find all possible combinations of words formed from mobile keypad
666Find all possible combinations by replacing given digits with characters of the corresponding list
667Find all words from given list that follows same order of characters as given pattern
668Find first k non-repeating characters in a string in single traversal
669Group anagrams together from given list of words
670Introduction to Pattern Matching
671Inplace remove all occurrences of ‘AB’ and ‘C’ from the string
672Longest even length palidromic sum substring
673Print string in zig-zag form in k rows
674Reverse given text without reversing the individual words
675Run Length Encoding (RLE) data compression algorithm
676Validate an IP address
677Find the longest substring of given string containing k distinct characters
678Find all palindromic permutations of a string
679Find all substrings of a string that are permutation of a given string
680Find the longest substring of given string containing all distinct characters
681Find all Permutations of a given string
682Iterative Approach to find Permutations of a String in C++ and Java
683Generate all Permutations of a String in Java | Recursive & Iterative
684Find all lexicographically next permutations of a string sorted in ascending order
685Find Lexicographically minimal string rotation
686Find all strings of given length containing balanced parentheses
687Find all N-digit strictly increasing numbers (Bottom-Up and Top-Down Approach)
688Find all N-digit binary numbers having more 1’s than 0’s for any prefix
689Find all N-digit numbers with given sum of digits
690Find all N-digit binary numbers with k-bits set where k ranges from 1 to N
691Generate binary numbers between 1 to N
692Find all combinations of non-overlapping substrings of a string
693Check if given sentence is syntactically correct or not
694Calculate rank of given string among all its lexicographically sorted permutations
695Find all Lexicographic Permutations of a String
696Find all N-digit binary numbers with equal sum of bits in its two halves
697Check if given string is interleaving of two other given strings
698Difference between Subarray, Subsequence and Subset
699std::next_permutation | Overview & Implementation in C++
700std::prev_permutation | Overview & Implementation in C++
701Implementation of KMP Algorithm in C, C++ and Java
702Reverse String without using Recursion
703Reverse given string using Recursion
704Reverse a String in Java in 10 different ways
705Determine if a given string is palindrome or not
706In-place remove all adjacent duplicates from the given string
707Find the minimum number of inversions needed to make the given expression balanced
708Replace all non-overlapping occurrences of the pattern
709Construct the longest palindrome by shuffling or deleting characters from a string
710Determine if characters of a String follows a specified order or not
711Print all combinations of phrases that can be formed by picking words from each of the given lists
712Remove all extra spaces from a string
713Break a string into all possible combinations of non-overlapping substrings
714Remove adjacent duplicate characters from a string
715Combinations of words formed by replacing given numbers with corresponding alphabets
716Word Break Problem
717Wildcard Pattern Matching
718Count number of times a pattern appears in given string as a subsequence
719The Levenshtein distance (Edit distance) problem
720Longest Common Subsequence | Introduction & LCS Length
721Longest Common Subsequence | Space optimized version
722Longest Common Subsequence of K-sequences
723Longest Common Subsequence | Finding all LCS
724Longest Repeated Subsequence problem
725Longest Palindromic Subsequence using Dynamic Programming
726Longest Common Substring problem
727Shortest Common Supersequence | Introduction & SCS Length
728Shortest Common Supersequence | Finding all SCS
729Shortest Common Supersequence | Using LCS
730Implement Diff Utility
731Word Break Problem | Using Trie Data Structure
732Find minimum cuts needed for palindromic partition of a string
733Check if a string is K-Palindrome or not
734Find shortest route in a device to construct the given string
735Find minimum number possible by doing at-most K swaps
736Determine if a pattern matches with a string or not
737
738Trie:
739
740Trie Implementation | Insert, Search and Delete
741Memory efficient Trie Implementation using Map | Insert, Search and Delete
742C++ Implementation of Trie Data Structure
743Longest Common Prefix in given set of strings (using Trie)
744Lexicographic sorting of given set of keys
745Find maximum occurring word in given set of strings
746Find first k maximum occurring words in given set of strings
747Find Duplicate rows in a binary matrix
748Word Break Problem | Using Trie Data Structure
749
750Greedy:
751
752Activity Selection Problem
753Huffman Coding
754Shortest Superstring Problem
755Job Sequencing Problem with Deadlines
756Greedy coloring of graph
757Kruskal’s Algorithm for finding Minimum Spanning Tree
758Single-Source Shortest Paths – Dijkstra’s Algorithm
759
760Puzzles:
761
762Clock angle problem – Find angle between hour and minute hand
763Add two numbers without using addition operator | 4 methods
764Generate power set of a given set
765Implement power function without using multiplication and division operators
766Print all numbers between 1 to N without using semicolon
767Swap two numbers without using third variable | 5 methods
768Determine the if condition to print specific output
769Find maximum, minimum of three numbers without using conditional statement and ternary operator | 4 methods
770Find numbers represented as sum of two cubes for two different pairs
771Print “Hello World” with empty main() function | 3 methods
772Tower of Hanoi Problem
773Print all numbers between 1 to N without using any loop | 4 methods
774Print a semicolon without using semicolon anywhere in the program
775Multiply two numbers without using multiplication operator or loops
776Find square of a number without using multiplication and division operator | 3 methods
777Find if a number is even or odd without using any conditional statement
778Set both elements of a binary array to 0 in single line
779Find minimum number without using conditional statement or ternary operator
780Perform Division of two numbers without using division operator (/)
781Generate 0 and 1 with 75% and 25% Probability
782Generate Desired Random Numbers With Equal Probability
783Return 0, 1 and 2 with equal Probability using the specified function
784Generate Fair Results from a Biased Coin
785Generate numbers from 1 to 7 with equal probability using specified function
786Implement Ternary Operator Without Using Conditional Expressions
787Determine if two integers are equal without using comparison and arithmetic operators
788Return 0 and 1 with equal Probability using the specified function
789Generate Random Input from an Array according to given Probabilities
790Generate Fair Results from a Biased Coin
791Magnet Puzzle
792
793Follow us on Quora: Techie Delight
794
7953.4k views · View Upvoters · View Sharers
796Manju Thalor
797
798Madhu Bhargava
799Madhu Bhargava
800Jan 2, 2017 · 4 upvotes
801This is one hell of a list. Thank You.
802
803Irfan
804Irfan
805Feb 23, 2018 · 2 upvotes
806thank you very much
807
808Vandana Sharma
809Vandana Sharma
810Mar 27, 2017 · 2 upvotes
811Thank you! :)
812
813Amit K Khanchandani
814Amit K Khanchandani
815Apr 6, 2017 · 2 upvotes
816Thanks for Sharing
817
818Jose C Fernandez
819Jose C Fernandez
820Apr 17, 2017 · 2 upvotes
821Thank you very much for compiling such list. It is a lot of work and effort.
822
823View More Comments
824About the Author
825Vivek Srivastava
826Vivek Srivastava
827Active in 2 Spaces
828View more in Techie Delight
829Details
830Techie Delight - Coding made easy
831
832Technical Interview preparation for cracking top IT companies
833People · 1.3k
834Vivek SrivastavaDan Pickett
835Vivek Srivastava and Dan Pickett are admins.
836View All