docs: update the whole repository

* fix some bugs
* delete duplicate files
* format code
This commit is contained in:
yanglbme
2019-05-09 19:32:54 +08:00
parent 163db8521a
commit 29948363da
368 changed files with 4372 additions and 30841 deletions

View File

@ -11,7 +11,7 @@ import static java.lang.String.format;
* This class represents iterative version {@link BinarySearch}
* Iterative binary search is likely to have lower constant factors because it doesn't involve the overhead of manipulating the call stack.
* But in java the recursive version can be optimized by the compiler to this version.
*
* <p>
* Worst-case performance O(log n)
* Best-case performance O(1)
* Average performance O(log n)
@ -19,24 +19,21 @@ import static java.lang.String.format;
*
* @author Gabriele La Greca : https://github.com/thegabriele97
* @author Podshivalov Nikita (https://github.com/nikitap492)
*
* @see SearchAlgorithm
* @see BinarySearch
*
*/
public final class IterativeBinarySearch implements SearchAlgorithm {
/**
* This method implements an iterative version of binary search algorithm
*
*
* @param array a sorted array
* @param key the key to search in array
*
* @param key the key to search in array
* @return the index of key in the array or -1 if not found
*/
@Override
public <T extends Comparable<T>> int find(T[] array, T key) {
public <T extends Comparable<T>> int find(T[] array, T key) {
int l, r, k, cmp;
l = 0;