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

Danielle Birbal - Linked List #2

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

Conversation

birbalds
Copy link

Restricted Array

Congratulations! You're submitting your assignment.

Comprehension Questions

What is the time and space complexity for each method you implemented? Provide justification.

Question Answer
What is the time complexity of the insert method? Provide justification. Constant because only the first element is ever touched
What is the space complexity of the insert method? Provide justification. Constant because only variables are used
What is the time complexity of the search method? Provide justification. O(n) because every element is visited once
What is the space complexity of the search method? Provide justification. Constant because only variables were used
What is the time complexity of the find_max method? Provide justification. O(n) because very element is visited once
What is the space complexity of the find_max method? Provide justification. Constant because only variables are used
What is the time complexity of the find_min method? Provide justification. O(n) because very element is visited once
What is the space complexity of the find_min method? Provide justification. Constant because only variables are used
What is the time complexity of the length method? Provide justification. O(n) because very element is visited once
What is the space complexity of the length method? Provide justification. Constant because only variables are use
What is the time complexity of the find_nth_from_beginning method? Provide justification. O(n) because you may have to reach every element
What is the space complexity of the find_nth_from_beginning method? Provide justification. Constant because only variables were used
What is the time complexity of the insert_ascending method? Provide justification. O(n) because every element may possibly needs to be visited
What is the space complexity of the insert_ascending method? Provide justification. Constant because only variables are used
What is the time complexity of the visit method? Provide justification. O(n) every element is visited
What is the space complexity of the visit method? Provide justification. Constant, only variables are used
What is the time complexity of the delete method? Provide justification. O(n), every element is visited
What is the space complexity of the delete method? Provide justification. Constant, only variables are used
What is the time complexity of the reverse method? Provide justification. O(n), every element is visited
What is the space complexity of the reverse method? Provide justification. Constant, only variables were used
What is the time complexity of the find_middle_value method? Provide justification. O(n) every element is visited at least once, at most twice.
What is the space complexity of the find_middle_value method? Provide justification. Constant, only variables are used
What is the time complexity of the find_nth_from_end method? Provide justification. O(n), every element is visited once
What is the space complexity of the find_nth_from_end method? Provide justification. Constant, only variables were used
What is the time complexity of the has_cycle method? Provide justification. O(n) Every element is visited at least once
What is the space complexity of the has_cycle method? Provide justification. Constant, only variables are used

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