title: Building a linked list with LINQ
body: <p>What is the fastest way to order an unordered list of elements by predecessor (or parent) element index using LINQ?</p>
  
  <p>Each element has a unique ID and the ID of that element's predecessor (or parent) element, from which a linked list can be built to represent an ordered state.</p>
  
  <h2>Example</h2>
  
  <pre><code>ID      | Predecessor's ID
  --------|--------------------
  20      | 81
  81      | NULL
  65      | 12
  12      | 20
  120     | 65
  </code></pre>
  
  <p>The sorted order is {81, 20, 12, 65, 120}. An (ordered) linked list can easily be assembled iteratively from these elements, but can it be done in fewer LINQ statements?</p>
  
  <p><strong>Edit:</strong> I should have specified that IDs are not necessarily sequential. I chose 1 to 5 for simplicity. See updated element indices which are random.</p>