We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b575613 commit e95583aCopy full SHA for e95583a
include/heap.h
@@ -57,7 +57,7 @@ namespace alg {
57
private:
58
int m_size; // current heap size.
59
int m_max; // max heap size.
60
- elem * m_heap; // key value pairs.
+ elem * m_heap; // key value pairs.
61
public:
62
Heap(int max) {
63
m_size = 0;
@@ -122,8 +122,8 @@ namespace alg {
122
* remove the given data
123
*/
124
bool remove(T data) {
125
- for (int i=0;i<m_size;i++) { // loop finding
126
- if (m_heap[i].data == data) { // found
+ for (int i=0;i<m_size;i++) { // loop finding
+ if (m_heap[i].data == data) { // found
127
int n = m_size-1;
128
if (n != i) {
129
swap(m_heap[i], m_heap[n]);
0 commit comments