home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pctchnqs / 1991 / number2 / heap.h < prev    next >
C/C++ Source or Header  |  1991-04-02  |  550b  |  25 lines

  1. // ==========================================================
  2. // Listing 1: heap.h
  3. // Header file for Heap class.
  4. // Copyright (C) 1991 by Nicholas Wilt.  All rights reserved.
  5. // ==========================================================
  6.  
  7. #define DEFSIZE 10     // Default heap size
  8.  
  9. class Heap {
  10. private:
  11.   void **elms;
  12.   int n;
  13.   int maxsize;
  14.   int (*comp)(void *, void *);
  15.  
  16.   void SiftUp();
  17.   void SiftDown();
  18.  
  19. public:
  20.   Heap(int (*ComparisonFunction)(void *, void *));
  21.   ~Heap();
  22.   void Insert(void *);
  23.   void *Extract();
  24. };
  25.