JavaGian java tutorial and java interview question and answer

JavaGian , Free Online Tutorials, JavaGian provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, ajax, core java, sql, python, php, c language etc. for beginners and professionals.

Showing posts with label Doubly-linked-list. Show all posts
Showing posts with label Doubly-linked-list. Show all posts

Explain about Doubly linked list?

10:31 PM
Doubly linked list Doubly linked list is a complex type of linked list in which a node contains a pointer to the previous as well as the next node in the sequence. Therefore, in a doubly linked list, a node consists of three parts: node data, pointer to the next node in sequence (next pointer) , pointer to the previous node (previous pointer). A sample node in a doubly linked list is shown in the figure.   A doubly linked list containing three nodes having numbers from 1 to 3 in their data part, is shown in the following image.   In C, structure of a node in doubly linked list can be given as : struct node    {       struct node *prev;         int  data;       struct node *next;    }    The  prev  part of the first node and the  next  part of the last node will always contain null indicating end in each direction. In a singly linked list, we could traverse only in one direction, because each node contains address of the next node and it doesn't have an

.