-
Notifications
You must be signed in to change notification settings - Fork 53
Finished the assignment #49
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
base: master
Are you sure you want to change the base?
Conversation
…ind_smallest, reverse and binary_search.
CheezItMan
left a comment
There was a problem hiding this 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"?> | |||
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| end | |
| end |
| # 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| # 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| # 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| # Time complexity: Linear or O(n) | ||
| # Space complexity: Constant or O(1) | ||
| def find_largest(array, length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| # Time complexity: Linear or O(n) | ||
| # Space complexity: Constant or O(1) | ||
| def reverse(array, length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| # Space complexity: Constant of O(1) - two variables are created and are used throughout the function | ||
| def find_smallest(array, length) | ||
| raise NotImplementedError | ||
| min = 0 |
There was a problem hiding this comment.
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.
| min = 0 | |
| min = array[0] |
| # 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.