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 10
10
*/
11
11
public class JumpSearch {
12
12
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
+
20
18
public static int jumpSearch (int [] arr , int target ) {
21
19
int n = arr .length ;
22
20
int step = (int ) Math .floor (Math .sqrt (n ));
@@ -36,13 +34,6 @@ public static int jumpSearch(int[] arr, int target) {
36
34
return -1 ;
37
35
}
38
36
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
- */
46
37
public static int find (Integer [] arr , Integer target ) {
47
38
int [] array = new int [arr .length ];
48
39
for (int i = 0 ; i < arr .length ; i ++) {
You can’t perform that action at this time.
0 commit comments