From 36730aece1891ae501443a9624bc400241958741 Mon Sep 17 00:00:00 2001 From: Parikshit Rathore <69366060+parikshitrath@users.noreply.github.com> Date: Sat, 31 Oct 2020 14:04:08 +0530 Subject: [PATCH] Create Inserting node at tai; of linked list Hackerrank Probelem --- Inserting node at tai; of linked list | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Inserting node at tai; of linked list diff --git a/Inserting node at tai; of linked list b/Inserting node at tai; of linked list new file mode 100644 index 0000000..f3df2c7 --- /dev/null +++ b/Inserting node at tai; of linked list @@ -0,0 +1,20 @@ +Node Insert(Node head,int data) +{ +Node tmp = new Node(); +tmp.data = data; +tmp.next = null; + +if(head == null) +{ + head = tmp; + return head; +} + +Node current = head; +while(current.next != null) +{ + current = current.next; +} +current.next = tmp; +return head; +}