0
0
DSA Pythonprogramming~5 mins

Traversal Forward and Backward in DSA Python - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does forward traversal mean in a linked list?
Forward traversal means moving from the first node to the last node by following the next links one by one.
Click to reveal answer
beginner
What is backward traversal in a doubly linked list?
Backward traversal means moving from the last node to the first node by following the previous links one by one.
Click to reveal answer
beginner
Why can't we do backward traversal in a singly linked list?
Because singly linked lists only have links to the next node, not to the previous one, so we cannot move backward easily.
Click to reveal answer
beginner
In a doubly linked list, which pointers are used for forward and backward traversal?
The 'next' pointer is used for forward traversal, and the 'prev' pointer is used for backward traversal.
Click to reveal answer
beginner
What is the output after forward traversal of this doubly linked list: 1 <-> 2 <-> 3 <-> null?
The output is: 1 -> 2 -> 3 -> null
Click to reveal answer
Which traversal is possible in a singly linked list?
ANo traversal possible
BBackward traversal only
CForward traversal only
DBoth forward and backward traversal
In a doubly linked list, what does the 'prev' pointer do?
APoints to the previous node
BPoints to the head node
CPoints to the next node
DPoints to the tail node
What is the first step in forward traversal of a linked list?
AStart from the tail node
BStart from the head node
CStart from the middle node
DStart from any random node
Which data structure allows easy traversal both forward and backward?
ADoubly linked list
BSingly linked list
CStack
DQueue
What will be the output of backward traversal of this doubly linked list: 1 <-> 2 <-> 3 <-> null?
A1 -> 2 -> 3 -> null
B3 -> null -> 2 -> 1
Cnull -> 1 -> 2 -> 3
D3 -> 2 -> 1 -> null
Explain how forward and backward traversal work in a doubly linked list.
Think about the pointers that connect nodes in both directions.
You got /4 concepts.
    Why is backward traversal not possible in a singly linked list? How does a doubly linked list solve this?
    Focus on the difference in node connections.
    You got /4 concepts.