Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
COMP 9024, Assignment 1, 11s2
John Plaice
Thu Aug 4 19:14:51 EST 2011
You are to modify the SortFunctions.java file, make some modifications to it, de-
scribed below, then submit the file using the following command.
give cs9024 assn1 SortFunctions.java
The submission due date is Tuesday, 16 August, 23:59:59.
Task 1
You are to write methods
public void sortMergeDoAL
(ArrayList src,
ArrayList dst,
int start,
int stride,
int end)
{ ... }
public void sortMergeAL(ArrayList ar) { ... }
based on the methods sortMergeDo and sortMerge.
Task 2
You are to write a method
public void compareSorts(int[] ar) { ... }
which will call modified versions of sortBubble, sortInsertion, sortSelection and
sortQuick, and print out, for each, the number of comparisons and swaps made while
sorting ar.
The printouts, on System.out, will be of the form:
1
Bubble sort: 5 comparisons, 5 swaps.
Insertion sort: 5 comparisons, 5 swaps.
Selection sort: 5 comparisons, 5 swaps.
Quick sort: 5 comparisons, 5 swaps.
Do not include comparisons on indices, only comparisons on data.
2