From 4b2825790b80752f6ac8f6351e1effae50b9b449 Mon Sep 17 00:00:00 2001 From: lata-arora <73037793+lata-arora@users.noreply.github.com> Date: Sat, 23 Oct 2021 10:21:20 +0530 Subject: [PATCH] Update DOUBLY.CPP --- DOUBLY.CPP | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/DOUBLY.CPP b/DOUBLY.CPP index 135537b..e094b9a 100644 --- a/DOUBLY.CPP +++ b/DOUBLY.CPP @@ -41,13 +41,11 @@ void linklist::addtohead(int ele) { head=new node(ele,head,0); if(tail!=0) - { - head->next->prev=head; - } - else - { - tail=head; - } + head->next->prev=head; + + else //tail will be head otherwise + tail=head; + } int linklist::deletefromhead() {