Java Heap Tutorial

Java Heap TutorialWelcome to my Java Heap Tutorial. In previous tutorials, I covered how to print out trees in Java. You may want to look at that before continuing here, but it isn’t required.

A Heap is kind of like a tree, but it is normally implemented as an array. There are 2 main rules for using a heap. 1. Every row is complete except for last row. 2. Parent keys are bigger then children. I will cover how to insert and remove items. I’ll show how an array is heaped. I’ll also cover how the Heap Sort works. Everything is covered in the video and code below.

If you like videos like this, it helps to tell Google+ with a click here [googleplusone]

Code From the Video

Java Heap Tutorial : Heap2.java

8 thoughts on “Java Heap Tutorial”

    1. Hello Abhishek, Many things can effect the speed of sorting : whether data tends to be partially sorted, the amount of data, whether data tends to be reverse sorted, etc. It is always best to pick your sorting algorithm based on the data. You may also find that it would help to test data dynamically and switch to different sorting algorithms.

    1. Mainly because this is a pretty well structured heap. Pointers would allow you to grow the structure dynamically and flexibly however which would be a plus for many reasons

Leave a Reply

Your email address will not be published. Required fields are marked *