Skip to content

The pairing heap is an implementation of the priority queue, the heap is represented in binary form.

License

Notifications You must be signed in to change notification settings

juraj67/Pairing-Heap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pairing-Heap

The pairing heap is an implementation of the priority queue, the heap is represented in binary form.

How to use it

Copy the package "pairing_heap" into your project, import it and create new Pairing_Heap object:

import pairing_heap.*;

Pairing_Heap<Integer> pairing_heap = new Pairing_Heap<>();

Example

import pairing_heap.*;

public class TestClass {
  public static void main(String[] args) {
    Pairing_Heap<Integer> pairing_heap = new Pairing_Heap<>();
    
    //push
    pairing_heap.push(2);
    pairing_heap.push(1);
    pairing_heap.push(3);
    
    //peek 
    System.out.println(pairing_heap.peek()); //prints 1
    
    //pop 
    System.out.println(pairing_heap.pop()); //removes and prints 1
    System.out.println(pairing_heap.pop()); //removes and prints 2
  }
}

Author

Juraj Pavlech, 2019

About

The pairing heap is an implementation of the priority queue, the heap is represented in binary form.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages