HomeVirtual University

Which Data Structure is best for Stores Heap Linked List or Binary Search Tree

Which Data Structure is best for Stores Heap Linked List or Binary Search Tree
Like Tweet Pin it Share Share Email

Suppose you have to build a software for a company. The software should have the capability to store, retrieve, update and delete information about its customers.

A large number of customers visit the company’s store every day and get registered. The date and the time of registration should be recorded automatically for customers at the time of their registration. Their information can be added (as they register), searched (if needed for any purpose), updated (if any change in their status) and removed (if they quit their registration) from the system. The system should have capability to traverse the customers’ records on the basis of the dates and times when they were added into the system.

Considering this scenario, which data structure do you think would work the best when fast insertion of a new customer is the key requirement of the system?

Justify your selection of data structures with strong arguments.

You have the following data structures as options to choose from:

  • Linked List:
  • Binary Search Tree
  • Heap


According to my knowledge, linked list best suited data structure for this store. Here are some of the reason;
1. Space Efficiency: We don’t require contiguous memory space. As store has lot of customers, so memory utilizing is good using linked list.
2. Fast Insertion and Deletion: We can add any new customer or update a customer with fast speed. Insertion and deletion takes constant time. It is fast because it needs just allocation/deallocation and a pointer.
3. Dynamic Sizing: Linked list has feature of dynamic sizing. it means that we can increase the memory space any time.
4. Linear Search: Linked list supports linear search that means that you have to look at every member starting from the head. It is somehow disadvantage as compared to arrays but advantages are more than that.
So I prefer linked list data structure.

READ  VU Solved Assignments GDBs and Quizzes Latest Spring Fall 2018/2019

This post has been seen 93 times.