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

Finished the assignment #49

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

Finished the assignment #49

wants to merge 2 commits into from

Conversation

anakp07
Copy link

@anakp07 anakp07 commented Oct 19, 2020

No description provided.

Copy link
Collaborator

@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.

Ana, well done. Take a look at my comment on find_smallest and let me know what questions you have there. Thanks for getting this in.

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Collaborator

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.

i += 1
end
return i
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
end
end

Comment on lines +10 to 13
# Time complexity: Linear or O(n) --> it will iterate over each of the elements inside array. As the input grows, the greater the amount of time it takes to perform the function.
# Space complexity: Constant of O(1) --> we only create one new variable and it doesnt depend on the size of the array.

def length(array)
Copy link
Collaborator

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: Linear or O(n) --> it will iterate over each of the elements inside array. As the input grows, the greater the amount of time it takes to perform the function.
# Space complexity: Constant of O(1) -> only one variable is created and its used throughout the entire function.
def print_array(array)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +35 to 37
# Time complexity: Linear or O(n) --> it will need to iterate over all elements in worse case, which means it will grow through each iteration.
# Space complexity: Constant or O(1)
def search(array, length, value_to_find)
Copy link
Collaborator

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: Linear or O(n)
# Space complexity: Constant or O(1)
def find_largest(array, length)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +81 to 83
# Time complexity: Linear or O(n)
# Space complexity: Constant or O(1)
def reverse(array, length)
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

def find_smallest(array, length)
raise NotImplementedError
min = 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the array has positive numbers starting min at 0, will cause these to fail.

Suggested change
min = 0
min = array[0]

Comment on lines +96 to 98
# Time complexity: Logarithmic or O(log n) - I remembered from lessons that binary search is 0(log n)
# Space complexity: Constant or O(1)?
def binary_search(array, length, value_to_find)
Copy link
Collaborator

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