Segment Trees and Binary Indexed Trees Quiz CIP

Last Updated :
Discuss
Comments

Question 1

What is the time complexity of building a segment tree?

  • A

    O( n^2 )

  • B

    O( n )

  • C

    O(n log n)

  • D

    O( log n )

Question 2

What is the time complexity of querying a range in a segment tree?

  • A

    O(1) 

  • B

    O(log n) 

  • C

    O(n log n)

  • D

    O(n) 

Question 3

Which of the following operations can be performed on a segment tree?

  • A

    Minimum value in a range 

  • B

    Maximum value in a range

  • C

    Sum of values in a range

  • D

    All of the above

Question 4

What is the maximum number of nodes in a segment tree of size n?

  • A

    n

  • B

    n^2

  • C

    n^3

  • D

    n log n

Question 5

Which data structure is used to store a binary indexed tree?

  • A

    Array

  • B

    Linked List

  • C

    Heap

  • D

    Stack

Question 6

What is the space complexity of a binary indexed tree?

  • A

    O( n^2 )

  • B

    O( n log n )

  • C

    O( n )

  • D

    None of these

Question 7

What is the time complexity of updating a single element in a binary indexed tree?

  • A

    O(1)

  • B

    O( n )

  • C

    O( n log n )

  • D

    O( log n )

Question 8

Is a binary indexed tree a balanced tree structure? 

  • A

    Yes

  • B

    No

  • C

    It depends upon the implementation

  • D

    None of the above

Question 9

Which of the following operations can be performed on a binary indexed tree?

  • A

    Minimum value in a range

  • B

    Maximum value in a range

  • C

    Sum of values in a range

  • D

    All of the above

Question 10

What is the time complexity of querying a range in a binary indexed tree?

  • A

    O(1)

  • B

    O(log n)

  • C

    O(n log n)

  • D

    O(n)

There are 10 questions to complete.

Take a part in the ongoing discussion