FOP-2425-Marathon/src/main/java/h06/problems/LinearSearch.java
Oshgnacknak c0e95f092b Squashed 'H06/' content from commit e1db9b6
git-subtree-dir: H06
git-subtree-split: e1db9b6bf635e9b88af6b4e8e2b80beb83b67853
2025-01-11 16:41:02 +01:00

45 lines
1.6 KiB
Java

package h06.problems;
import org.tudalgo.algoutils.student.annotation.StudentImplementationRequired;
import static org.tudalgo.algoutils.student.Student.crash;
public class LinearSearch {
/**
* Recursively searches for a target in an array using linear search.
*
* @param arr the array to search in
* @param target the target to search for
* @return the index of the target in the array, or -1 if the target is not found
*/
@StudentImplementationRequired
public static int linearSearchRecursive(int[] arr, int target) {
return crash(); // TODO: H2.1 - remove if implemented
}
/**
* Recursively searches for a target in an array using linear search.
*
* @param arr the array to search in
* @param target the target to search for
* @param index the index to start searching from
* @return the index of the target in the array, or -1 if the target is not found
*/
@StudentImplementationRequired
public static int linearSearchRecursiveHelper(int[] arr, int target, int index) {
return crash(); // TODO: H2.1 - remove if implemented
}
/**
* Iteratively searches for a target in an array using linear search.
*
* @param arr the array to search in
* @param target the target to search for
* @return the index of the target in the array, or -1 if the target is not found
*/
@StudentImplementationRequired
public static int linearSearchIterative(int[] arr, int target) {
return crash(); // TODO: H2.2 - remove if implemented
}
}