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

implement jump searcher algorithm. #146

Closed
wants to merge 4 commits into from
Closed

Conversation

@beqakd
Copy link

@beqakd beqakd commented Jun 11, 2020

Implement one of the most public searcher algorithm.
#145

  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have added comments to hard-to-understand areas of my code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the comments
  • I have made corresponding changes to the README.md
@codecov
Copy link

@codecov codecov bot commented Jun 11, 2020

Codecov Report

Merging #146 into master will increase coverage by 2.61%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #146      +/-   ##
==========================================
+ Coverage   90.21%   92.82%   +2.61%     
==========================================
  Files          69       15      -54     
  Lines        3220     1478    -1742     
==========================================
- Hits         2905     1372    -1533     
+ Misses        315      106     -209     
Impacted Files Coverage Δ
Utilities/Extensions/DictionaryExtensions.cs 0.00% <0.00%> (-100.00%) ⬇️
Utilities/Extensions/MatrixExtensions.cs 0.00% <0.00%> (-81.82%) ⬇️
Algorithms/Sorters/Comparison/BubbleSorter.cs
Algorithms/Search/Substring/BoyerMoore.cs
Algorithms/Search/AStar/Node.cs
Algorithms/Strings/NaiveStringSearch.cs
Algorithms/Sorters/Comparison/HeapSorter.cs
Algorithms/Numeric/Series/Maclaurin.cs
Algorithms/Sorters/Comparison/PancakeSorter.cs
Algorithms/Sorters/Comparison/MergeSorter.cs
... and 46 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b340853...07477da. Read the comment docs.

@TheAlgorithms TheAlgorithms deleted a comment from beqakd Jun 11, 2020
@beqakd
Copy link
Author

@beqakd beqakd commented Jun 11, 2020

Can anyone specify what changes should i make? I was not able to understand why merging is blocked

Copy link
Member

@siriak siriak left a comment

Thanks for the search! Merging is blocked because stylecop rules aren't satisfied. Do you use an IDE? There should be warnings about that.

while (val > arr[Math.Min (step, arr.Length) - 1]) {
old = step;
temp = Math.Sqrt (arr.Length);
step += (int) Math.Floor (temp);

This comment has been minimized.

@siriak

siriak Jun 12, 2020
Member

Modifying step is misleading and this variable isn't named correctly. The step should be fixed and the current position should be updated every iteration. Could you refactor this?


while (val > arr[old]) {
old++;
if (old == Math.Min (step, arr.Length)) {

This comment has been minimized.

@siriak

siriak Jun 12, 2020
Member

Same here, try to think of better names for all the variables

/// Time compl is O(root(n))
/// Note: the array has to be sorted beforehand.
/// </summary>
public class JumpSearcher {

This comment has been minimized.

@siriak

siriak Jun 12, 2020
Member

Take a look at https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorithms/Search/BinarySearcher.cs
Could this searcher be implemented to work with IComparable?

This comment has been minimized.

@beqakd

beqakd Jun 12, 2020
Author

Good point. I totally forgot to implement it.

Copy link
Member

@siriak siriak left a comment

I totally forgot, could you add some tests as well? See tests for other searchers for reference

@beqakd
Copy link
Author

@beqakd beqakd commented Jun 12, 2020

Thanks a lot for the review! Will do changes right away.

Copy link
Contributor

@LorenzoLotti LorenzoLotti left a comment

Use the code style of this repository.

Use

block
{
}

instead of

block {
}


Put a blank line under closed blocks. Exemple:

block
{
}

Method();

Copy link
Member

@siriak siriak commented Oct 9, 2020 — with Codacy Production

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- Algorithms/Search/JumpSearcher.cs  6
         

See the complete overview on Codacy

@siriak
Copy link
Member

@siriak siriak commented Oct 13, 2020

Closing because build fails, there are no tests, and code style isn't followed.

@siriak siriak closed this Oct 13, 2020
@siriak siriak mentioned this pull request Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.