One Marks Questions
1. Explain node structure of SLL.
Answer: In any single linked list, the individual element is called as "Node".
Every "Node" contains two fields, data field, and the next field. The
data field is used to store actual value of the node and next field is
used to store the address of next node in the sequence.
The graphical representation of a node in a single linked list is as follows:
In C, we achieve this functionality by using structures and pointers. Each structure represents a node having some data and also a pointer to another structure of the same kind.
So, the structure is something like:
struct node
{
int data;
struct node *next;
};
2. Write node structure for a Doubly Circular Linked List. (MAR 2018)
Answer: A circular doubly linked list is a linear data structure,
in which the elements are stored in the form of a node.
Each node contains three parts. A data part that
stores the value of the element, the previous part that stores the pointer to
the previous node, and the next part that stores the pointer to the next node
as shown in figure:
node structure
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
3. “A Linked List can only be traversal sequentially”. State True/False.
Answer: True, Traversing means visiting each node of the list once in order to perform some operation on that.
In linear linked list we traverse the list from the head node and stop the traversal when we reach NULL by visiting each
node sequentially.
0 Comments:
Post a Comment