data structure problems and solutions pdf

Then Optimized methods. Thank you so much this. It also comes in varieties like a singly linked list, which allows you to traverse in one direction (forward or reverse); a doubly linked list, which allows you to traverse in both directions (forward and backward); and finally, the circular linked list, which forms a circle. $('#content').show(); Without any further ado, here is my list of some of the most frequently asked coding interview questions from programming job interviews: An array is the most fundamental data structure, which stores elements at contiguous memory location. DEV Community © 2016 - 2020. That’s a great list worthy of study in any context. Thank you a lot. I wanted to thank the author(s) of the DP articles! It is nearly complete (and over 500 pages total!! So, if you think 50 is not enough and you need more, then check out these additional 50 programming questionsfor telephone interviews and these books and courses for a more thorough preparation. $('#content').hide(); Week 4: Hash tables. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines … of swaps of left & right child, Find Lowest Common Ancestor (LCA) of two nodes in a binary tree, Print all paths from root to leaf nodes in a binary tree, Find ancestors of given node in a Binary Tree, Find the distance between given pairs of nodes in a binary tree, Perform vertical traversal of a binary tree – I, Perform vertical traversal of a binary tree – II, Print corner nodes of every level in binary tree, Find the diagonal sum of given binary tree, In-place convert Binary Tree to Doubly Linked List, Sink nodes containing zero to the bottom of the binary tree, Convert given binary tree to full tree by removing half nodes, Truncate given binary tree to remove nodes which lie on a path having sum less than K, Find maximum sum root-to-leaf path in a binary tree, Check if given binary tree is height balanced or not, Convert normal binary tree to Left-child right-sibling binary tree, Determine if given Binary Tree is a BST or not, Convert a Binary Tree to BST by maintaining its original structure, Print all paths from leaf to root node in given binary tree, Iteratively print leaf to root path for every leaf node in a binary tree, Build Binary Tree from given Parent array, Find all nodes at given distance from leaf nodes in a binary tree, Count all subtrees having same value of nodes in a binary tree, Find Maximum Difference Between a Node and its Descendants in a Binary Tree, Construct a Binary Tree from Ancestor Matrix, Calculate height of a binary tree with leaf nodes forming a circular doubly linked list, Find maximum sum path between two leaves in a binary tree, Fix a binary tree that is only one swap away from becoming a BST, Construct a binary tree from inorder and preorder traversal, Construct a binary tree from inorder and postorder traversals, Construct a binary tree from inorder and level order sequence, Construct a full binary tree from preorder sequence with leaf node information, Construct a full binary tree from a preorder and postorder sequence, Find postorder traversal of a binary tree from its inorder and preorder sequence, Set next pointer to inorder successor of all nodes in binary tree, Efficiently print all nodes between two given levels in a binary tree, Find preorder traversal of a binary tree from its inorder and postorder sequence, Find the difference between sum of all nodes present at odd and even levels in a binary tree, Find the size of the largest BST in a Binary Tree, Link nodes present in each level of a binary tree in the form of a linked list, Construct a Cartesian Tree from In-order Traversal, Implementation of Treap Data Structure (Insert, Search and Delete), Threaded Binary Tree: Overview and Implementation, Invert alternate levels of a perfect binary tree, Convert a Binary Tree into a Doubly Linked List in Spiral Order, Check if a binary tree is a min-heap or not, Determine if a binary tree satisfy the height-balanced property of red–black tree, Construct an Ancestor Matrix from a Binary Tree, Depth first search (DFS) vs Breadth first search (BFS), Check if given keys represents same BSTs or not without building the BST, Find inorder predecessor for given key in a BST, Find Lowest Common Ancestor (LCA) of two nodes in a Binary Search Tree, Find K’th smallest and K’th largest element in BST, Find optimal cost to construct binary search tree, Remove nodes from BST that have keys outside the valid range, Find k’th smallest node in a Binary Search Tree (BST), Find inorder successor for given key in a BST, Update every key in BST to contain sum of all greater keys, Check if a given sequence represents preorder traversal of a BST, Build a Binary Search Tree from a Postorder Sequence, Build a Binary Search Tree from a Preorder Sequence, Count subtrees in a BST whose nodes lies within a given range, Merge two BSTs into a doubly linked list in sorted order, Construct a height-balanced BST from an unbalanced BST, Convert a Binary Search Tree into a Min Heap, Construct a Height-Balanced BST from a Sorted Doubly Linked List, Maximum Sum Subarray using Divide & Conquer, Division of Two Numbers using Binary Search Algorithm, Find square root of a number using binary search algorithm, Longest Common Subsequence | Space optimized version, Longest Common Subsequence of K-sequences, Longest Common Subsequence | Finding all LCS, Shortest Common Supersequence | Finding all SCS, Shortest Common Supersequence Problem using LCS, The Levenshtein Distance (Edit Distance) Problem, Find size of largest square sub-matrix of 1’s present in given binary matrix, Find minimum cost to reach last cell of the matrix from its first cell, Find longest sequence formed by adjacent numbers in the matrix, Count number of paths in a matrix with given cost to reach destination cell, Total possible solutions to linear equation of k variables, Count number of times a pattern appears in given string as a subsequence, Collect maximum points in a matrix by satisfying given constraints, Find all N-digit binary strings without any consecutive 1’s, Count total possible combinations of N-digit numbers in a mobile keypad, Determine Minimal Adjustment Cost of an Array, Find total ways to achieve given sum with n throws of dice having k faces, Find number of ways to fill a N x 4 matrix with 1 x 4 tiles, Ways to reach the bottom-right corner of a matrix with exactly k turns allowed, Find total ways to reach the n’th stair with at-most m steps, Find total ways to reach the n’th stair from the bottom, Find minimum number of deletions required to convert a string into palindrome, Calculate minimum cost to reach destination city from source city, Find minimum cuts needed for palindromic partition of a string, Weighted Interval Scheduling using LIS algorithm, Find minimum jumps required to reach the destination, Find probability that a person is alive after taking N steps on the island, Calculate size of the largest plus of 1’s in binary matrix, Count all paths in a matrix from first cell to last cell, Check if a string matches with a given wildcard pattern, Check if given string is interleaving of two other given strings, Find all employees who directly or indirectly reports to a manager, Collect maximum value of coins in a matrix, Find length of longest path in the matrix with consecutive characters, Calculate sum of all elements in a sub-matrix in constant time, Find maximum sum K x K sub-matrix in a given M x N matrix, Find maximum sum submatrix present in a given matrix, Single-Source Shortest Paths – Bellman Ford Algorithm, All-Pairs Shortest Paths – Floyd Warshall Algorithm, Terminology and Representations of Graphs, Arrival and Departure Time of Vertices in DFS, Types of edges involved in DFS and relation between them, Determine if a given graph is Bipartite Graph using DFS, Check if an undirected graph contains cycle or not, Total paths in given digraph from given source to destination having exactly m edges, Determine if an undirected graph is a Tree (Acyclic Connected Graph), Check if given digraph is a DAG (Directed Acyclic Graph) or not, Disjoint-Set Data Structure (Union-Find Algorithm), Chess Knight Problem – Find Shortest path from source to destination, Check if given Graph is Strongly Connected or not, Check if given Graph is Strongly Connected or not using one DFS Traversal, Union-Find Algorithm for Cycle Detection in undirected graph, Kruskal’s Algorithm for finding Minimum Spanning Tree, Single-Source Shortest Paths – Dijkstra’s Algorithm, Find Cost of Shortest Path in DAG using one pass of Bellman-Ford, Least Cost Path in Weighted Digraph using BFS, Find maximum cost path in graph from given source to destination, Determine negative-weight cycle in a graph, Least cost path in given digraph from given source to destination having exactly m edges, Find the correct order of alphabets in a given dictionary of ancient origin, Find longest path in a Directed Acyclic Graph (DAG), Construct a directed graph from undirected graph that satisfies given constraints, Introduction to Priority Queues using Binary Heaps, Convert Max Heap to Min Heap in linear time, Find first k non-repeating characters in a string in single traversal, Find first k maximum occurring words in given set of strings, Insert given node into the correct sorted position in the given sorted linked list, Rearrange linked list in increasing order (Sort linked list), Split the nodes of the given linked list into front and back halves, Remove duplicates from a sorted linked list, Move front node of the given list to the front of the another list, Move even nodes to the end of the list in reverse order, Split given linked list into two lists where each list containing alternating elements from it, Construct a linked list by merging alternate nodes of two given lists, Merge Sort Algorithm for Singly Linked List, Intersection of two given sorted linked lists, Reverse every group of k nodes in given linked list, Find K’th node from the end in a linked list, Merge alternate nodes of two linked lists into the first list, Merge two sorted linked lists from their end, Delete every N nodes in a linked list after skipping M nodes, Rearrange linked list in specific manner in linear time, Check if linked list is palindrome or not, Move last node to front in a given Linked List, Rearrange the linked list in specific manner, Detect Cycle in a linked list (Floyd’s Cycle Detection Algorithm), Sort linked list containing 0’s, 1’s and 2’s, Rearrange the linked list so that it has alternating high, low values, Rearrange a Linked List by Separating Odd Nodes from the Even Ones, XOR Linked List: Overview and Implementation, Convert a multilevel linked list to a singly linked list, Recursively check if linked list of characters is palindrome or not, Remove redundant nodes from a path formed by a linked list, Add a single-digit number to a linked list representing a number, Reverse every alternate group of k nodes in a linked list, Determine if a given linked list is a palindrome or not, Sort a Doubly Linked List using Merge Sort, Pairwise swap adjacent nodes of a linked list, Check if a Linked List of String is Palindromic, Swap K’th node from beginning with K’th node from end in a Linked List, Add two linked lists without using any extra space, Update random pointer for each linked list node to point to the maximum node, Convert a Ternary Tree to a Doubly Linked List, Print nodes of a given binary tree in vertical order, In-place merge two sorted linked lists without modifying links of the first list, Reverse specified portion of a Linked List, Shift all matrix elements by 1 in Spiral Order, Find Shortest path from source to destination in a matrix that satisfies given constraints, Change all elements of row i and column j in a matrix to 0 if cell (i, j) has value 0, Print diagonal elements of the matrix having positive slope, Find all paths from first cell to last cell of a matrix, Replace all occurrences of 0 that are not surrounded by 1 in a binary matrix, In-place rotate the matrix by 90 degrees in clock-wise direction, Count negative elements present in sorted matrix in linear time, Report all occurrences of an element in row wise and column wise sorted matrix in linear time, Find shortest safe route in a field with sensors present, Find all occurrences of given string in a character matrix, Check if given matrix is Toeplitz matrix or not, In-place rotate the matrix by 180 degrees, Fill Binary Matrix with Alternating Rectangles of 0 and 1, Find all common elements present in every row of given matrix, Find common elements present in all rows of a matrix, Find index of the row containing maximum number of 1’s in a binary matrix, Find the largest square sub-matrix which is surrounded by all 1’s, Find minimum passes required to convert all negative values in the matrix, Print a spiral square matrix without using any extra space, Young Tableau | Insert, Search, Extract-Min, Delete, Replace, Replace all occurrences of 0 that are completely surrounded by 1 in a binary matrix, Find the maximum value of M[c][d] – M[a][b] over all choices of indexes, Find shortest distance of every cell from landmine in a Maze, Find shortest route in a device to construct the given string, Travelling Salesman Problem using Branch and Bound, Clock Angle Problem – Find angle between hour and minute hand, Add two numbers without using addition operator, Implement power function without using multiplication and division operators, Print all numbers between 1 to N without using semicolon, Swap two numbers without using third variable, Determine the if condition to print specific output, Find maximum & minimum of triplet without using conditional statement and ternary operator, Find numbers represented as sum of two cubes for two different pairs, Print all numbers between 1 to N without using any loop, Print a semicolon without using semicolon anywhere in the program, Multiply two numbers without using multiplication operator or loops, Find square of a number without using multiplication and division operator, Find if a number is even or odd without using any conditional statement, Set both elements of a binary array to 0 in single line, Find minimum number without using conditional statement or ternary operator, Generate 0 and 1 with 75% and 25% Probability, Generate Desired Random Numbers With Equal Probability, Return 0, 1 and 2 with equal Probability using the specified function, Generate numbers from 1 to 7 with equal probability using specified function, Implement Ternary Operator Without Using Conditional Expressions, Determine if two integers are equal without using comparison and arithmetic operators, Return 0 and 1 with equal Probability using the specified function, Write a C/C++ program without using main function, Single line expressions to swap two integers in Java, Find Maximum Number without using Conditional Statement or Ternary Operator, Implement Stack using Queue Data Structure, Implement a Queue using Stack Data Structure, Iterative Merge Sort Algorithm (Bottom-up Merge Sort), QuickSort using Dutch National Flag Algorithm, QuickSort using Hoare’s Partitioning scheme, Problems solved using partitioning logic of QuickSort, Efficiently sort an array with many duplicated values, Segregate positive and negative integers using Merge Sort, Group anagrams together from given list of words, Check if given expression is balanced expression or not, Find duplicate parenthesis in an expression, Decode the given sequence to construct minimum number without repeated digits, Design a stack which returns minimum element in constant time, Design a stack which returns minimum element without using auxiliary stack, Find length of the longest balanced parenthesis in a string, Reverse a string using stack data structure, Reverse given text without reversing the individual words, Print leaf to root path for every leaf node in a binary tree, Check if given string is a rotated palindrome or not, Longest Palindromic Substring (Non-DP Space Optimized Solution), Check if repeated subsequence is present in the string or not, Check if strings can be derived from each other by circularly rotating them, Check if given set of moves is circular or not, Convert given number into corresponding excel column name, Determine if two strings are anagram or not, Find all possible palindromic substrings in a string, Find all possible combinations of words formed from mobile keypad, Find all possible combinations by replacing given digits with characters of the corresponding list, Find all words from given list that follows same order of characters as given pattern, Find minimum operations required to transform a string into another string, Determine if a string can be transformed into another string with a single edit, In place remove all occurrences of ‘AB’ and ‘C’ from the string, Longest even length palindromic sum substring, Run Length Encoding (RLE) Data Compression Algorithm, Find the longest substring of given string containing k distinct characters, Find all palindromic permutations of a string, Find all substrings of a string that are permutation of a given string, Find the longest substring of given string containing all distinct characters, Iterative Approach to find Permutations of a String, Generate all Permutations of a String in Java, Find all lexicographically next permutations of a string sorted in ascending order, Find Lexicographically minimal string rotation, Find all strings of given length containing balanced parentheses, Find all combinations of non-overlapping substrings of a string, Determine if a given string is palindrome or not, Find the minimum number of inversions needed to make the given expression balanced, Construct the longest palindrome by shuffling or deleting characters from a string, Print all combinations of phrases formed by picking words from each of the given lists, Break a string into all possible combinations of non-overlapping substrings, Remove adjacent duplicate characters from a string, Find first non-repeating character in a string by doing only one traversal of it, Find all N-digit strictly increasing numbers (Bottom-Up and Top-Down Approach), Find all N-digit binary numbers having more 1’s than 0’s for any prefix, Find all N-digit numbers with given sum of digits, Find all N-digit binary numbers with k-bits set where k ranges from 1 to N, Find all N-digit binary numbers with equal sum of bits in its two halves, Find all N-digit numbers with equal sum of digits at even and odd index, Find all Lexicographic Permutations of a String, Find all lexicographically previous permutations of a string sorted in descending order, Replace all non-overlapping occurrences of the pattern, Determine if characters of a String follow a specified order or not, In-place remove all adjacent duplicates from the given string, Check if given sentence is syntactically correct or not, Find all words matching a pattern in the given dictionary, Longest Palindromic Subsequence using Dynamic Programming, Memory Efficient Implementation of Trie | Insert, Search and Delete, Longest Common Prefix in given set of strings (using Trie), Lexicographic sorting of given set of keys, Find maximum occurring word in given set of strings.

Cotswold Sheep Height, Richard Burton Explorer Books, Best Airbnb Nashville, Properties Of Merino Wool, Sri Krishna College Of Engineering And Technology Fees Structure,

Leave a Reply

Your email address will not be published. Required fields are marked *