1.1 --- a/src/work/bin_heap_demo.cc Tue Jan 27 19:17:46 2004 +0000
1.2 +++ b/src/work/bin_heap_demo.cc Tue Jan 27 21:23:33 2004 +0000
1.3 @@ -8,6 +8,11 @@
1.4
1.5 class string_int_map;
1.6
1.7 +// Egy binaris kupac, ami stringekhez rendelt double ertekeket tarol,
1.8 +// azaz mindig az a string van a tetejen, amihez a legkisebb szam tartozik.
1.9 +// A kupac egy string_int_map tipusu property_map segitsegevel tarolja
1.10 +// a stringek aktualis helyet sajatmagan belul.
1.11 +// Egy olyan stringhez, ami meg nincsen a kupac -1 -et kell rendelnunk.
1.12 typedef BinHeap<string, double, string_int_map> StrDoubleHeap;
1.13
1.14 class string_int_map : public map<string,int> {
1.15 @@ -78,6 +83,19 @@
1.16 cout << "heap.topValue() = "
1.17 << heap.topValue() << endl;
1.18
1.19 + cout << "heap.state(\"szilva\") = "
1.20 + << heap.state("szilva") << endl;
1.21 + cout << "heap.put(\"szilva\", 0.5);\n";
1.22 + heap.put("szilva", 0.5);
1.23 + cout << "heap.state(\"szilva\") = "
1.24 + << heap.state("szilva") << endl;
1.25 + cout << "heap.top() = "
1.26 + << heap.top() << endl;
1.27 + cout << "heap.pop();\n";
1.28 + heap.pop();
1.29 + cout << "heap.state(\"szilva\") = "
1.30 + << heap.state("szilva") << endl;
1.31 +
1.32 cout << "heap.size() = "
1.33 << heap.size() << endl;
1.34 cout << "heap.pop();\n";
1.35 @@ -88,4 +106,3 @@
1.36 cout << "heap.empty() = "
1.37 << (heap.empty()?"true":"false") << endl;
1.38 }
1.39 -