MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following is correct way to create node structure for Doubly linked list?
A
struct node { int data;struct node prev; struct node next;struct node link;};
B
struct node { int data;struct node next;};
C
struct node { int data;struct node prev; };
D
struct node { int data;struct node prev; struct node next;};
Explanation: 

Detailed explanation-1: -In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains three fields: two link fields (references to the previous and to the next node in the sequence of nodes) and one data field.

Detailed explanation-2: -In C language, a linked list can be implemented using structure and pointers . struct LinkedList int data; struct LinkedList *next; ; The above definition is used to create every node in the list. The data field stores the element and the next is a pointer to store the address of the next node.

Detailed explanation-3: -A doubly linked list is declared as: struct Node int Value; struct Node *Fwd; struct Node *Bwd; ; Where Fwd and Bwd represent forward and backward link to the adjacent elements of the list.

There is 1 question to complete.