Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit09c4cd7

Browse files
authored
Update FibonacciSearch.java
Add single space after `//`
1 parent36f9779 commit09c4cd7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public <T extends Comparable<T>> int findIndex(T[] array, T key) {
3131
intfibN2 =0;// (n-2)th Fibonacci term
3232
intfibN =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
inti =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
elseif (array[i].compareTo(key) >0) {
5858
fibN =fibN2;
5959
fibN1 =fibN1 -fibN2;
6060
fibN2 =fibN -fibN1;
61-
}elsereturni;//Element found
61+
}elsereturni;//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)

[8]ページ先頭

©2009-2025 Movatter.jp