src/work/bin_heap_demo.cc
changeset 286 d3c4d99860a9
parent 258 94bafec4f56f
child 618 e944d741f472
equal deleted inserted replaced
5:9e94383abbf6 6:dab90dbc4fbd
    51   heap.push("alma", 15);
    51   heap.push("alma", 15);
    52 
    52 
    53   cout << "heap.set(\"korte\", 3.4);\n";
    53   cout << "heap.set(\"korte\", 3.4);\n";
    54   heap.set("korte", 3.4);
    54   heap.set("korte", 3.4);
    55 
    55 
    56   cout << "heap.get(\"alma\") = " 
       
    57        << heap.get("alma")
       
    58        << endl;
       
    59   cout << "heap[\"alma\"] = " 
    56   cout << "heap[\"alma\"] = " 
    60        << heap["alma"]
    57        << heap["alma"]
    61        << endl;
    58        << endl;
    62 
    59 
    63   cout << "heap.top() = "
    60   cout << "heap.top() = "
    64        << heap.top() << endl;
    61        << heap.top() << endl;
    65   cout << "heap.topPrio() = "
    62   cout << "heap.prio() = "
    66        << heap.topPrio() << endl;
    63        << heap.prio() << endl;
    67 
    64 
    68   cout << "heap.decrease(\"alma\", 1.2);\n";
    65   cout << "heap.decrease(\"alma\", 1.2);\n";
    69   heap.set("alma", 1.2);
    66   heap.set("alma", 1.2);
    70 
    67 
    71   cout << "heap.top() = "
    68   cout << "heap.top() = "
    72        << heap.top() << endl;
    69        << heap.top() << endl;
    73   cout << "heap.topPrio() = "
    70   cout << "heap.prio() = "
    74        << heap.topPrio() << endl;
    71        << heap.prio() << endl;
    75 
    72 
    76   cout << "heap.set(\"alma\", 22);\n";
    73   cout << "heap.set(\"alma\", 22);\n";
    77   heap.set("alma", 22);
    74   heap.set("alma", 22);
    78 
    75 
    79   cout << "heap.top() = "
    76   cout << "heap.top() = "
    80        << heap.top() << endl;
    77        << heap.top() << endl;
    81   cout << "heap.topPrio() = "
    78   cout << "heap.prio() = "
    82        << heap.topPrio() << endl;
    79        << heap.prio() << endl;
    83 
    80 
    84   cout << "heap.size() = "
    81   cout << "heap.size() = "
    85        << heap.size() << endl;
    82        << heap.size() << endl;
    86   cout << "heap.pop();\n";
    83   cout << "heap.pop();\n";
    87   heap.pop();
    84   heap.pop();
    88 
    85 
    89   cout << "heap.top() = "
    86   cout << "heap.top() = "
    90        << heap.top() << endl;
    87        << heap.top() << endl;
    91   cout << "heap.topPrio() = "
    88   cout << "heap.prio() = "
    92        << heap.topPrio() << endl;
    89        << heap.prio() << endl;
    93 
    90 
    94   cout << "heap.state(\"szilva\") = "
    91   cout << "heap.state(\"szilva\") = "
    95        << heap.state("szilva") << endl;
    92        << heap.state("szilva") << endl;
    96   cout << "heap.set(\"szilva\", 0.5);\n";
    93   cout << "heap.set(\"szilva\", 0.5);\n";
    97   heap.set("szilva", 0.5);
    94   heap.set("szilva", 0.5);