Data Structure Interview Questions and Answers

1. What is Data Structure ?

Answer : Data structures are used to store data in a computer in an organized form...

A. 2

B. 4

C. 6

D. 8

3. One of the following options is a form of access used to add and remove nodes from a queue ?

A. LIFO

B. FIFO

C. Both LIFO and FIFO

D. Recursion

A. Quick

B. Merge

C. Time

D. Heap

A. ω(n4)

B. O(n3)

C. Both Equally

D. Can't be said

A. O(n)

B. O(n2)

C. O(1)

D. O(log n)

A. Quick

C. Bubble

D. Heap

8. Detect loop in a linked list ?

Answer : There are two ways to detect loop in linked list...

9. How to remove duplicates from a sorted linked list ?

Answer : To write a removeDuplicates() function which takes a list sorted...

10. Write a program to reverse a string using stack data structure ?

Answer : Given a string, reverse it using stack...

11. How to find Second largest element in a BST ?

Answer : In an N-ary tree, the second largest value in the given tree to find and return the node...

12. What is N Queen Problem ?

Answer : Let us discuss N Queen problem that can be solved using Backtracking...

13. Write a function to Delete a node from Doubly Linked List ?

Answer : In a single linked list, every node has link to its next node in the sequence...

14. What is Stack in Data Structure ?

Answer : A stack is a container of objects that are performed...

15. What is Queue in Data Structure ?

Answer : A queue is a container of objects (a linear collection) that are inserted...

16. Difference between Stack and Heap ?

Answer : Stack has very fast to access...

17. What is Linkedlist Data Structures with Example ?

Answer : A linked list is a sequence of data structures, which are connected...

18. What is Binary Tree in data structures ?

Answer : Binary tree is a special type of data structure...

19. How to detect a cycle in a linked list ?

Answer : A linked list is said to contain a cycle ...

20. How to delete an element in a linked list ?

Answer : To delete a node from linked list....

21. Write a function to get the intersection point of two Linked Lists ?

Answer : Intersection point means end of one linked list is linked..

22. Difference between Array and Linked List ?

Answer : Arrays are index-based data structure...

23. How to make a linked list program for a given list ?

Answer : Linked List is a type of Linear Data Structure that is mostly used data structure....

24. Inorder Tree Traversal without recursion and without stack ?

Answer : To traverse the tree using Morris Traversal...

25. Delete all occurrences of a given key in a linked list ?

Answer : Given a singly linked list, delete all occurrences...

26. What are the Minimum Initial Points to Reach Destination ?

Answer : To begin from the upper left corner of a given framework...

27. How to Count number of bits to be flipped to convert A to B ?

Answer : Write the program to count number of bits needed to be flipped...

28. How to Kadane's Algorithm is works ?

Answer : Given a 2D array, find the maximum sum subarray...

29. Find middle of Linked list ?

Answer : Given a singly linked list...

30. What is Binary search tree ?

Answer : The Binary search tree is a node-based on the binary tree data structure...