Welcome to my personal website. I use this space to share some of my thoughts and software that I write in my free time. Sometimes I also publish photos. If you want to get in touch please use LinkedIn or Mastodon.
Partition a linked list given a value x as a pivot element so that all nodes that are
smaller than x come before all nodes that are greater or equal than x. The original
order of the elements should be retained.
This can be solved by creating two sub lists with empty nodes, called left and right
and then concatenating those lists in the last step. The easiest way to achieve this is
to create two new empty nodes and then, return left.next. This avoids having to keep
track of None inside the loop and simpliefies the code.
About the author
Friedrich Ewald is an experienced Software Engineer with a Master's degree in Computer Science. He started this website in late 2015, mostly as a digital business card. He is interested in Go, Python, Ruby, SQL- and NoSQL-databases, machine learning and AI and is experienced in building scalable, distributed systems and micro-services at multiple larger and smaller companies.