0% found this document useful (0 votes)
36 views

Topic Wise Questions

Gshshssbbs

Uploaded by

Sachin Yadav
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Topic Wise Questions

Gshshssbbs

Uploaded by

Sachin Yadav
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Here’s a list of GATE-level questions based on the syllabus for Data Structures:

Unit-I: Introduction to Data Structures, Algorithms, Arrays, Pointers, and Strings

1. What is the time complexity of the best, worst, and average case of a linear
search algorithm?

2. Explain the difference between time complexity and space complexity. Give
examples.

3. Given an algorithm with time complexity O(n log n), explain what kind of
algorithm it could be and why.

4. What is the difference between malloc and calloc functions in C? How does free
work?

5. Explain static vs. dynamic memory allocation with examples.

6. What are the advantages and disadvantages of using recursion? Compare it with
iteration.

7. For an array of size n, how would you calculate the address of an element in a
multi-dimensional array?

8. How are arrays stored in memory? Explain row-major and column-major order for
multi-dimensional arrays.

9. What is the difference between a one-dimensional array and a pointer?

10. Write the time complexity for basic array operations such as accessing an
element, searching for an element, and inserting/deleting an element.

11. Explain the difference between a pointer to an integer and an array of


integers.

12. What is a string in C? How does the function strlen() calculate the length of a
string?

13. What is a recursive function, and how is it implemented in a compiler stack?

14. Explain the difference between passing an array to a function by value and by
reference.

15. Write a recursive algorithm for computing the factorial of a number. Analyze
its time complexity.
16. If the input size n doubles, how does it affect the time complexity for
algorithms with O(n), O(log n), and O(n^2)?

17. Explain how a character string is represented and manipulated in C. Compare it


with string handling in other languages like Python or Java.

18. Describe how pointer arithmetic works and give examples.

19. How would you reverse a string using recursion and using iteration? Compare the
approaches.

20. What are the implications of dynamic memory allocation in terms of performance
and memory usage?

Unit-II: Stacks and Queues

21. Explain the basic operations of a stack and their time complexities.

22. What are the applications of stacks in system programming?

23. What is a stack overflow, and how can it occur in a recursive function?

24. Explain the implementation of a stack using arrays. What is the drawback of
this implementation?

25. Describe how multiple stacks can be implemented in a single array.

26. How can a stack be used to evaluate postfix expressions?

27. Convert the infix expression (A + B) * (C / D) – E into postfix using stack.

28. Explain the operations of a queue and their time complexities.

29. What is the difference between a circular queue and a linear queue?

30. How does a circular queue help in avoiding the limitation of a static queue
implementation?

31. What is a priority queue? How is it different from a normal queue?


32. Write a program to implement a queue using two stacks. What is the time
complexity for enqueue and dequeue operations?

33. How is a deque (double-ended queue) implemented? What are its applications?

34. Explain the difference between enqueue and dequeue operations in queues.

35. What are the advantages of using a circular queue in system-level applications
like printers or process scheduling?

36. How does a priority queue differ in terms of insertion and deletion compared to
a regular queue?

37. What is the worst-case time complexity for performing an insertion in a stack
implemented using arrays?

38. Explain the role of queues in breadth-first search (BFS) of graphs.

39. Describe the circular queue insertion and deletion operations with pseudocode.

40. What are the conditions for overflow and underflow in a circular queue?

Unit-III: Linked Lists and Trees

41. What is a linked list? Compare it with arrays in terms of memory allocation and
access times.

42. Describe how insertion and deletion are performed in a singly linked list.

43. Write the time complexity for the basic operations (searching, insertion, and
deletion) in a singly linked list.

44. Explain how a doubly linked list differs from a singly linked list.

45. What are the advantages and disadvantages of using a doubly linked list?

46. Write the time complexity of searching, insertion, and deletion operations in a
doubly linked list.

47. What is a circular linked list, and what are its applications?

48. How is memory allocation handled in a linked list?


49. What is the time complexity of inserting an element at the beginning, middle,
and end of a singly linked list?

50. Explain how a circular doubly linked list is implemented.

51. Define a binary tree. What is the time complexity for searching an element in a
binary search tree?

52. What is the difference between a binary tree and a binary search tree?

53. Explain pre-order, in-order, and post-order tree traversal. What are their
applications?

54. What is the difference between a complete binary tree and a perfect binary
tree?

55. How is insertion performed in a binary search tree (BST)?

56. Explain the concept of balancing in AVL trees and why it is necessary.

57. What are the different types of rotations in AVL trees? Give examples.

58. Describe the process of inserting and deleting a node in an AVL tree.

59. What is a threaded binary tree, and why is it used?

60. What is the time complexity for searching in a balanced AVL tree?

61. What is the role of a height-balanced tree in reducing time complexity?

62. What is a B-tree? Where is it used, and how does it differ from a binary tree?

63. Explain the structure of a B+ tree and its advantages in database indexing.

64. Compare the advantages of using an AVL tree over a binary search tree.

65. What is the worst-case time complexity of inserting an element in a binary


search tree (BST)?

66. What is tree traversal, and how is it different in depth-first and breadth-
first search?

67. Write the time complexity for the different tree traversal techniques.

68. Explain the term "strictly binary tree". How is it different from a regular
binary tree?

69. What is a degenerate tree, and how does it affect the time complexity of search
operations?

70. Write pseudocode for tree insertion in a binary search tree.

Unit-IV: Graphs, Searching, Sorting, and Hashing

71. Define a graph and explain its components.

72. What is the difference between a directed and an undirected graph?

73. How is a graph represented using adjacency lists and adjacency matrices?

74. Explain depth-first search (DFS) and breadth-first search (BFS) for graph
traversal.

75. What are the applications of graph traversal techniques in real-world


scenarios?

76. Write the time complexity for BFS and DFS graph traversal algorithms.

77. What is the shortest path algorithm? Explain Dijkstra's algorithm.

78. Compare BFS and DFS in terms of time complexity and space complexity.

79. What is a cycle in a graph? How can we detect it using DFS?

80. Explain the Bellman-Ford algorithm and its applications.

81. What are the different types of searching techniques? Explain binary search.

82. What is the time complexity of binary search? How is it better than linear
search?
83. Explain quick sort. What is its average case and worst-case time complexity?

84. Explain how merge sort works and why it is stable.

85. What is the time complexity of bubble sort, and why is it not preferred for
large datasets?

86. Write the pseudocode for the quick sort algorithm.

87. Explain the difference between selection sort and insertion sort.

88. What is hashing, and how is it used in searching?

89. What are the different types of hash functions?

90. Explain the concept of collisions in hashing and how they are resolved.

91. What is a collision resolution technique? Explain linear probing and chaining.

92. What is double hashing, and how does it help in collision resolution?

93. What is perfect hashing, and when is it used?

94. Write the time complexity for the basic hashing operations (insertion, search,
deletion).

95. Explain how hash functions can lead to non-uniform distribution.

96. What are the disadvantages of open addressing in collision resolution?

97. Compare chaining with open addressing as a collision resolution technique.

98. What is the role of load factor in hashing?

99. Write pseudocode for implementing hash insertion using linear probing.

100. Explain how rehashing works and why it is necessary in dynamic hash tables.

You might also like