top of page

Implement MergeSort and BinarySearch

Updated: Mar 23, 2021

Goals for this Lab

  • Implement MergeSort.

  • Implement iterative BinarySearch.

  • Implement recursive BinarySearch.

Task Description

Your goal for this lab is to write three functions; mergeSort, which implements MergeSort as dicussed in class, and {iterative, recursive} binarySearch, which implements BinarySearch as dicussed in class. You will implement these as static functions inside of a class named Functions so that they can be called from another file.


Methods

For this lab we will be assuming that our data is an array of integers.

  • public static int[] mergeSort(int[] data): Accepts an integer array as input and sorts it.

  • public static int[] BinarySearch(int[] data, int key): Accepts an integer array and a key to search for and returns the index of the key if it exists in the array, otherwise it returns -1.

  • public static int BinarySearch(int[] data, int key): Accepts an integer array and a key to search for and returns the index of the key if it exists in the array, otherwise it returns -1.


Requirements

  • Your class must be named Functions.

  • Your class must provide the methods listed above.

  • You only need to turn in Functions.java.


Testing

This lab will be manually tested. Make sure to test all cases.


Notes

During development of this lab you will have two files. The first is your main program file which will call your functions. An example of this is below;


Please contact us for solution and help of this type of Java Assignment help, java Project help

Contact us for Hire Java developers, Java programming help, Java Coding work, Java Expert for your Project, Java Homework Help, Java Course work Help, Java Tutor,  and for your business work.
If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion  you can send mail at codersarts@gmail.com.


bottom of page