Package nz.ac.waikato.jdsl.core.ref

Examples of nz.ac.waikato.jdsl.core.ref.ArrayHeap$AHLocator


   * queue.  If necessary, it can be preinitialized, although you
   * will need to accommodate that fact in other methods.
   * @return PriorityQueue to be used by the algorithm
   */
  protected PriorityQueue newPQ () {
    return new ArrayHeap(new IntegerComparator());
  }
View Full Code Here


* @version JDSL 2.1.1
*/
public class HeapSort implements SortObject {
 
  public void sort (Sequence s, Comparator c) {
    PriorityQueue pq = new ArrayHeap(c,s.size()+1,false);

    PositionIterator pi = s.positions();
    while (pi.hasNext()) {
      Object elt = pi.nextPosition().element();
      pq.insert(elt,elt);
    }

    pi.reset();
    while (!pq.isEmpty())
      s.replaceElement(pi.nextPosition(),pq.removeMin());
  }
View Full Code Here

TOP

Related Classes of nz.ac.waikato.jdsl.core.ref.ArrayHeap$AHLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.