original_docstring: 
      Merge sort implementation
      time complexity: O(nlogn)  
      
docstring: Merge sort implementation
  time complexity: O(nlogn)
docstring_tokens: Merge sort implementation time complexity : O ( nlogn )
code: def mergesort(L):
      '''
      Merge sort implementation
      time complexity: O(nlogn)  
      '''
      def _merge(S1,S2,S):
          '''
          helper function for mergesort
          merges two sorted sequences S1 and S2 into one sorted sequence S
          '''
          i = j = 0
          while i + j < len(S):
              if j == len(S2) or (i < len(S1) and S1[i] < S2[j]):
                  S[i+j] = S1[i]
                  i+=1
              else:
                  S[i+j] = S2[j]
                  j+=1
  
  
      n = len(L)
      if n<2:
          return  # list is already sorted
      mid = n//2
      # halve the list into two equally sequences
      S1 = L[0:mid]
      S2 = L[mid:n]
      
      # use now recursion to divide elements into small chunks
      mergesort(S1)
      mergesort(S2)
      
      #merge sorted chunks now
      _merge(S1, S2, L)
code_tokens: def mergesort ( L ) : def _merge ( S1 , S2 , S ) : '''
          helper function for mergesort
          merges two sorted sequences S1 and S2 into one sorted sequence S
          ''' i = j = 0 while i + j < len ( S ) : if j == len ( S2 ) or ( i < len ( S1 ) and S1 [ i ] < S2 [ j ] ) : S [ i + j ] = S1 [ i ] i += 1 else : S [ i + j ] = S2 [ j ] j += 1 n = len ( L ) if n < 2 : return mid = n // 2 S1 = L [ 0 : mid ] S2 = L [ mid : n ] mergesort ( S1 ) mergesort ( S2 ) _merge ( S1 , S2 , L )
short_docstring: Merge sort implementation
  time complexity: O(nlogn)
short_docstring_tokens: Merge sort implementation time complexity : O ( nlogn )
comment: '''
      Merge sort implementation
      time complexity: O(nlogn)  
      '''$SEP$'''
          helper function for mergesort
          merges two sorted sequences S1 and S2 into one sorted sequence S
          '''$SEP$# list is already sorted$SEP$# halve the list into two equally sequences$SEP$# use now recursion to divide elements into small chunks$SEP$#merge sorted chunks now