Eat Study Love

먹고 공부하고 사랑하라

Python recursion 3

Review 6 - Python Recursion & Merge Sort

https://eglife.tistory.com/73 Review 6 - Python Search(Linear / Binary) & Sort(Selection / Insertion)https://eglife.tistory.com/72 Review 5 - Python OOP(Objected Oriented Programming)https://eglife.tistory.com/68 Review 4 - Python File I/Ohttps://eglife.tistory.com/67 Review 3 - Loop & Set,Tuple,Dictionaries,Mutabilityhttps://eglife.tistory.com/66 Reveglife.tistory.com Python에서 머리 깨지게 하는 녀석 중 하나..

SW 만학도/Python 2024.07.07

10 - 1 . Recursion으로 Sort 코드 + Merge Sort 구현해보기

참.. Sorting이라는 것이 원리를 설명으로 들을 때는 이해가 되는데 이걸 코드로 Implement 하는 게 되게 어렵다. 그리하여 Sort 코드를 직접 다시 한 번 쳐보기로 한다. 근데 이게 코드를 치면서 느끼는게, 한 번 코드가 눈에 익어버리니까 내가 뭔가 창의적으로 코드를 한다는 느낌보단 외워서 친다는 느낌이 더 든다 ㅋㅋ;;; 이러나 저러나 어떻게든 도움이 되겠지~ 라는 마인드로 그냥 공부해보자 # insertion sort lst1 = [1,-10,5,0,32,-100,99,-8,-7.7,3] lst2 = [-5,-4,-1,-3,4,0,19,1] ​ def inse(list) -> None : for i in range(1,len(list)): val = list[i] j = i-1 whil..

SW 만학도/Python 2024.03.18

9. Computational Complexity & Searching (Big O with Search/Sort in Python)

프로그램을 돌리는데 시간이 얼마나 소요될 지에 대한 공부이다. 일일히 모든 시간을 다 측정할 수 없으니 Programming에선 자잘한 거 빼고 큰 단위 N으로 Time Complexity를 계산한다. -ex) Linear_search / Selection_sort Linear_Search # Linear Search에서 Timex Complexity 계산해보기 ​ def linear_search(lst:list,value:int) -> int : for i in range(len(lst)): if lst[i] == value: return i return -1 ​ lst = [0,1,4,5,-1,6,100] print(linear_search(lst,9)) print(linear_search(lst,5..

SW 만학도/Python 2024.03.17