Adding an element to the beginning of the list
Answers:
Array: O(n)
Singly Linked List: O(1)
Doubly Linked List: O(1)
Adding an element to the end of the list (what are things to consider for arrays?)
Answers:
Array: O(1) if the array is not full, O(n) if full
Singly Linked List: O(n)
Doubly Linked List: O(1)
Adding an element to the middle of the list
Answers:
Array: O(n)
Singly Linked List: O(n)
Doubly Linked List: O(n)
Deleting an element from the end of the list
Answers:
Array: O(1)
Singly Linked List: O(n)
Doubly Linked List: O(1)
Deleting an element from the middle of the list
Answers:
Array: O(n)
Singly Linked List: O(n)
Doubly Linked List:
Deleting an element from the beginning of the list
Answers:
Array: O(n)
Singly Linked List: O(n)
Doubly Linked List:
Finding an element in the list
Answers:
Array: O(n)
Singly Linked List: O(n)
Doubly Linked List:
Accessing the 5th element of the list (assuming there are at least 5 elements)
Answers:
Array: O(1)
Singly Linked List: O(n)
Doubly Linked List: O(n)
What are some of the disadvantages of arrays?
What are some ideas you have for improving upon these disadvantages?
What are some of the disadvantages of linked lists?
What are some ideas you have for improving upon these disadvantages?