Question: Instructions: All algorithms must be implemented with Java generics. To show that your code works, create a public Circle class. Then pass a Comparator object
Instructions:
All algorithms must be implemented with Java generics.
To show that your code works, create a public Circle class. Then pass a Comparator object created for that Circle class to your algorithm (Hint: Take a look at the Binary Search code). Run your code against the following array of circles and print the sorted array to show that your algorithm indeed works (Make sure to implement toString in Circle class). Circle[] a = {new Circle(5), new Circle(1), new Circle(3), new Circle(4), new Circle(2)}
Question 1 (20 points): Write Java code for bubble sort algorithm (pick the good one out of the two algorithms we learned in the class).
Question 2 (20 points): Write Java code for selection sort algorithm.
Question 3 (20 points): Write Java code for insertion sort algorithm.
Question 4 (20 points): Write Java code for merge sort algorithm.
Question 5 (20 points): Write Java code for quicksort algorithm. Pick the pivot randomly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
