Partition a Linked List of Support Tickets by Severity

Last updated: November 29, 2026

Quick Overview

Given the head of a singly linked list of support tickets and a severity threshold, reorder it in place so all tickets with severity below the threshold come first, preserving the original relative order within each group.

IBM
Coding & Algorithms
Software Engineer
IBM
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given the head of a singly linked list of support tickets and a severity threshold, reorder it in place so all tickets with severity below the threshold come first, preserving the original relative order within each group.

IBM Support and IBM Maximo handle large ticket queues, and a stable linked-list partition is a common phone-screen warm-up for IBM software roles. The interviewer checks dummy-node technique, pointer hygiene, and stability.

What the Interviewer Expects
  • Use two dummy heads for the two groups
  • Preserve relative order within each group
  • Terminate the second list to avoid a cycle
  • Run in one pass with O(1) extra space
  • Trace pointer changes on an example
Key Topics to Cover
linked lists
dummy node
stable partition
pointer manipulation
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you split into three groups (low, medium, critical)?
  • How would you do this on a doubly linked list?
  • What if you needed the list sorted by severity, stably?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Each node has sev (integer) and next. Return the new head. Tickets with sev < threshold come first, then the rest, each group keeping input order. No new nodes should be allocated except dummy h...

High-Level Design

Walk the list once with two tails, one for each group, both starting at dummy nodes. Append each node to the matching tail. At the end connect the low tail to the first real node of the high list and ...


Submit Your Answer
Markdown supported