Documentation of 'smile.sort.PriorityQueue' Java class
PriorityQueue
smile.sort

Class PriorityQueue



  • public class PriorityQueue
    extends java.lang.Object
    Priority Queue for index items.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PriorityQueue(double[] a)
      Constructor.
      PriorityQueue(int d, double[] a)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void change(int k)
      The priority of item k has changed.
      boolean empty()
      Returns true if the queue is empty.
      void insert(int v)
      Insert a new item into queue.
      void lower(int k)
      The value of item k is lower (higher priority) now.
      int poll()
      Removes and returns the index of item with minimum value (highest priority).
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PriorityQueue

        public PriorityQueue(double[] a)
        Constructor. Default use a 3-heap.
        Parameters:
        a - external array of priority. Lower value means higher priority.
      • PriorityQueue

        public PriorityQueue(int d,
                             double[] a)
        Constructor.
        Parameters:
        d - d-heap.
        a - external array of priority. Lower value means higher priority.
    • Method Detail

      • empty

        public boolean empty()
        Returns true if the queue is empty.
      • insert

        public void insert(int v)
        Insert a new item into queue.
        Parameters:
        v - the index of item.
      • poll

        public int poll()
        Removes and returns the index of item with minimum value (highest priority).
      • lower

        public void lower(int k)
        The value of item k is lower (higher priority) now.
      • change

        public void change(int k)
        The priority of item k has changed.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.