From c15c962f02d284f50b7a62b4af92fe2ef696a7a1 Mon Sep 17 00:00:00 2001 From: Krishna Vedala <7001608+kvedala@users.noreply.github.com> Date: Sun, 12 Jul 2020 17:04:09 -0400 Subject: [PATCH] since we are using smart pointers, an explicit destructor is not required --- data_structures/skip_list.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/data_structures/skip_list.cpp b/data_structures/skip_list.cpp index d7982f866..2cb78b8c8 100644 --- a/data_structures/skip_list.cpp +++ b/data_structures/skip_list.cpp @@ -67,22 +67,6 @@ class SkipList { header = std::shared_ptr(new Node(-1, MAX_LEVEL)); } - /** - * Destructor for skiplist class - */ - ~SkipList() { - for (int i = 0; i <= level; i++) { - std::shared_ptr node = header->forward[i]; - std::shared_ptr temp; - while (node != nullptr) { - temp = node; - node = node->forward[i]; - temp.reset(); - } - } - header.reset(); - } - /** * Returns random level of the skip list. * Every higher level is 2 times less likely.