• edited by
1,359 views
1 1 vote

Which data structure would be most appropriate to implement a collection of values with the following 3 characteristics

  1. Singly link list with head and tail pointer
  2. Doubly link list with only head pointer
  3. Binary tree
  4. Array

- Items are retrieved and removed from the collection in FIFO order.
- There is no a priori limit on the number of items in the collection.
- The size of an item is large relative to the storage required for a memory address.

1 Answer

1 1 vote

 

Ans – (A) {Given in Key} but (B) is more accurate

  • The third point indicates a spill of data in memory
  • So if there is a spill in last data element, we will have our data in last two memory bytes
  • But we have a tail that points to the last byte only
  • So, in singly link list, to access the last data we would need an extra linear traversal to second last byte ie O(n)
  • Which we could overcome by using a doubly link list

So I think Doubly should be the answer

But provided key says Singly Linked list is better, without any explanation

Position:
Show:

Related questions

53 53 votes
7 answers 7 answers
25.3k
25.3k views
Kathleen asked Oct 9, 2014
25,320 views
Consider the following statements:First-in-first out types of computations are efficiently supported by STACKS.Implementing LISTS on linked lists is more efficient than i...
10 10 votes
2 2 answers
491
491 views
GO Classes asked Jul 27
491 views
Given a stack $S$ with $5$ elements from top to bottom as:$2, 4, 6, 8, 10$and an empty queue $Q$.First, remove the elements one by one from $S$ and insert them into $Q$.T...
8 8 votes
2 2 answers
614
614 views
GO Classes asked Jul 27
614 views
Which of the following statements are true?$\text{S1.}$ Stack operations $\texttt{push}$, $\texttt{pop}$, and $\texttt{isEmpty}$ can be worst-case $O(1)$ for a linked-lis...