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

Water - India #31

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

Water - India #31

wants to merge 3 commits into from

Conversation

indiakato
Copy link

Linked List Comprehension Questions

Question Response
1. What advantages does a LinkedList have over an Array? Linked lists are dynamically located so the size can increase and decrease, where arrays are static and the size cannot change.
2. When is an Array more advantageous? When you want to jump to certain elements, the time complexity is O(1) compared to O(n) with linked lists.
3. What questions do you have about linked lists? I still have questions about doubly linked lists and when we would use those over single ones.

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 India, you hit the learning goals here. Nice work.

@@ -0,0 +1,6 @@
# Default ignored files

Choose a reason for hiding this comment

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

I suggest you add .idea to your .gitignore file.

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 +16 to 18
# 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 +22 to 24
# Time complexity - O(n)
# Space complexity - O(n)
def length

Choose a reason for hiding this comment

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

👍 However the space complexity here is O(1) because it doesn't increase the size of the list at all.

Comment on lines +35 to 37
# Time complexity - O(n)
# Space complexity - O(n)
def add_last(data)

Choose a reason for hiding this comment

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

The space complexity of this one method is O(1).

Comment on lines +51 to 53
# 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 +64 to 66
# Time complexity - 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