Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ883
Page ↗
Q883FWASIC interview problem

Find the middle node

TechniquesLinked listFast and slow
DifficultyEasy
TopicLinked Lists
LanguageSystemVerilog
Requirements3 checkpoints
01

Problem

Return the middle node of a singly linked list. For an even-length list, return the second of the two middle nodes.

Example input and output

Use this case to check your interpretation
Input
head = 1 -> 2 -> 3 -> 4 -> null
Output
node with value 3
Explanation

With an even number of nodes, the fast pointer reaches null after slow advances to the second middle node.

02

Requirements (3)

  • Use one traversal.
  • Use constant extra space.
  • Return null for an empty list.