From ce065c3a6d503f9df9340a208c18be229904be08 Mon Sep 17 00:00:00 2001 From: slowy07 Date: Mon, 28 Oct 2024 18:07:24 +0700 Subject: [PATCH] fix(codacy): supress error curr tidak pernah terpakai Signed-off-by: slowy07 --- algorithm/hashing/chaining.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/algorithm/hashing/chaining.cpp b/algorithm/hashing/chaining.cpp index 0e37cb0..281ed39 100644 --- a/algorithm/hashing/chaining.cpp +++ b/algorithm/hashing/chaining.cpp @@ -42,17 +42,16 @@ class chaining_hash { * @param indeks indeks dari node */ void tambah(int nilai, int indeks) { - std::shared_ptr curr; std::shared_ptr temp(new Node); temp->data = nilai; temp->next = nullptr; - + std::shared_ptr 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; }