mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 00:54:32 +08:00
Remove unnecessary code (#4141)
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
package com.thealgorithms.searches;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import com.thealgorithms.devutils.searches.SearchAlgorithm;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
@ -89,23 +87,15 @@ public class TernarySearch implements SearchAlgorithm {
|
||||
TernarySearch search = new TernarySearch();
|
||||
int atIndex = search.find(integers, shouldBeFound);
|
||||
|
||||
System.out.println(
|
||||
format(
|
||||
"Should be found: %d. Found %d at index %d. An array length %d",
|
||||
System.out.printf(
|
||||
"Should be found: %d. Found %d at index %d. An array length %d%n",
|
||||
shouldBeFound,
|
||||
integers[atIndex],
|
||||
atIndex,
|
||||
size
|
||||
)
|
||||
);
|
||||
|
||||
int toCheck = Arrays.binarySearch(integers, shouldBeFound);
|
||||
System.out.println(
|
||||
format(
|
||||
"Found by system method at an index: %d. Is equal: %b",
|
||||
toCheck,
|
||||
toCheck == atIndex
|
||||
)
|
||||
);
|
||||
System.out.printf("Found by system method at an index: %d. Is equal: %b%n", toCheck, toCheck == atIndex);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user