Skip to main content
·2 min read

Sort Detective - Solution

Stuck on that homework assignment involving SortDetective.jar? No need to worry ☕ This tutorial is “certifiably” Mac Friendly. Whoop.  Files Provided To You -

Sort Detective - Solution

Stuck on that homework assignment involving SortDetective.jar? No need to worry! ☕

This tutorial is “certifiably” Mac Friendly. Whoop. 

Files Provided To You

  • SortDetective.jar, which looks something like this: 🔍 zoom> The purpose of this little HW assignment is to correctly identify the 6 Greek letters (Alpha, Beta, Gamma, Delta, Epsilon, & Zeta) with their matching sorting method (selection, insertion, bubble, quick, merge, & heap sort).

Step 1 - Download JD-GUI

Head over to the Java Decompiler page located at jd.benow.ca) and download the ZIP file for the JD-GUI. 🔍 zoom

Step 2 - Launch JD-GUI

Now that you’ve downloaded the ZIP file, unzip it and launch the application. 🔍 zoom

Step 3 - Open your SortDetective.jar file using JD-GUI

🔍 zoom

Step 4 - Find the Formula That Determines The Order

SortDetective.jar determines the sorting method ordering according to your student ID.It has an array defined with 5 different orders that the sorting methods CAN be placed in. See Line 256 in the SortDetective.class. 🔍 zoom Zooming in… 🔍 zoom With some minor searches, we find out that the method experimentOrders uses the variable selectedPermutation to determine what array value it will use to determine the order. Sort Detective 7🔍 zoom This redirects us to the setStudentID() method. So now we’ve figured out the ordering all just depends on the formula the program uses. Sort Detective 8🔍 zoom

Step 5 - Apply Formula To experimentOrders

So, in my case, my student ID is 00319124. Using the formula, we can determine that the value of selectedPermutation is going to be 2 for me since 319124 / 10 % 5= 2.4 or simply 2 for int. That means that the array value for experimentOrders will be 2, making a match to the order found on Line 7 when zooming in to Line 256 in SortDetective.class. Remember, arrays are ordered like {0,1,2}. So experimentOrders[2] would be the 3rd value in the array. Sort Detective 9🔍 zoom There we go! Just like that, I now know for sure that the ordering of the Greek letters for me would go

  • Alpha - Quick Sort
  • Beta - Selection Sort
  • Gamma - Merge Sort
  • Delta - Bubble Sort
  • Epsilon - Insertion Sort
  • Zeta - Heap Sort

Good luck with your HW! 😉️


Tags 🏷️

Stay in the loop

🦄 The Unicorn Engineer ✨

Personal and career learnings, advice, collaboration opportunities, and more. Delivered straight to your inbox.

No spam. Unsubscribe anytime.

Keep Reading

Related Posts

Change Your Icons On Yosemite With Scripting
6 min read

Change Your Icons On Yosemite With Scripting

I got tired of Yosemite's icons and decided to take some initiative without the usual dependency on an app. It took about 2 days for me to perfect this strategy

Blog
Alchemize Icon

Alchemize Icon

A circular icon created for Alchemize. Alchemizehttps://alchemizeapp.com/ lets you easily pretty-print or minify your source code. Download the icons folder, iO

Blog
Adding Awesome Websites To Your Chrome App Launcher
4 min read

Adding Awesome Websites To Your Chrome App Launcher

Add all your favorite websites to Chrome's App Launcher. So in your launcherhttps://chrome.google.com/webstore/launcher, you have all these lovely links to usef

Blog

Stay in the Loop ✍🏽

I share thoughts on engineering, career growth, and the tech industry. Follow along for more.