home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / diverses / leda / prog / basic / prio_m.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  709 b   |  45 lines

  1. #include  <LEDA/PRIO_M.h>
  2.  
  3. #include <LEDA/rb_tree.h>
  4.  
  5.  
  6. declare2(prio,int,int)
  7.  
  8. declare3(PRIO,int,int,rb_tree)
  9.  
  10.  
  11.  
  12. void TEST(prio(int,int)& P) 
  13. {
  14.   int x;
  15.   while ((cin >> x) && (x > 0)) P.insert(x,x);
  16.  
  17.   pq_item it;
  18.   forall_pq_items(it,P) cout << P.key(it) << " " << P.inf(it) << "\n";
  19.   newline;
  20.  
  21. }
  22.  
  23.  
  24.  
  25. main()
  26. { prio(int,int)         Q;
  27.   PRIO(int,int,rb_tree) R;
  28.  
  29.   pq_item it;
  30.  
  31.   TEST(Q);
  32.   forall_pq_items(it,Q) cout << Q.key(it) << " " << Q.inf(it) << "\n";
  33.   newline;
  34.  
  35.   TEST(R);
  36.   forall_pq_items(it,R) cout << R.key(it) << " " << R.inf(it) << "\n";
  37.   newline;
  38.  
  39.   int x;
  40.   while ((cin >> x) && (x > 0)) R.insert(x,x);
  41.   forall_pq_items(it,R) cout << R.key(it) << " " << R.inf(it) << "\n";
  42.   newline;
  43.  
  44. }
  45.