Computer Knowledge

Data Structures and Algorithms

1,256 Questions

Data Structures and Algorithms form the core of computer science, focusing on arrays, linked lists, trees, and sorting mechanisms. These concepts are essential for solving complex computational problems efficiently. Test takers preparing for technical and administrative IT exams will find these questions highly relevant.

Array OperationsLinked List ApplicationsSorting AlgorithmsTree Data StructuresMultilevel IndexingAlgorithm Time Complexity

Data Structures and Algorithms Questions

Multiple choice
  1. Values of in the left subtree are less than root.

  2. Values of in the right subtree are greater than or equal to the root.

  3. Each subtree is itself a binary search tree.

  4. They do not have a recursively defined data structure.

  5. The nodes at the lowest levels of the tree are known as leaves.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This is the wrong answer since they have a recursively defined data structure.

Multiple choice
  1. Insertion sort

  2. Quick sort

  3. Selection sort

  4. Bubble sort

  5. Binary search

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

It is a right answer since it is based on 'divide and conquer' method, which requires a middle element. Pivot is used for this.

Multiple choice
  1. any element is inserted into the data structure

  2. any element is deleted from the data structure

  3. a data structure is empty and you are trying to delete any element from it

  4. a data structure is full and you are trying to insert any element into it

  5. a data structure is half empty

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

This is the right operation. This condition is called overflow.

Multiple choice
  1. K J I N M L

  2. K J M N L I

  3. M N L K J I

  4. N M K L J I

  5. N M L K I J

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

This is the correct postorder traversal of the binary tree. Here, we first create the tree using preorder and inorder traversal. Then, find out postorder traversal. First select root from the given preorder that is I. Now, select its left subtree nodes and the right subtree nodes from inorder. We continue to apply this process until all nodes are not finished.

Multiple choice
  1. P Q S T R U

  2. P Q R S T U

  3. P Q S R U T

  4. Q S T P R U

  5. P Q S R T U

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This is the correct preorder traversal of the binary tree. Here, we first create the tree using postorder and inorder traversals. Then, find out the preorder traversal. First select root from given postorder that is P, now select its left subtree [LST] nodes and right subtree [RST] nodes from inorder. The LST node of root P is S Q T and RST nodes of P is R U. Now, take S Q T and apply the same process. Here, we get root node Q from postorder [S T Q] and its LST and RST nodes from inoder [S Q T]. Similary, we take R U and apply the same process. Here, we get root node R from postorder [U R] and its LST and RST nodes from inoder [R U].