Skip to content

Conversation

@dimitrijjedich
Copy link
Collaborator

πŸš€ Not just another binary tree

πŸ—’οΈ General

The heapsort is some sort of binary tree where the root is either the smallest or the largest value on the heap. With this implementation I also removed the use of the structure that defines a binary tree. Instead of nodes and a root the heap will be implemented by using an array that can be intterated by this rules:

arr[(i -1) / 2]; // parent of i node
arr[(2 * i) + 1]; //left child of i node.
arr[(2 * i) + 2]; //right child of i node.

πŸ“πŸ—οΈπŸ“ Operations

The heap is handeled like a basic binary tree and therefor has similar operations:

πŸŒ³πŸ‘€ Peek

Is the simple operation which retrives the root or the first element of the heap array

πŸŒ³β¬…οΈ Insertion

Provided a value, appending it to the end of the heap array and comparing and swapping it with its parent aslong as the first element is not reached or the parent is in the corect order with the new value.

@dimitrijjedich dimitrijjedich self-assigned this Dec 27, 2024
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required β‰₯ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants