Computer Knowledge

Data Structures and Algorithms

1,518 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. 1, 3, 5, 6, 8, 9

  2. 9, 6, 3, 1, 8, 5

  3. 9, 3, 6, 8, 5, 1

  4. 9, 5, 6, 8, 3, 1

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

the all its children

Multiple choice
  1. 10, 7, 9, 8, 3, 1, 5, 2, 6, 4

  2. 10, 9, 8, 7, 6, 5, 4, 3, 2, 1

  3. 10, 9, 4, 5, 7, 6, 8, 2, 1, 3

  4. 10, 8, 6, 9, 7, 2, 3, 4, 1, 5

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

Multiple choice
  1. the number of nodes in the tree

  2. the number of internal nodes in the tree

  3. the number of leaf nodes in the tree

  4. the height of the tree

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

Multiple choice
  1. n + m $\le$ x < 2n and 2m $\le$ y $\le$ n + m
  2. n + m $\le$ x < 2n and 2m $\le$ y $\le$ 2n
  3. 2m $\le$ x < 2n and 2m $\le$ y $\le$ n + m
  4. 2m $\le$ x < 2n and 2m $\le$ y $\le$ 2n
Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The order in which insert and delete operations are performed matters here. The best case: Insert and delete operations are performed alternatively. In every delete operation, 2 pop and 1 push operations are performed. So, total m+ n push (n push for insert() and m push for delete()) operations and 2m pop operations are performed. The worst case: First n elements are inserted and then m elements are deleted. In first delete operation, n + 1 pop operations and n push operation are performed. Other than first, in all delete operations, 1 pop operation is performed. So, total m + n pop operations and 2n push operations are performed (n push for insert() and n push for delete())

Multiple choice
  1. 1,2,3, 4,5, 6, 7

  2. 2,1, 4,3, 6,5, 7

  3. 1,3, 2,5, 4, 7, 6

  4. 2, 3, 4,5, 6, 7,1

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

Multiple choice
  1. queue

  2. stack

  3. tree

  4. list

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

Balanced parenthesis in an equation is such that the no. of opening and closing parenthesis and in correct order should be there. We can check balancing using stack. When we get any opening parenthesis then we push that in the stack & if we get a closing one then we pop the stack. After the complete scanning of input string if stack is found empty then the arithmetic expression is balanced

Multiple choice
  1. n = d1d2......dm−i and rev = dm dm−1......dm−i+1

  2. n = dm−i+1.....dm−1 dm or rev = dm−i .....d2d1

  3. n $\ne$ rev
  4. n = d1d2....dm or rev = dm......d2d1

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

Multiple choice
  1. (top 1= MAXSIZE/2) and (top 2 = MAXSIZE/.2+1)

  2. top 1+ top2=MAXSIZE

  3. (top 1= MAXSIZE/2) or (top2 = MAXSIZE)

  4. top 1= top 2−1

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