• +91 9723535972
  • info@interviewmaterial.com

Data structure Interview Questions and Answers

Data structure Interview Questions and Answers

Question - 91 : - What is the meaning of the stack overflow condition?

Answer - 91 : -

Stack overflow is the term given when the stack is full and an element cannot be inserted into the stack anymore.

Stack overflow happens when top = Maxsize – 1

Question - 92 : - What is the use of void pointers?

Answer - 92 : -

Void pointers are used because of their capability to store any pointer, which is pointing to a wide variety of data. It is used to implement heterogeneous linked lists in many programming languages.

Question - 93 : - How can elements be inserted in the circular queue?

Answer - 93 : -

There are two cases in which items can be placed in a circular queue. They are as follows:

  • When front != 0 and rear = max -1. This makes it possible as the queue will not be full, and new elements can be inserted here.
  • When rear != max -1. This ensures that the rear is incremented to the maximum allocation size, and values can be inserted easily to the rear end of the queue.

Question - 94 : - What are the disadvantages of implementing queues using arrays?

Answer - 94 : -

There are two main downsides when implementing queues using arrays. They are as follows:

  • Array sizing: The queue has to be constantly extended to make way for more elements that get implemented. Always extending the size of the array will not be feasible as there will be a discrepancy in the creation of the correct array size.
  • Memory dumps: The memory that is used to store the queue elements cannot be reused to actually store the queue. This is because of the working of queues where insertion happens at the head node only.

Question - 95 : - What is the working of post-order traversal in trees?

Answer - 95 : -

Postorder traversal works in the following way:

  • First, the left subtree is traversed through.
  • The right subtree is traversed next.
  • The root node is visited after the right subtree visit.

Question - 96 : - What is the method used for inorder traversal in trees?

Answer - 96 : -

Inorder traversal works in the following way:

  • The tree is traversed through the left subtree.
  • The root node is visited after the left visit.
  • Then, the right subtree is traversed.

Question - 97 : - What are the time complexities of linear search and binary search?

Answer - 97 : -

Binary search is more effective as it takes lesser comparisons to search for an element in an array. The time complexity for linear search is O(n), while it is O(log n) for binary search.

Question - 98 : - What is the postfix form of: (X + Y) * ( Z - C)

Answer - 98 : -

The postfix form of the given expression is XY+ZC-*

Question - 99 : - Which is the fastest sorting algorithm available?

Answer - 99 : -

Among the many types of algorithms such as bubble sort, quick sort, merge sort, and more, it is not right to put one method on the podium for performance as this greatly varies based on data, the reaction after the algorithm processes the data, and how it’s stored. The concept of time complexity is considered here.

Question - 100 : - How does bubble sort work?

Answer - 100 : -

Bubble sort is one of the most used sorting techniques out there. It is applied to arrays where elements adjacent to each other are compared and values are exchanged based on the order of arrangement. It’s called bubble sort because of the concept of exchanging elements like a bubble floating to the top of the water and larger entities sinking down to the bottom end.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners