Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39fb013

Browse files
Update shell sort documentation
1 parentb75bfe3 commit39fb013

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

‎Sorts/ShellSort.java‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
publicclassShellSortimplementsSortAlgorithm {
66

77
/**
8-
*This method implements Generic Shell Sort.
8+
*Implements generic shell sort.
99
*
10-
* @param array the array to be sorted
10+
* @param array the array to be sorted.
11+
* @param <T> the type of elements in the array.
12+
* @return the sorted array.
1113
*/
1214
@Override
1315
public <TextendsComparable<T>>T[]sort(T[]array) {
@@ -37,6 +39,10 @@ public static void main(String[] args) {
3739
Integer[]toSort = {4,23,6,78,1,54,231,9,12};
3840

3941
ShellSortsort =newShellSort();
40-
print(sort.sort(toSort));
42+
sort.sort(toSort);
43+
for (inti =0;i <toSort.length -1; ++i) {
44+
asserttoSort[i] <=toSort[i +1];
45+
}
46+
print(toSort);
4147
}
4248
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp