DATA STRUCTURE INTERVIEW QUESTION & ANSWERS
36. |
What is the difference between backtracking and branch and bound? |
|
backtracking |
branch and bound |
Solution for backtracking is traced using depth first search. |
In this method, it is not necessary to use depth first search for obtaining the
solution, even the breadth first search, best first search can be applied.
|
Typically decision problems can be solved using backtracking. |
Typically optimization problems can be
solved using branch and bound. |
The state space tree is searched until the solution is obtained.
|
The state space tree needs to be searched completely as there may be
chances of being an optimum solution any where in state space tree. |
Applications of backtracking are – Knapsack, sum of subset. |
Applications of branch and bound are – Job sequencing, TSP
|
|
37. |
What are the drawbacks of AVL Tree? |
|
- In AVL trees frequent rotations need to be applied for making the tree balanced.
- The balance factor of each node needs to be maintained.
- IN AVL trees, the deletion operation is complex one.
|
38. |
What are the different strategies of problem solving? |
|
There are two distinct problem solving approaches,- Procedural programming
- Object oriented programming
|
39. |
What is the difference between procedural and object oriented programming? |
|
The procedural programming executes series of procedures sequentially. The collection of data structure is related with each other as well as with the procedures. This is basically a top down problem solving approach. In object oriented programming approach there is a collection of objects.
Each object consists of corresponding data structures and the required
operations (procedures). This is basically the bottom up problem solving
approach.
|
40. |
Is quick sort stable sorting algorithm? |
|
No, quick sort is not a stable sorting algorithm because after applying this sorting method the ordering of similar elements may not be preserved. (Since swapping is involved in this sorting with pivot element). |