Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The binarySearch method performs a binary search
- on a random access binary file of short values.
- randomAccessFile file pointer to search.
- first - The first element in the search range.
- last - The last element in the search range.
- value - The value to search for.
- Return The subscript of the value if found, otherwise -1.
- */
- // imports
- /**
- *
- * author
- * date
- *
- */
- public class BinaryRecursiveSearch {
- public static long binarySearch(
- RandomAccessFile randomAccessFile, long first, long last,
- short value, int callNumber) throws IOException {
- // Mid point of search
- // Test for the base case where the
- // value is not found.
- // Calculate the middle position.
- // change notation
- // convert from byte poisition to two byte short access
- // go to that position
- // Get that data
- // Search for the value.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement