순차탐색 : 다른버젼 질문입니다.
질문에 코드가 읽기 불편하게 올라가서 ... import java.util.Sacnner; public class linearSearch{ public static void main(String[] args){ int [] arr = {0};int target; System.out.println(“type elements of array”); for(int i =0; i end){ return -1; }else{ middle = (begin+end)/2; if(data[middle] == target){ return middle; } index = search(data, begin, middle-1, target); if(index != -1){ return index; }else{ return search(data, middle+1, end, target); } } } }