Skip to content

Conversation

@StacyLundquist
Copy link

Linked List Comprehension Questions

Question Response
1. What advantages does a LinkedList have over an Array? It is less expensive to add and remove items from the front and middle of the list.
2. When is an Array more advantageous? I'm not sure. When you want to quickly find something at a particular index? When you want to cache an object?
3. What questions do you have about linked lists? I don't know what I don't know yet. It seems fuzzy, but doable.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done Stacy, you hit the learning goals here. Nice work.

Comment on lines +10 to 12
# Time complexity - O(1)
# Space complexity - O(1)
def add_first(data)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +18 to 20
# Time complexity - O(1)
# Space complexity - O(1)
def get_first

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +24 to 26
# Time complexity - O(n)
# Space complexity - O(1)
def length

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +36 to 38
# Time complexity - O(n)
# Space complexity - O(1)
def add_last(data)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +50 to 52
# Time complexity - O(n)
# Space complexity - O(1)
def get_last

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +61 to 63
# Time complexity - O(m), worst case O(n)
# Space complexity - O(1)
def get_at_index(index)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants