Data Structures Interview Questions
0of 0 votesHow to design a good hash function if the key is a person`s name
0of 0 votesWhat is Height balanced tree ?
Difference between Red Black Tree and AVL Tree ?
0of 0 votesGiven a doubly linked list containing only three integers 1,2,3. Sort the list without exchanging the values.
Eg- 1->3->2->1->2->3->2->1->1
output: 1->1->1->1->2->2->2->3->3
0of 0 votesGiven a Binary tree where nodes may have positive or negative value, store the sum of the left and right subtree in the nodes.
Eg-10 -2 6 8 -4 7 5
Output:
20(-2+6+4+12) 4(8-4) 12(7+5) 0 0 0 0
0of 0 votesYou have given a file containing sentences. Now you are given a sequence of characters. You have to find the starting location of each word containing one of the permutation of the word.
e.g File - 'She submitted her assignment.' Input Sequence - imt. Since the file contains the word 'submitted' containing the sequence 'mit' which is a permutation of 'imt' So it will return 1. Similiarly it will return for all other words.
0of 0 votesGiven a large file of integers, how to compress the file so that we can also do search efficiently?
0of 0 votesOne another question given two arrays A[i[ and B[i] print the product such that B[i] = A[0] * A[1]...A[i-1] i.e other than its position all products
Algorithms can be use a kind of additional storage to figure out pre prods - from i to i-1 and from i+1 to i and then combine
Division wasnt allowed !!!
0of 0 votesGiven a tree, parse the tree using breadth first search and then find the last element in the tree. After finding the last element, replace that element with the root node. Eg. Input:
A B C D E F G
Output:
G B C D E F A
0of 0 votesExplain STL maps- Hash tables and buckets.
0of 0 votesSimple questions were asked.
1. Get the number of employees from every department given employee and dept tables.
2. How would you optimize a query considering that it is performing very bad.
3. What happens behind the scene when you hit any website URL in the web browser.
0of 0 votesThere is sorted integer metrics(5,5). Write the program which through we can find the any integer value on this metrics.Search(int searchItem,M(5,5).
0of 0 votesData structure used in parking lot.
0of 0 votesConvert a binary search tree to a sorted doubly linked list in O(n) time and in place. Manipulate the existing tree. Donot create a new tree.
0of 0 votesBrief abour AVL tree
0of 0 votesWhat kind a data structure will you use to implement an Instant Search feature
0of 0 votesExplain data structure and design for list feature or auto complete suggestion.
Tries and Has map implementation.
0of 0 votesgive a binary tree (not BST)where tree node, with extra pointer inorder-successor, initaliy all inorder-successor pointer set to NULL.
write a code to set all pointer to its inordersuccessor.
struct Node
{
int data;
Node *left, *right;
Node *successor;
};
0of 0 votesGiven a list
emp1 manger1
emp2 manager2
It contains all the employes and manager relationship. From this list construct the organizational tree of company. Write programme for it.
0of 0 votesDesign a hashtable, you have 1000 items, how many slot would you choose. why.
0of 0 votesI was asked to design a data structure for a phone address book with 3 fields
name, phone number , address
one must be able to search this phone book on any of the 3 fields .
0of 0 votesDesign a queue (FIFO) using only stacks (LIFO). The only supported operations on the stack are: Push(), Pop() and IsEmpty(). The final queue had to implement the operations Queue() and Dequeue(). The program had to be efficient and handle exceptions.
0of 0 votesA "Most efficient data structure" is designed to optimize the following operations. Pop, Push, Min. The best possible time-complexities with no extra space, respectively would be?
0of 0 votesThere is a 2d matrix and in each point there are some gold coins.
Then starting from the bottom left point you have to collect the maximum number of points. The constraint is that you can only move in right and up direction.
Then asked me to optimize it
After that do it using recursion
Compare the two methods
Give a mathematical formula for this problem.
0of 0 votesCreate a structure that will allow you to search a person by first name or last name (or both), in better than O(N) timeframe.
0of 0 voteswhen would you prefer to use a linked list over an array and vice versa
0of 0 votesRound1: Q2
Discussion on various data structure where the following operations could have minimal cost:
1.insert
2.delete
3.search
4.return any element
0of 0 votesRound 2: Discussion
Discussion on various data structures and search complexity in them.
Few questions on hashing.
0of 0 votesDesign an Evaluation of a mathematical expression.
0of 0 votesImplement Game of Snake DS, Why this DS, Approaches for optimizing the current DS
0of 0 votesConvert a BST to sorted Double linked list
