Announcements

INSERTION OF A NODE AT THE BEGINNING OF A DOUBLY LINKED LIST

18/03/2022

Can a program be explained in the form of ACT? I am glad to say that the answer is "YES". We can illustrate the program in the form of a skit or an act. Here, the students of 3rd semester Artificial Intelligence and Machine Learning under the guidance of our teacher, Mr. Srinidhi Kulkarni, illustrated the action of insertion of a node at the beginning of a doubly linked list. A doubly linked list is a type of linked list in which each node apart from storing its data has two links. The first link points to the previous node in the list and the second link points to the next node in the list. The first node of the list has its previous link pointing to NULL and is nicknamed as 'HEAD' similarly the last node of the list has its next node pointing to NULL and is nicknamed as 'TAIL'. In the picture below the action of insertion of a new node at the beginning is explained by Neethu CV. There are three nodes represented (Node A, B&C). Node A consists of: - Santhosh-data value of 10 Banushree-address of previous node (In this case Null) Pooja-address of the next node (2000) Node B: - Rathan-data value of 20 Shwetha-address of the previous node (1000) Shreesha-address of the next node (3000) Node C: - Girish-data value of 30 Hitesh-address of the next node (In this case Null) Shishir-address of the previous node (2000) New node(N) Devaraj-data value of 40 Kruthika R-address of the previous node Adithi-address of the next node The linked list before inserting a new node has its head at the first node (10) and tail at (30). The role of 'Head' is played by Harshith and 'Tail' is played by Ranga Swamy. So in the above picture we can see a head node pointing to the address of the next node(20) and also the previous node i.e,NULL. If we move to the next node(20) we can see it is pointing to the address of the next node(30) i,e, 3000 and the address of the previous node i.e,1000. Again if we move to the further node(30) we can see it is pointing to the next node i.e, NULL and the address of the previous node i.e, 2000. The main aim of this activity is to insert the new node at the beginning and tp make that as the head node and linking it to the existing first node(A). To do that we begin by inserting the new node of value 40 in the front by connecting it to the address of the next node(A) i.e, 1000 and the previous node value as NULL (as it is the front node and there is no previous node). After the insertion of the node(N) at front we set the head node to the new inserted node making the new node(N) as the head node, now the head will point to the new node(N). The below picture shows the end of the illustration. The insertion of a new node at the beginning is completed by making the new inserted node as the head node and connecting it to the next node and previous node as shown below. The activity which was conducted by my fellow students under the guidance of our teacher, Mr Srinidhi Kulkarni, was a fun learning exercise for all. The activity truly gave us a realistic idea on how the insertion of the new node at the beginning in the doubly linked list works thus enhancing our knowledge in this particular topic of data structures. I can positively conclude that the activity was a huge success in achieving its main objective for the class. The class really appreciates the opportunity as it helped us to introduce personal talents, master and help others master the subject. INSERTION OF A NODE AT THE BEGINNING OF A DOUBLY LINKED LIST written by-Kruthika KS(3rd Sem Al-ML)

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Posts

Cryptography

02/08/2020

Telephone : For Admissions-> 90711 17475 General Enquiry-> 95354 23635Email: info@jyothyit.ac.in, principal@jyothyit.ac.in