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

Update HeapSort.java#2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
vishwajeet7200 wants to merge1 commit intoPengFTang:master
base:master
Choose a base branch
Loading
fromvishwajeet7200:master
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletionsSorting/HeapSort.java
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
package sorting;

import java.util.Random;
import java.util.*;

public class HeapSort {

Expand DownExpand Up@@ -31,20 +31,20 @@ private void sink(int[] arr, int index, int N) {
}

private void swap(int[] arr, int index1, int index2) {
inttemp = arr[index1];
intt = arr[index1];
arr[index1] = arr[index2];
arr[index2] =temp;
arr[index2] =t;
}

public static void main(String[] args) {
HeapSort heap = new HeapSort();

int N = 10;
int[] arr = new int[N];

int[] arr = new int[10];
Random rm = new Random();
System.out.println("Original array: ");
for(int i=0; i<arr.length; i++) {
arr[i] = rm.nextInt(100);
arr[i] = rm.nextInt(50);
System.out.print(arr[i] + " ");
}

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp