Which data structure has the fastest insertion procedure


Which data structure has the fastest insertion procedure?
A) Binary search tree
B) Ordered array
C) Heap
D) Unordered linked list
E) Ordered linked list

Ravi Garg edited question
    Abhijit Gautam Choudhary (anonymous)

    the answer should be either D or E…. I mean, no matter whether the linked list is ordered or un-ordered.. the insertion is going to take same time in both cases.. BST and Heap can not be the answer and, for Ordered array, insertion will be easiest among all, but then shifting of elements will take time.. So, Linked list (D or E)..

    Abhijit Gautam Choudhary answered
      Satyajit Bhadange (anonymous)

      Complexity of A can be O(n) if skew tree
      Complexity of B will be O(n)
      Complexity of Heap O(log n)
      Complexity of D O(1)
      Complexity of E O(n)

      Satyajit Bhadange answered
        Anupriya Anu (anonymous)

        its a

        Anupriya Anu answered
          Satyajit Bhadange (anonymous)

          A cant be the answer…on an average insertion in binary tree takes log n time…and in worst case it will take n comparisons….Correct ans is D as in unordered list element can be inserted anywhere…even at the start of the list…so it will take constant time to insert…

          Satyajit Bhadange answered
            Vaibhav Srivastava (anonymous)

            Satyajit.. its a) .. it is binary search tree not binary tree

            Vaibhav Srivastava answered
              Add image to editor add image from link

              Question stats

              • Active
              • Views1263 times
              • Answers8 answers
              • Followers1 follower
              Question and answer is powered by AnsPress