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

Jou-Jou's Restricted Arrays #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jjousun
Copy link

@jjousun jjousun commented Aug 20, 2017

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 length method? Provide justification. O(n). This method must iterate through the array once.
What is the space complexity of the length method? Provide justification. O(1). Only one variable is created, which doesn't change if input grows.
What is the time complexity of the print_array method? Provide justification. O(n). This method must iterate through the array once.
What is the space complexity of the print_array method? Provide justification. O(1). Only one variable is created, which doesn't change if input grows.
What is the time complexity of the reverse method? Provide justification. O(n). This method must iterate through the array once, visiting each element.
What is the space complexity of the reverse method? Provide justification. O(1). The variables created do not grow if the input grows.
What is the time complexity of the search method? Provide justification. O(n). This method must iterate through the array once.
What is the space complexity of the search method? Provide justification. O(1). The additional storage doesn't change if size of input changes.
What is the time complexity of the delete method? Provide justification. O(n). Each element is visited once.
What is the space complexity of the delete method? Provide justification. O(1). Variables created for additional storage do not change if input size changes.
What is the time complexity of the empty method? Provide justification. O(n). Each element is visited once in an iteration.
What is the space complexity of the empty method? Provide justification. O(1). Any additional storage is independent of input size.
What is the time complexity of the find_largest method? Provide justification. O(n). Each element is visited once.
What is the space complexity of the find_largest method? Provide justification. O(1). Variables created for additional storage do not change if input size changes.
What is the time complexity of the insert_ascending method? Provide justification. O(n). Each element is visited once.
What is the space complexity of the insert_ascending method? Provide justification. O(1). Variables created for additional storage do not change if input size changes.

@shrutivanw
Copy link
Collaborator

Nicely done! 👍

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