Question 6290 – CHENNAI MATHEMATICAL INSTITUTE – M.Sc. / Ph.D. Programme in Computer Science ( 15 May 2014 )
January 9, 2024
Question 2488 – KVS 30-12-2018 Part B
January 10, 2024
Question 6290 – CHENNAI MATHEMATICAL INSTITUTE – M.Sc. / Ph.D. Programme in Computer Science ( 15 May 2014 )
January 9, 2024
Question 2488 – KVS 30-12-2018 Part B
January 10, 2024

Question 9641 – Data-Structures

A data structure is required for storing a set of integers such that each of the following operations can be done in O(log n) time, where n is the number of elements in the set.

    I. Deletion of the smallest element
    II. Insertion of an element if it is not already present in the set

Which of the following data structures can be used for this purpose?

Correct Answer: B

Question 50 Explanation: 
→ In heap deletion takes O(log n).
Insertion of an element takes O(n).
→ In balanced primary tree deletion takes O(log n).
Insertion also takes O(log n).
A
A heap can be used but not a balanced binary search tree
B
A balanced binary search tree can be used but not a heap
C
Both balanced binary search tree and heap can be used
D
Neither balanced binary search tree nor heap can be used

Leave a Reply

Your email address will not be published. Required fields are marked *