Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start traversal from the head node.
DSA Go
current := [1]Attempts:
3 left
💡 Hint
Common Mistakes
Starting traversal from tail instead of head.
Using nil which causes runtime error.
✗ Incorrect
Traversal of a circular linked list starts from the head node.
2fill in blank
mediumComplete the code to move to the next node during traversal.
DSA Go
current = current.[1]Attempts:
3 left
💡 Hint
Common Mistakes
Using 'prev' which moves backward.
Using 'head' or 'tail' which are not node pointers.
✗ Incorrect
To traverse, move to the next node using the 'next' pointer.
3fill in blank
hardFix the error in the loop condition to stop after one full circle.
DSA Go
for current != [1] { fmt.Println(current.data) current = current.next }
Attempts:
3 left
💡 Hint
Common Mistakes
Using nil which never occurs in circular list.
Using tail which is not the loop stop condition.
✗ Incorrect
Traversal stops when current reaches head again, completing the circle.
4fill in blank
hardFill both blanks to print all nodes including the head once.
DSA Go
fmt.Println(current.data) current = current.[1] for current != [2] { fmt.Println(current.data) current = current.next }
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'prev' instead of 'next' to move forward.
Stopping loop at tail instead of head.
✗ Incorrect
Move to next node first, then loop until current equals head again.
5fill in blank
hardFill all three blanks to create a safe traversal that handles empty list.
DSA Go
if [1] == nil { return } current := [2] for { fmt.Println(current.data) current = current.[3] if current == [2] { break } }
Attempts:
3 left
💡 Hint
Common Mistakes
Not checking for nil head causing runtime panic.
Starting from tail which is not standard.
Using prev instead of next to move forward.
✗ Incorrect
Check if head is nil to avoid errors, start from head, move using next pointer.
