title: Why do we need a temp variable to delete a node from a linked list?
body: <p>I once ran into the problem where I did this:</p>
  
  <p><code>previous</code> is the previous node of current. <code>current</code> is the current node we are looking at.
  This is so <code>prev.next</code> points to the element after current. </p>
  
  <pre><code>prev.next = current.next;
  </code></pre>
  
  <p>However, I forgot why this doesn't work and we have to do this instead:</p>
  
  <pre><code>Node temp = current.next;
  prev.next = temp;
  current = temp;
  </code></pre>