-
-
Notifications
You must be signed in to change notification settings - Fork 331
feat: added ternary search #177
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
Arpita23r
commented
Oct 9, 2025
- Implemented Ternary Search algorithm in R for searching elements in sorted arrays.
- Divides the search interval into three parts instead of two (like Binary Search).
- Recursively or iteratively narrows down the range based on value comparisons.
- Added clear variable names and inline comments for readability.
- Handles both found and not found cases gracefully with proper output messages.
- Optimized for numerical arrays and works efficiently on sorted data.
- Stored file under searches/ternary.search.R following project structure conventions.
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.
Pull Request Overview
This PR implements a ternary search algorithm in R for searching elements in sorted arrays. The algorithm divides the search space into three parts instead of two, similar to binary search but with an additional comparison point.
Key changes:
- Added complete ternary search implementation with iterative approach
- Included interactive user input functionality for testing the algorithm
- Provided proper handling of found/not found cases with descriptive output
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Please check comments |
@siriak Issue resolved. Many thanks |
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.