Skip to content

Determine whether a Binary Heap structure is 'min', 'max' or 'no-heap'.

Notifications You must be signed in to change notification settings

g3th/Binary_Heap_Type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Determine whether a Binary Heap structure is 'min', 'max' or 'no-heap'.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages