-
-
Notifications
You must be signed in to change notification settings - Fork 28
Add iterative and recursive linear searches #30
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
Conversation
adding "case" to comments
Adding time and space complexity
Support search in types other than int, such as char and string
dlesnoff
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.
Thanks for this new contribution!
I made some style comments. I am going to do a second pass for the algorithm itself tonight.
|
I would copy other the-algorithms repositories and name the repertory searches instead. |
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
|
Nicely done! A few general remarks:
EDIT: Add indentation to the code examples. |
Problem: the item might not be in the array, and @SatinWuker returns -1, so a Natural is not an option. |
You're correct. Seems I was talking about input arguments in general. For this specific function |
Shortening line 38 using type: OptNat = Option[Natural]
dlesnoff
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.
You are almost there.
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
|
Ahhh finally |
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 have double-checked, and the code works 👍
Hope this will be merged so I can move on to other tasks other than searches algorithms lol
dlesnoff
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.
The code looks much better to me. I am about to merge this, but the comments do not reflect the last code changes. The writing style can be improved.
|
Please run |
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
Co-authored-by: dlesnoff <54949944+dlesnoff@users.noreply.github.com>
DIRECTORY.md updated 👌 |
dlesnoff
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.
You nailed it. Solid first contribution that will serve as reference for others.
Thank you so much for helping me from the beginning all the way to the end! This process is just like a linear search hahaha. |
|
Thank you for the contribution and sorry for a bit laborious review process. Nim has an exceptionally high educative potential due to its uncluttered and intuitive syntax, so adhering to strict guidelines within this repository right from the get go can showcase it in a good light and help it stand out in comparison with implementations in other languages. |
I only added one searching algorithm to this directory, linear search, because I just want to make sure that the comments, format, and code style I did are correct and appropriate according to the contribution guidelines. If
linear_search.nimis okay, I will continue working on other searching algorithms. @dlesnoffAnd please review my code, I can't wait to make more contributions haha
Thank you!