title: Finding middle element of linked list with 1 pass, is this a creative "useless answer"?
body: <p>Suppose you want to find the middle node of a linked list in as efficient a way possible. The most typical "best" answer given is to maintain 2 pointers, a middle, and current. And to increment the middle pointer when the # of elements encountered is divisible by 2. Hence, we can find the middle in 1 pass. Efficient, right? Better than brute force, which involves 1 pass to the end, then 1 more pass until we reach size/2.</p>
  
  <p>BUT... not so fast, why is the first method faster than the "brute force" way? In the first method, we're incrementing the middle pointer approximately size/2 times. But in the brute force way, in our 2nd pass, we're traversing the list until we reached the size/2th node. So aren't these 2 methods the same? Why is the first better than the 2nd? </p>
  
  <pre><code>//finding middle element of LinkedList in single pass
            LinkedList.Node current = head;
            int length = 0;
            LinkedList.Node middle = head;
  
            while(current.next() != null){
                length++;
                if(length%2 ==0){
                    middle = middle.next();
                }
                current = current.next();
            }
  
            if(length%2 == 1){
                middle = middle.next();
            }
  </code></pre>