Templates -- Meow
1.1.4
A C++ template which is unable and also not allowed to compile to obj-file first.
|
一個用 左偏樹 實作的 Maximum-Heap
, 除了原本heap有的功能外, 還支援 merge
功能
More...
#include "MergeableHeap.h"
Public Member Functions | |
MergeableHeap () | |
constructor More... | |
MergeableHeap (MergeableHeap const &heap2) | |
constructor, 並且複製資料 More... | |
~MergeableHeap () | |
destructor More... | |
MergeableHeap & | copyFrom (MergeableHeap const &heap2) |
複製資料 More... | |
void | moveTo (MergeableHeap *heap2) |
將自己的資料丟給指定的heap, 從此自己一身空 More... | |
Element const & | top () const |
回傳最大的那個 Element More... | |
size_t | size () const |
回傳資料個數 More... | |
bool | empty () const |
回傳是否為空 More... | |
void | push (Element const &value) |
加入element More... | |
void | pop () |
將最大的element移除 More... | |
void | clear () |
void | merge (MergeableHeap *heap2) |
MergeableHeap & | operator= (MergeableHeap const &heap2) |
same as copyFrom(heap2) More... | |
一個用 左偏樹 實作的 Maximum-Heap
, 除了原本heap有的功能外, 還支援 merge
功能
const? | Typename | Operator | Parameters | Return Type | Description |
---|---|---|---|---|---|
const | Element | operator< | (Element b ) | bool | 大小比較 |
A
和 B
, 則:A.merge(&B)
後 B
會變成空的B.moveTo(&A)
後 B
會變成空的, A
原本擁有的資料也會覆蓋掉Definition at line 30 of file MergeableHeap.h.
|
inline |
constructor
Definition at line 78 of file MergeableHeap.h.
|
inline |
constructor, 並且複製資料
Definition at line 82 of file MergeableHeap.h.
|
inline |
destructor
Definition at line 86 of file MergeableHeap.h.
|
inline |
將資料清空
Definition at line 147 of file MergeableHeap.h.
|
inline |
複製資料
Definition at line 91 of file MergeableHeap.h.
|
inline |
回傳是否為空
Definition at line 123 of file MergeableHeap.h.
|
inline |
將給定的MergeableHeap的資料統統加到自己身上並且清空該heap
Definition at line 155 of file MergeableHeap.h.
|
inline |
將自己的資料丟給指定的heap, 從此自己一身空
Definition at line 100 of file MergeableHeap.h.
|
inline |
same as copyFrom(heap2)
Definition at line 161 of file MergeableHeap.h.
|
inline |
將最大的element移除
Definition at line 137 of file MergeableHeap.h.
|
inline |
加入element
Definition at line 130 of file MergeableHeap.h.
|
inline |
回傳資料個數
Definition at line 116 of file MergeableHeap.h.
|
inline |
回傳最大的那個 Element
Definition at line 109 of file MergeableHeap.h.