Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me write this code in Java 8 . Please make sure that the code meets all the needed requirements mentioned in the question

Please help me write this code in Java 8. 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. Can you also make sure to comment the code? Also, include screenshots of your input and output which should MATCH the ones in the question. The output for MERGE SORT should match the sample output given for MERGE SORT in the question, just as the output for the 2 other sorts should also match. In the question it says to create a Java file for each sorting method, but you can choose to just put them all in 1 file with seperate classes for each sorting method. Just make sure that the output of each sorting method matches the sample output given in the question for that specific sorting method. The user input that will be given to test will be the same for all the methods and is shown in the question below.

I have asked this question three times before, but got a completely wrong answer that didn't meet the requirements so please provide me with the correct answer that does meet all the requirements. I am running out of questions, so please only answer if your outputs match the outputs in the question. Thank You!

image text in transcribedimage text in transcribedimage text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

More Books

Students also viewed these Databases questions