Question
Please help me write this code in Java 8 . I already have some of it done, but I need help with writing the code
Please help me write this code in Java 8. I already have some of it done, but I need help with writing the code for sorting using merge, quick, and heap sort. What I have now for quick sort gives me a wrong output, can you please make sure that the solution you provide gets the correct sample outputs after inputting the sample input given in the question for each of the three sorting methods. This is what I have done so far: pastebin [dot] com/qx5d66G0
Please make sure that the code meets all the needed requirements mentioned in the question under each part such as in INPUT FORMAT, OUTPUT FORMAT, AND CONSTRAINTS. Please include screenshots of your input and output, which should match the ones in the question. Thank You!
You'll be given a list of students, and you'll need to sort it using merge sort, heap sort, and quick sort. We want to sort the students according to graduation year (soonest first), and for students with the same graduation year, alphabetically by first name (and if there are any students with the same first name and graduation year, ties should be broken by last name). However, rather than just printing the final sorted list: for merge sort you'lI print the partially sorted list after each call to merge, for quick sort you'll print the partially sorted list after each call to partition, and for heap sort you'l print the list after it has been converted to a heap and the partially sorted list after each call to extractMax. You will have 3 files named: MergeSort.java, HeapSort.java, and QuickSort.java. Constraints You can assume n is a non-negative integer. You can further assume the list contains no students with the same first name, last name, and graduation year. For merge sort when splitting your array, if it has odd size, make the left half larger than the right half. For quick sort when choosing your pivot, if the array has even size, choose the left of the two middle elements Input Format The first line of the input consists of an integer, n, indicating the number of words you'll need to sort. The next n lines will each consist of student data with space separated first name, last name, and graduation year, in that order. The input will terminate with a blank line Output Format You will be printing the partially sorted list: for merge sort as many times as merge is called (the last time will be entirely sorted), for quick sort you will be printing the partially sorted list as many times as partition is called (the last time will be entirely sorted), and for heap sort you will be printing the partially sorted list after it has been heapified and again after every call to extractMax (the last time will be entirely sorted). Each student should appear on a new line without terminating whitespace, space separated in the same format it was provided in the input, and each partially sorted list should be followed by a blank line to indicate where it ends and the next one begins
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started