Giter Club home page Giter Club logo

heap's Introduction

Heap(Priority Queue)

Heap Operations

Operations Running Time
DeleteMax/ExtractRoot: O(logn)
Query Top(Max/Min): O(1)
InsertElement: O(logn)
Heapify: O(logn)
Build Heap: O(nlogn)
Find K Ordered Top(Min/Max) Elements: O(klogn)

File's Descriptions:

1) Heap / src / com / heap / Heap.java:
The library importing which you will be able to use all the Heap operations with the above mentioned Running Times

2) Heap / src / com / heap / MaxIntegerComparator.java:
This Comparator can be used if a MaxHeap is needed.

3) Heap / src / com / heap / MinHeapComparator.java:
This Comparator can be used if a MinHeap is needed. The TestHeap.java uses this Comparator to create a MinHeap and performs several Unit Tests.

4) Heap / src / com / heap / Node.java:
The Heap basically contains the Objects of this class. Currently it has only value field, you can have several other instance variables as satellite data of your Node. The Heap will be managed based on the this.value variable.

5) Heap / src / com / heap / StringComparator.java
This Comparator can be used to arrange the Strings lexicographically. The TestHeap.java uses this Comparator to manage a Heap of Strings and also performs several Unit Tests on it.

6) Heap / src / com / heap / TestHeap.java
This class has the main method and creates two Heaps (Min-Heap and String-Heap). It also performs certain unit tests. This can be refered to implement the library.

7) Heap / src / com / heap / UnitTests.java
This class has certain Tests and prints an error if the result is not as desired.

heap's People

Contributors

vishalrajpal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.