Revision DSA
Revision DSA
a. B-Tree
b. Binary Tree
c. Binary Search Tree
d. Ternary Tree
e. AVL Tree
f. None of the above
7. Given an array arr = {10, 20, 35, 47, 53, 66, 78, 82} and key = 53; What are the mid
values in the array that are generated in the first and second iterations if we are using
binary search?
a. 35 and 53
b. 47 and 53
c. 47 and 66
d. 53 and 66
8. How many swappings are required to sort the following array in descending order?
int arr [6] = {8, 22, 7, 0, 5, 13};
1- Bubble Sort; 2- Insertion Sort; 3- Selection Sort
9. How many swappings are required to sort the following array in ascending order?
int arr [6] = {8, 22, 7, 0, 5, 13};
1- Bubble Sort; 2- Insertion Sort; 3- Selection Sort
10. Given the graph below, how many paths are available to move from location 1 to 5?
11. Given the graph in question 10, which path is the best for moving 1 to 5 if the weights are a
cost?
12. Given below graph, provide the least costly simple path from 1 to 4
20. Which of the following points is/are not true about Linked List data structure when it is
compared with an array?
a. Arrays have better cache locality that can make them better in terms of performance
b. It is easy to insert and delete elements in Linked List
c. Random access is not allowed in a typical implementation of Linked Lists
d. Access of elements in linked list takes less time than compared to arrays
21. The following C function takes a singly-linked list as an input argument. It modifies the list
by moving the last element to the front of the list and returns the modified list. A part of the code
is left blank. Choose the correct alternative to replace the blank line.
b.
c.
d.
23. What does the following function do for a given Linked List with the first node as head?
b. What is a queue data structure? What are the main operations found in a queue
implementation? Explain with an example.
28. What are the differences between singly, doubly and circular linked lists?