Sale!

Solved Assignment 3 CSC300 Part 1: Write a Java test program to experimentally compare the performance of the sorting algorithms

$30.00 $18.00

Original Work ?

Download Details:

  • Name: AssignmentThree-ajlinn.zip
  • Type: zip
  • Size: 208.52 KB

Category: Tags: , You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (1 vote)

Part 1:
Write a Java test program to experimentally compare the performance of the sorting algorithms discussed in class, namely selection sort, bubble sort, and insertion sort. Use the random method from the Math class to generate 5000 integers, and then store these generated numbers in an array. Sort the elements in the array using the sorting algorithms, and for each execution, record the time it takes to sort the numbers. Measure the execution time of each operation using the System.currentTimeMillis() method.

SYNOPSISpublic static long currentTimeMillis()

DESCRIPTION: Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.[1]

Returns:
Reference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.[1]

Example:
long start = System.currentTimeMillis(); // recording the time before the loop is executed
for(long j=0;j<10000000000;j++);
long end=System.currentTimeMillis(); // recording the time after the loop is executed.
System.out.println(“Execution time: “+(end-start) + ” ms”);

Part 2: Analyzing sorting algorithm performance and data patterns

Did you investigate whether the sorting algorithms’ performance is influenced by the distribution or characteristics of the input data (e.g., uniform random, nearly sorted, reversed, etc.)? If so, share your observations regarding how different data patterns may impact the efficiency of the sorting algorithms and discuss the implications of these findings for real-world data scenarios. Please be sure to support your observations by concrete examples from the code you implemented.

Part 3: Upload the following to the assignment Dropbox:
1. Your Java code
2. A PDF file that includes your observations with examples.

Notes:
1. The program must compile without syntax errors; 50% of the assignment points will be deducted if your program does not compile, even if your program is “essentially” correct.
2. To get full credit for an assignment, your program must solve the assignment problem completely.
3. Please add comments to the source code. Your program should have a reasonable amount of comments.
4. At the very beginning of each file, there should be a block comment containing the student name, course number, and assignment number.
5. Follow the programming styles and guidelines discussed in class, such as using meaningful names for variables and camel case conventions for variables, classes, etc.
6. Using ChatGPT or any LLM is not allowed. Your code will be examined if written using an AI tool.
7. You are permitted to copy the sorting algorithms (selection sort, bubble sort, and insertion sort) from the textbook. However, you must cite the author’s work. Here I am writing the Chicago style citation for the comic textbooks: Lafore, Robert. Data structures and algorithms in Java. Sams publishing, 2017.