Skip to content
Open
Changes from all 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 deletions Sorting/HeapSort.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sorting;

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

public class HeapSort {

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

private void swap(int[] arr, int index1, int index2) {
int temp = arr[index1];
int t = 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