DATA STRUCTURE INTERVIEW QUESTION & ANSWERS
16. |
What is the difference between graph and tree? |
|
Graph |
Tree |
Graph is a non-linear data structure. |
Graph is a non-linear data structure. Tree is a non-linear data structure. |
It is a collection of vertices/nodes and edges. |
It is a collection of nodes and edges. |
Each node can have any number of edges. |
General trees consist of the nodes having any number of child nodes But
in case of binary trees every node can have at the most two child nodes. |
There is no unique node called root in graph.
|
There is a unique node called root in trees. |
A cycle can be formed. |
There will not be any cycle. |
|
17. |
What is recursion? |
|
Recursion is a programming technique in which the function calls itself repeatedly for some input.
|
|
Posted by Vishnupriya. (Nov 29, 2013) |
|
It is a repetitive process in which function calls itself. |
18. |
Define the term space complexity? |
|
The space complexity is defined as the amount of space required by the data. |
19. |
What is Queue? |
|
The queue can be formally defined as ordered collection of elements that has two ends named as front and rear. From the front end one can delete the elements and from the rear end one can insert the elements.
|
20. |
What is an array? and their types? |
|
Array is the collection of similar data type and having a common name. Array is classified into two categories :- Single Dimensional Array
- Multi Dimensional Array
|