Skip to content

Commit 09c4cd7

Browse files
authored
Update FibonacciSearch.java
Add single space after `//`
1 parent 36f9779 commit 09c4cd7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/com/search/FibonacciSearch.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public <T extends Comparable<T>> int findIndex(T[] array, T key) {
3131
int fibN2 = 0; // (n-2)th Fibonacci term
3232
int fibN = fibN1 + fibN2; // nth Fibonacci term
3333

34-
//fibN should store the smallest Fibonacci Number greater than or equal to size
34+
// fibN should store the smallest Fibonacci Number greater than or equal to size
3535
while (fibN < size) {
3636
fibN2 = fibN1;
3737
fibN1 = fibN;
@@ -45,20 +45,20 @@ public <T extends Comparable<T>> int findIndex(T[] array, T key) {
4545
// Check if fibN2 is a valid location
4646
int i = min(offset + fibN2, size - 1);
4747

48-
//If key is greater than the value at index fibN2, cuts the sub-array from offset to i
48+
// If key is greater than the value at index fibN2, cuts the sub-array from offset to i
4949
if (array[i].compareTo(key) < 0) {
5050
fibN = fibN1;
5151
fibN1 = fibN2;
5252
fibN2 = fibN - fibN1;
5353
offset = i;
5454
}
5555

56-
//If x is greater than the value at index fibN2, cuts the sub-array after i+1
56+
// If x is greater than the value at index fibN2, cuts the sub-array after i+1
5757
else if (array[i].compareTo(key) > 0) {
5858
fibN = fibN2;
5959
fibN1 = fibN1 - fibN2;
6060
fibN2 = fibN - fibN1;
61-
} else return i; //Element found
61+
} else return i; // Element found
6262
}
6363
// comparing the last element with key
6464
if (fibN1 == 1 && array[offset + 1].compareTo(key) == 0)

0 commit comments

Comments
 (0)