Question discussion

Consider the given memory representation of a singly linked list, where start points to the address of the starting node of the linked list…

358858Medium DSSSB TGT Computer Science 0 replies 0 views
0
Consider the given memory representation of a singly linked list, where start points to the address of the starting node of the linked list, which is in memory location 0.

Memory representation of the linked list

Memory locationItem valuePointer to next element
0A4
1E3
2BNULL
3X2
4C1
If you traverse all the elements from the given linked list, then which of the following is the correct order?
  • AA, B, C, E, X
  • BA, E, B, X, C
  • CA, C, X, E, B
  • DA, C, E, X, B
Correct answer: D

Explanation

Start at location 0 (A), then follow the pointers: 0 (A) → 4 (C) → 1 (E) → 3 (X) → 2 (B) → NULL. The order is A, C, E, X, B.

Discussion 0

Nobody has replied yet. Start the discussion!