$30
▪ Implement Merge sort (MergeSort class, mergeSort and merge methods)
▪ Implement Karatsuba multiplication (MultiplicationAlgorithm class and KMultiply method)
▪ Implement Edit Distance computation (EditDistance class and minDistance method)
▪ The code structure/skeleton is available on Wattle
▪
▪ The last slide contains information about the submission ▪ Read it carefully to avoid losing marks!
Task 1 – Merge Sort
▪ Implement the following methods in the MergeSort.java:
1. Method mergeSort()
This method uses divide-and-conquer to sort an array. It must use merge() method
2. Method merge()
This method merges two sorted subarrays
How to test your code?
Use the MergeSortTest.java file to check whether your implementation passes the test cases or not. It may be used as an indicator that your code is working correctly. Please be aware that we will use additional test cases to verify and assess your code.
What is tracker class?
The tracker.java is used for marking purpose to track divide-and-conquer calls
Task 2 – Karatsuba Multiplication
▪ Implement the following method in the MultiplicationAlgorithm.java: 1. Method KMultiply()
This method uses Karatsuba multiplication to compute the product x times y.
x and y are two n-digit input numbers
How to test your code?
Use the KMultiplyTest.java file to check whether your implementation passes the test cases or not. It may be used as an indicator that your code is working correctly. Please be aware that we will use additional test cases to verify and assess your code.
What is tracker class?
The tracker.java is used for marking purpose to track divide-and-conquer calls
Task 3 – Edit Distance
▪ Implement the following method in the EditDistance.java:
1. Method minDistance()
This method computes the minimal total cost of a sequence of character edits between two strings.
The costs of character edits are defined in EditCost enum.
Do not modify the character edit costs. Otherwise, your answers will not be marked correctly.
How to test your code?
Use the EditDistanceTest.java file to check whether your implementation passes the test cases or not. It may be used as an indicator that your code is working correctly