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 e95583a commit fc65d5fCopy full SHA for fc65d5f
include/heap.h
@@ -121,7 +121,7 @@ namespace alg {
121
/**
122
* remove the given data
123
*/
124
- bool remove(T data) {
+ bool remove(const T &data) {
125
for (int i=0;i<m_size;i++) { // loop finding
126
if (m_heap[i].data == data) { // found
127
int n = m_size-1;
@@ -141,7 +141,7 @@ namespace alg {
141
* decrease key
142
* simpliy implemented as remove then push
143
144
- void decrease_key(T data, int newkey) {
+ void decrease_key(const T &data, int newkey) {
145
if (remove(data)) {
146
push(newkey, data);
147
}
0 commit comments