From 367b98181074caee9b10b6a21fa91bc7cb0eee63 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 22 Apr 2020 16:06:51 +0200 Subject: [PATCH] Reduce code in linked_list.cpp @mariangusatu Your review please. --- data_structure/linked_list.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/data_structure/linked_list.cpp b/data_structure/linked_list.cpp index 2af3f82a3..dd6536abb 100644 --- a/data_structure/linked_list.cpp +++ b/data_structure/linked_list.cpp @@ -14,15 +14,13 @@ void insert(int x) { t = t->next; } node *n = new node; - t->next = n; - n->val = x; - n->next = NULL; + t->next = n; } else { node *n = new node; - n->val = x; - n->next = NULL; start = n; } + n->val = x; + n->next = NULL; } void remove(int x) {