Question:

What is the difference between the array and link list with respect of complexity?

by  |  earlier

0 LIKES UnLike

Comparison between array and link list.

 Tags:

   Report

1 ANSWERS


  1. Linked lists are good for inserting, appending, and deleting elements.  The time complexity for each of those operations is O(1) while it would be O(n) for arrays because you'd have to copy everything to a new array just to make a change.

    Arrays are good for indexing, so looking up a random element takes O(1) time while it takes O(n) in a linked list.  Algorithms that involve accessing elements in the middle of lists, for example binary search, are faster with arrays.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.