GeekInterview.com
Series: Subject: Topic:
Question: 48 of 246

Dynamic Inserting and Deleting

Which data structure is used for inserting and deleting dynamically?
Asked by: sachin007 | Member Since Jun-2008 | Asked on: Dec 3rd, 2009

View all questions by sachin007

Showing Answers 1 - 2 of 2 Answers
PPreksha

Answered On : Dec 15th, 2009

View all answers by PPreksha

Linked lists are best suited for Dynamic insertion and deletion.. as an element can be added at any point in the list with O(1).

Yes  1 User has rated as useful.
  
Login to rate this answer.
stealth

Answered On : Mar 2nd, 2010

View all answers by stealth

Dynamic insertion and deletion works well with Lists (like a doubly linked list)
(also mentioned in the previous answer)

The problem gets incremented this way;

Insertion at a particular location; should be started first with a search for the the right location.
Deletion of a particular element; should similarly be first started off with a search for the entry.
So; if insertion/deletion are specific, the order of the search for the right location and position gets added to the process.
Therefore; if the order of search comes in, the choice of data structure would change.
You could have a linked list or a hash table or a b-tree or a tree.

So if lists, doubly linked list is the best data structure for insertion/deletion? then No! it depends upon the situation and problem at hand.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.