https://github.com/g3th/binary_heap_type
Determine whether a Binary Heap structure is 'min', 'max' or 'no-heap'.
https://github.com/g3th/binary_heap_type
algorithms binary-heap data-structures kotlin max-heap min-heap
Last synced: 3 months ago
JSON representation
Determine whether a Binary Heap structure is 'min', 'max' or 'no-heap'.
- Host: GitHub
- URL: https://github.com/g3th/binary_heap_type
- Owner: g3th
- Created: 2023-10-17T01:09:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-17T01:29:33.000Z (over 2 years ago)
- Last Synced: 2025-01-15T10:27:10.038Z (about 1 year ago)
- Topics: algorithms, binary-heap, data-structures, kotlin, max-heap, min-heap
- Language: Kotlin
- Homepage:
- Size: 40 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
A binary heap is a type of data structure which can be easily represented in a program in array form, as demonstrated below:

``` [16, 11, 9, 10, 7, 3, 4, 6, 5] ```
In order to compare these elements and determine which heap-type the array is, types being 'max-heap', 'min-heap' or 'no-heap, an algorithm can be written using the formula:
```Element[index] [comparison operator] Element[2 * i + 1] || Element[2 * i + 2]```
checking if ```index * 2 + 1``` is out of bounds with appropriate conditions.
This program will read from a text file which has arrays representing Binary structures, parses them, and determines which type of structure it belongs to. An example text file is already included.