Skip to content

root / head / tail [terminology]

Terminology

Usage

  • Use root for the entry node of a tree or trie.
  • Use head for the first node of a linked list.
  • Use tail for the final node of a list being constructed or merged.
  • These structural names should not be replaced by generic names such as node or cur when their structural role matters.
dummy = ListNode()
tail = dummy
# ...
return dummy.next

See 21. Merge Two Sorted Lists.