title: Write an algorithm that returns the majority element in a list
body: <blockquote>
    <ol start="9">
    <li>(10 points) Write an O(nlogn) algorithm to find the majority element of a list of items. (Assume that the number of elements is a power of 2). Again, the only operation you can use on items of the list is equality comparison. Hint: solve a problem of size n by solving two sub-problems of size n/2</li>
    </ol>
  </blockquote>
  
  <p>This was a test question on divide and conquer, for my algorithms class.
  Here is the code I wrote in python 3.5.</p>
  
  <pre><code>def majElement(L):
      tally = 0
      if len(L) == 1:
          return 1
      for i in range(len(L)):
          tally = majElement(L[i:len(L)]) + majElement(L[len(L)/2:])
  
          if tally &gt; (len(L)/2):
              print(L[i])
  </code></pre>
  
  <p>This code results in a stack overflow. Some how I'm not reaching my base case. 
  How can I stop the infinite recursive calls?</p>