Remove unnecessary code (#4141)

This commit is contained in:
Saurabh Rahate
2023-04-03 20:05:59 +05:30
committed by GitHub
parent 805f09850c
commit ad72c28d91
64 changed files with 125 additions and 322 deletions

View File

@ -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);
}
}