Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the dataset and complete the given sorting problems : https://archive.ics.uc

ID: 3776892 • Letter: U

Question

Use the dataset and complete the given sorting problems : https://archive.ics.uci.edu/ml/datasets/Poker+Hand ; Place the whole dataset in a TreeSet, but first implement the Comparable interface, which will compare the poker hands according to their class. By using an iterator, iterate through and print every poker hand of class 7, 8 or 9. Again, we have to sort the dataset according to its class. If you look at the dataset, you can conclude that there are a few unique values, only numbers from 0 to 9 are used. Pick the best algorithm out of the three most basic ones (selection, bubble and insertion sorts), implement it and use it on the dataset.

Explanation / Answer

consider the dataset as {5,3,6,7,2,1,8,9,0}

using bubble sort the above dataset can be sorted as follows

in my view the best algoritm is bubble sort,its makes it very simple to implement but the time complexity is high

algoritm:

We assume list is an array of n elements. We further assume that swap function swaps the values of the given array elements.

according to algorith the above dataset is sorted as follows

first iteration1:

second iteration 2:

at last nth iteration it sorted as follows

thank you

5 3 6 7 2 1 8 9 0 3 5 6 7 2 1 8 9 0 3 5 6 7 2 1 8 9 0 3 5 6 7 2 1 8 9 0 3 5 6 2 7 1 8 9 0 3 5 6 2 1 7 8 9 0 3 5 6 2 1 7 8 0 9
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote