Closed i-am-SnehaChauhan closed 2 months ago
This is Heap Sort, so the algorithm remains the same, right? For Heapify, do we need to follow the same process? However, the example I used, {0, 0, 1, 1, 2, 5}, is not matching with what you mentioned. Could you please elaborate on the changes I need to make? I included this sorting example to illustrate that if I take more examples, the same steps should be followed. If you want, I can include some problems related to the priority queue.
I've seen different implementations with the same logic. Yours is exactly same as GFG one, as well as the test case. Speaking of test cases, I've no idea why you would add the below one. This case and code are not even from LC. The numbers are exactly matched with the GFG one.
public static void main(String[] args) {
Solution solution = new Solution();
int[] nums = {12, 11, 13, 5, 6, 7};
System.out.println("Original Array: " + Arrays.toString(nums));
solution.sortArray(nums);
System.out.println("Sorted Array: " + Arrays.toString(nums));
}
I have made changes and removed that example. Could you please explain what other changes you would like me to make? Additionally, may I use problems based on the priority queue?
closing due to inactivity
99
Change Summary
Tutorial Write-up of Heap-Sort. .
Checklist
If you haven't fulfilled the below requirements or even delete the entire checklist, your PR won't be reviewed and will be closed without notice. Regular contributors (with 10+ PRs) can skip this part.
General
Tutorial
solutionLink
blank.Solutions
## Approach 1: Two Pointers
.