• edited by
897 views
1 1 vote

The best data structures in terms of asymptotic time complexities for performing the following operations respectively are

  • CONCATENATION (A, B): Concatenate all elements of A and B together
  • Insert(T, key): Insert key to T
  • Delete (T, key): Delete key from T if present
  • Search (T, key): Returns true if key is present in T
  1. Stack, Binary Search Tree, Sorted Array, Linked List
  2. Linked List, Stack, Binary Search Tree, Sorted Array
  3. Linked List, Stack, Sorted Array, Binary Search Tree
  4. Stack, Linked List, Sorted Array, Binary Search Tree

1 Answer

2 2 votes
Linked List allows $O(1)$ concatenation.

Stack allows $O(1)$ insertion.

Both Sorted Array and Binary Search Tree allow $O(\log n)$ time search but deletion in a sorted array takes $\Omega(n)$ time in the worst case.

Correct Answer: B
Answer:
Position:
Show:

Related questions

3 3 votes
1 1 answer
999
999 views
GO Classes asked Apr 7, 2023
999 views
The keys $2, 4, 6, 7,$ and $8$ have been inserted, one by one, in some unknown order, into an initially empty BST. The result is this BST:How many permutations of the $2,...
4 4 votes
1 1 answer
1.0k
1.0k views
GO Classes asked Apr 14, 2023
1,023 views
Consider a min heap with $1023$ distinct integers. If root is at $0$th level then fill the blank given in below sentence.The $10$th minimum of the heap might be at ______...
4 4 votes
2 2 answers
1.5k
1.5k views
GO Classes asked Apr 7, 2023
1,548 views
You are given a binary min heap of height $6.$ Let the minimum and maximum number of comparisons we might have to do when doing a delete min respectively are $\text{M}$ a...
4 4 votes
2 2 answers
1.8k
1.8k views
GO Classes asked Mar 26, 2023
1,786 views
Consider a perfect binary tree with $\mathrm{n}$ nodes and $\mathrm{h}$ height. A tree is perfect when all levels of the tree are completely full. Let root is at depth $0...