Java icon indicating copy to clipboard operation
Java copied to clipboard

[FEATURE REQUEST] <Heap Sort Algorithm>

Open Roshnijeewani3457 opened this issue 1 year ago • 8 comments

What would you like to Propose?

I would like to add implementation of Heap sort algorithm under Sorting algorithm category.

Issue details

Implementation of Heap Sort is missing under sorting algorithm category.

Additional Information

I would like to Contribute to it as my first Hacktoberfest Contribution. So can you pls assign it to me.

Roshnijeewani3457 avatar Oct 04 '23 16:10 Roshnijeewani3457

I would like to solve this can i?

kaligone avatar Oct 05 '23 01:10 kaligone

Hello sir, I have the keen background in data structure and algorithm and currently i have solved more than 271 problems on different platforms. I have knowledge in sorting, as heap sort is: Heap sort is indeed a comparison-based sorting algorithm that utilizes the binary heap data structure. The key idea behind heap sort is to build a max-heap (in ascending order) or a min-heap (in descending order) from the given array and then repeatedly extract the maximum (or minimum) element from the heap, placing it in the sorted portion of the array. This process is repeated until the entire array is sorted.

Here's a step-by-step overview of the heap sort algorithm:

  1. Build a heap: The first step is to build a binary heap from the input array. This involves arranging the elements in the array such that they satisfy the heap property (either max-heap or min-heap).

  2. Heapify: Starting from the last non-leaf node of the heap and moving upwards, heapify each subtree. Heapify is a procedure that ensures that the heap property is maintained. In a max-heap, it ensures that the parent node is greater than or equal to its children, and in a min-heap, it ensures the parent node is less than or equal to its children.

  3. Extract elements: Repeatedly remove the root (which is the maximum element in a max-heap or the minimum element in a min-heap) and place it at the end of the array. After each extraction, the size of the heap decreases by one.

  4. Heapify again: After extracting an element, the remaining elements may no longer satisfy the heap property. To restore the heap property, perform heapify on the root node (which was the last element of the heap).

  5. Repeat: Repeat steps 3 and 4 until all elements have been extracted and placed in the sorted order. The array will be sorted in ascending order if a max-heap is used and in descending order if a min-heap is used.

Heap sort has a time complexity of O(n log n) for both its average and worst-case scenarios, making it an efficient sorting algorithm. It is an in-place and stable sorting algorithm, meaning it doesn't require additional memory allocation for sorting, and it preserves the relative order of equal elements in the input array.

For a detailed reference and implementation of the heap sort algorithm, you can refer to authoritative textbooks on algorithms and data structures or online resources on sorting algorithms.

SO PLEASE, ASSIGN ME THIS ISSUE AS THIS WILL BE MY FIRST PR FOR HACKTOBER FEST IT WILL BE MY PLEASURE TO HELP YOU FOR THIS PROBLEM AND ALSO SHOWCASE MY SKILLS. THANK YOU

Yatiraj-upadhyay avatar Oct 05 '23 07:10 Yatiraj-upadhyay

Can you assign me this issue please.

rohit162 avatar Oct 06 '23 18:10 rohit162

Please assign me this issue

hydraveer avatar Oct 07 '23 10:10 hydraveer

Hi I am interested Can You please assign this issue to me ?

srish-03 avatar Oct 15 '23 15:10 srish-03

Hi I want to work on this issue, can you plz assign the issue to me?

WilliamNian avatar Oct 18 '23 05:10 WilliamNian

I would love to to this task will you assign this task to me please.

Mr-mahato avatar Oct 21 '23 09:10 Mr-mahato

What would you like to Propose?

I would like to add implementation of Heap sort algorithm under Sorting algorithm category.

Issue details

Implementation of Heap Sort is missing under sorting algorithm category.

Additional Information

I would like to Contribute to it as my first Hacktoberfest Contribution. So can you pls assign it to me.

ZoreAditya avatar Dec 25 '23 08:12 ZoreAditya

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution!

github-actions[bot] avatar Jan 25 '24 00:01 github-actions[bot]

Please reopen this issue once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution!

github-actions[bot] avatar Feb 02 '24 00:02 github-actions[bot]