## 마크다운을 이용한 테스트 마크 다운이 좋은데 티스토리에서는 잘 안된다. * 무엇이 문제일까? ### 해결점 잘 모르겠다 ### 코드 ``` #!/usr/bin/python # -*- coding: UTF-8 -*- from time import time def f(n): if n == 0: return 1 else: return n * f(n-1) def binary_search(data, target, low, high): if low > high: return False else: mid = (low + high)/2 if target == data[mid]: return True elif target < data[mid]: return binary_search(data, target, low, mid - 1) else: return binary_search(data, target, mid + 1, high) def reverse(S, start, stop): if start < stop -1: temp1 = S[start] temp2 = S[stop-1] S[start] = temp2 S[stop-1] = temp1 reverse(S, start+1, stop-1) def linear_sum(S, n): if n == 0: return 0 else: return linear_sum(S, n-1) + S[n-1] if __name__ == "__main__": print "hello" start_time = time() list = [2,4,5,7,8,9,12,14,17,19,22,25,27,28,33,37] # result = f(3) # result = binary_search(list, 23, 0, 15) # result= linear_sum(list, 15) # print ("find:%s" % result) print list reverse(list, 0, len(list)) print list end_time = time() elapsed = end_time - start_time print elapsed print "end" ```