Tino APCS

Lab 17.4 QuadSort

Instructions

  1. Download Sorts.java and SortsStep.java

  2. Rename Sorts.java with your period and name. Ex: P3_Wang_Michael_Sorts.java

  3. Open SortStep.java and change lines 15 and 23 to match the name you chose in the previous step.

  4. Inside your Sorts class, write code for the 3 quadratic sorting algorithms.

    Instead of copying previous sorting code you wrote earlier, challenge yourself to rewrite each sorting algorithm from scratch. If you really know these algorithms, it won't take long. Leave the merge and mergesort methods blank for now. They will be studied in Lesson A18.

  5. Add the appropriate lines of code to count the number of steps for each algorithm.

  6. Run each of the 3 quadratic sorting algorithms to find out how many steps they take to sort 100, 200, 400 and 800 integers.

  7. Record your results in a data table and corresponding graph. You may do this on paper and submit at the beginning of class or submit a digital version to the Schoology assignment.

    • Show your results as a data table
    • Show your results as a graph by plotting the number of integers sorted on the x-axis versus the number of steps required on the y-axis.
100 integers 200 integers 400 integers 800 integers
BubbleSort ___ ___ ___ ___
SelectionSort ___ ___ ___ ___
InsertionSort ___ ___ ___ ___

Submission

  1. Upload only your PX_LastName_FirstName_Sorts.java code below.
  2. Turn in your data table and graph in person or via the Schoology assignment page.

You must Sign In to submit to this assignment

Last modified: January 18, 2023

Back to Lab 17.3 Insertionsort

Dark Mode

Outline