Data Structure interview questions

1. What is data structure?
Data structure refers to the way data is organized and manipulated.
Data structure seeks to find ways to make data access more efficient.
Data structure deal with different set of data and how they can relate to one another in an organized manner.
Data structure is a collection of data values, relationships among them, and the various functions or operations that can be applied to the data.
Data structure offers a convenient way of organizing as well as manipulating the data.

2. What is a Binary Tree in Data structure ?
A binary tree is a special type of tree in which every node or vertex has either no child node or one child node or two child nodes. It can also be defined as a finite set of nodes which is either empty or consists of a root and two disjoint binary trees called the left sub-tree and right sub-tree.

3. Which data structures are used for BFS and DFS of a graph?
Queue is used for BFS.
Stack is used for DFS.
Note : DFS can also be implemented using recursion.

4. How can you implement a stack using a queue?
A stack can be implemented using two queues.
By making push operation
By making pop operation

5. What is a Spanning tree?
A spanning tree is a tree associated with a network.
All the nodes of the graph appear on the tree once.
A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

Author: user

Leave a Reply