Skip to content

Commit

Permalink
fix(codacy): supress error curr tidak pernah terpakai
Browse files Browse the repository at this point in the history
Signed-off-by: slowy07 <[email protected]>
  • Loading branch information
slowy07 committed Oct 28, 2024
1 parent b9eb210 commit ce065c3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions algorithm/hashing/chaining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,16 @@ class chaining_hash {
* @param indeks indeks dari node
*/
void tambah(int nilai, int indeks) {
std::shared_ptr<Node> curr;
std::shared_ptr<Node> temp(new Node);
temp->data = nilai;
temp->next = nullptr;

std::shared_ptr<Node> curr;
// jika chaining pada indeks kosong, tambahkan node baru
if (!kepala[indeks]) {
kepala[indeks] = temp;
curr = kepala[indeks];
} else {
curr = kepala[indeks];

while (curr->next) {
curr = curr->next;
}
Expand Down

0 comments on commit ce065c3

Please sign in to comment.