From ee4cf2190c4c3e91380bc27927667e95f3de49e4 Mon Sep 17 00:00:00 2001 From: vishwajeet7200 <43901984+vishwajeet7200@users.noreply.github.com> Date: Thu, 31 Oct 2019 16:00:38 +0530 Subject: [PATCH] Update HeapSort.java minor changes in variables and removed extra variables. --- Sorting/HeapSort.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sorting/HeapSort.java b/Sorting/HeapSort.java index 70c4558..5373c8c 100644 --- a/Sorting/HeapSort.java +++ b/Sorting/HeapSort.java @@ -1,6 +1,6 @@ package sorting; -import java.util.Random; +import java.util.*; public class HeapSort { @@ -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