Skip to content

Instantly share code, notes, and snippets.

@nhuntwalker
Created December 6, 2017 17:27
Show Gist options
  • Save nhuntwalker/f363a8166819515df354a747e9431af4 to your computer and use it in GitHub Desktop.
Save nhuntwalker/f363a8166819515df354a747e9431af4 to your computer and use it in GitHub Desktop.
Write a function to partition a linked list around a value x, such that all nodes less than x come before all nodes greater than or equal to x.
[ 4 ] -> [ 3 ] -> [ 1 ] -> [ 2 ] -> [ 5 ]
x = 2.5
[ 1 ] -> [ 2 ] -> [ 4 ] -> [ 3 ] -> [ 5 ]
Email to: nicholas@codefellows.com by 9:50am
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment