/*
   Author:
   Description:

   Given an array of integers

   Search using linear and binary search algorithms
*/

import java.io.*;
import java.util.*;

public class Search
{
    // returns the position/index if id is in the directory
    // returns -1 if id is not in the directory
    // use the binary search algorithm
    public static int binarySearch(int[] directory, int id)
    {
	int position = -1;
	// start your instructions here









	return position;
    }



    // returns the position/index if id is in the directory
    // returns -1 if id is not in the directory
    // use the linear/sequential search algorithm
    public static int linearSearch(int[] directory, int id)
    {
	int position = -1;
	// start your instructions here





	return position;
    }



    public static void main(String[] argv)
    {
	
	int[] directory = new int[] {5, 14, 16, 22, 31, 33, 44, 55, 66, 77, 88, 99}; 
	System.out.println("---Binary Search---");
	findIDbinary(directory, 88);
	findIDbinary(directory, 11);

	System.out.println("---Linear Search---");
	findIDlinear(directory, 88);
	findIDlinear(directory, 11);

    }

    public static void findIDbinary(int[] directory, int id)
    {
	int idPosition =  binarySearch(directory, id);
	if (idPosition >= 0)
	    System.out.println("ID " + id + " was found at position " + idPosition);
	else
	    System.out.println("ID " + id + " was not found");
    }
	
    public static void findIDlinear(int[] directory, int id)
    {
	int idPosition =  linearSearch(directory, id);
	if (idPosition >= 0)
	    System.out.println("ID " + id + " was found at position " + idPosition);
	else
	    System.out.println("ID " + id + " was not found");
    }

}
