-
-
Notifications
You must be signed in to change notification settings - Fork 156
Solved issue #2077- Interpolation-Search.md #2078
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
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.
Great job, @Aditi22Bansal! 🎉 Thank you for submitting your pull request to CodeHarborHub. We appreciate your contribution and enthusiasm! Our team will review it soon. If you have any questions or need further assistance, feel free to reach out. Thanks for contributing!
@ajay-dhangar |
Here's the code health analysis summary for commits Analysis Summary
|
@ajay-dhangar I want to work on another issue |
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.
Update code based on suggestions
1. Initialize the low and high indices to 0 and N-1, respectively. | ||
2. While the target value is within the range defined by the current low and high indices: | ||
- Calculate the probe position using the formula: | ||
\[ |
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.
Replace
\[
\text{pos} = \text{low} + \left( \frac{(x - \text{arr}[low]) \times (\text{high} - \text{low})}{\text{arr}[high] - \text{arr}[low]} \right)
\]
to
$$
\text{pos} = \text{low} + \left( \frac{(x - \text{arr}[low]) \times (\text{high} - \text{low})}{\text{arr}[high] - \text{arr}[low]} \right)
$$
@ajay-dhangar |
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.
Done
Related Issue
Fix #2077
[Cite any related issue(s) this pull request addresses. If none, simply state "None”]
Description
Interpolation Search is an improved variant of Binary Search that works on the principle of probing the position of the required value. The probing position is calculated using a formula that assumes the elements are uniformly distributed.
[Please include a brief description of the changes or features added]
Type of PR
Screenshots / Videos (if applicable)
[Attach any relevant screenshots or videos demonstrating the changes]
Checklist
Additional Context
[Include any additional information or context that might be helpful for reviewers.]
Resources for Guidance
Please read the following resources before submitting your contribution:
Resources for DSA Features on Our Site:
Contribution Guidelines
Thank you for considering contributing to our project! To ensure smooth collaboration and effective contribution management, please adhere to the following guidelines:
Issue Creation
Contribution Levels
Basic Contributions:
Acknowledging Hard Work:
Feature Additions and Component Work:
Level Definitions
We look forward to your contributions and appreciate your effort in helping us improve the project!