File tree Expand file tree Collapse file tree 1 file changed +5
-14
lines changed
src/main/java/com/thealgorithms/searches Expand file tree Collapse file tree 1 file changed +5
-14
lines changed Original file line number Diff line number Diff line change 1010 */
1111public class JumpSearch {
1212
13- /**
14- * Performs jump search on a sorted array.
15- *
16- * @param arr sorted array of integers
17- * @param target the element to find
18- * @return index of target if found, else -1
19- */
13+ // Prevent instantiation
14+ private JumpSearch () {
15+ throw new UnsupportedOperationException ("Utility class" );
16+ }
17+
2018 public static int jumpSearch (int [] arr , int target ) {
2119 int n = arr .length ;
2220 int step = (int ) Math .floor (Math .sqrt (n ));
@@ -36,13 +34,6 @@ public static int jumpSearch(int[] arr, int target) {
3634 return -1 ;
3735 }
3836
39- /**
40- * Wrapper method to support Integer[] for testing purposes.
41- *
42- * @param arr array of Integers
43- * @param target target value
44- * @return index if found, else -1
45- */
4637 public static int find (Integer [] arr , Integer target ) {
4738 int [] array = new int [arr .length ];
4839 for (int i = 0 ; i < arr .length ; i ++) {
You can’t perform that action at this time.
0 commit comments