From 636504fd7064c345bb8df0b27824bdb9b51db56a Mon Sep 17 00:00:00 2001 From: Rohith-Raju Date: Sat, 11 May 2024 21:16:51 +0530 Subject: [PATCH] update: changed linked list --- include/LinkedList.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/LinkedList.h b/include/LinkedList.h index 41c6ad4..b33d3e9 100644 --- a/include/LinkedList.h +++ b/include/LinkedList.h @@ -235,12 +235,10 @@ template void LinkedList::deep_clean(Node *&list) { * insert_first() inserts element only when there are no elements in the list */ template void LinkedList::insert_first(Node *node) { - if (!is_empty()) { - head = node; - size_counter = 1; - if (tail == nullptr) { - tail = head; - } + head = node; + size_counter = 1; + if (tail == nullptr) { + tail = head; } return; }