Top Data-Structures Interview Questions
Mobiprep handbooks are free downloadable placement preparation resources that can help you ace any company placement process. We have curated a list of the 40 most important MCQ questions which are asked in most companies such as Infosys, TCS, Wipro, Accenture, etc. The placement handbooks also have detailed explanations for every question ensuring you revise all the questions with detailed answers and explanations.
Question
9
Explanation
What is the maximum number of spanning tree a graph can have?
The maximum number of spanning trees that a graph can have depended on how connected the graph is. A complete undirected graph with n number of nodes can have a maximum of n^n-2 number of spanning trees.
Spanning tree has n-1 edges, where n is the number of nodes (vertices).
From a complete graph, by removing maximum e - n + 1 edges, we can construct a spanning tree.
A complete graph can have maximum n^n-2 number of spanning trees.
Question
10
Explanation
Which is the best data structure to check whether an arithmetic expression has balanced parenthesis. Explain
Stacks can check equal pair/ balanced pair of parenthesis efficiently. Whenever we get an opening parenthesis we can push it on the stack and when we get the corresponding closing parenthesis, we can pop it.
After performing all push and pop operations, if at the end of the expression stack becomes empty then the expression has a balanced parenthesis.
Question
11
Explanation
List some data structure that use pointers.
Binary trees
Linked lists
Queues
Stacks
Question
12
Explanation
How will you delete a node from a linkedlist when a key is given?
When a key is given then the following steps can be used:
1) Find previous node of the node to be deleted.
2) Change the next of previous node.
3) Free memory for the node to be deleted.
The time complexity of deleting a node is O(n)



.png)