Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leah - Water #49

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Leah - Water #49

wants to merge 2 commits into from

Conversation

scottzec
Copy link

Linked List Comprehension Questions

Question Response
1. What advantages does a LinkedList have over an Array? Easier to add or delete elements at beginning or end of list. Better to insert an element in the middle of a LL using .next instead of iterating through entire array. Useful if not sure of array space limitations, because expensive to transfer an array's data to a bigger data structure--LL is more fluid bc its memory is not allocated in advance like an array's.
2. When is an Array more advantageous? You can easily jump to an element anywhere in the array, incl. the middle, with O(1) time.
3. What questions do you have about linked lists? I still don't understand the code for deleting a node from a doubly-linked list. What do "current.previous.next" and "current.next.previous" mean in practice? I would have thought the code looks different. For instance, for setting the previous node's to point to current's next node, why is the code "current.previous.next = current.next" ? Why the .next on the end of current.previous?

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.

1 participant