CSC 310 Lab 4, Spring 2016

Lebanese American University · Algorithms & Data Structures · 2 pages · Dr. Faisal Abu-Khzam

All CSC 310 files
CSC 310 Lab 4, Spring 2016, page 1

Stuck on a question? A tutor can walk you through it.

CSC 310 Lab 4, Spring 2016, page 2

More CSC 310 files

Show the text of this lab
LEBANESE AMERICAN UNIVERSITY School of Arts and Science Department of Computer Science and Mathematics CSC 310: Algorithms and Data Structures Lab IV 12. Feb. 2016 For this lab, you will be implementing multiple sorting algorithms and comparing their execution time. For each problem, generate a list of N random integers and sort them using the specified sorting algorithm. Choose large values for N in order for the runtime comparison to be more accurate. To calculate the execution time of a sorting algorithm, use Java’s System.currentTimeMillis() method. Example: … long startTime = System.currentTimeMillis(); bubbleSort(A); long runtime = System.currentTimeMillis() – startTime(); System.out.println(“Bubble sort: “ + runtime); … Problem 1 Sort the generated list of integers using the efficient bubble sort algorithm. Problem 2 Sort the generated list of integers using the insertion sort algorithm. Problem 3 Sort the generated list of integers using the selection sort algorithm. Problem 4 Sort the generated list of integers using the merge sort algorithm. Problem 5 (Optional) Sort the generated list of integers using your own sorting algorithm. The algorithm can be a combination of multiple known sorting algorithms.