| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 |
- Oracle
- Git
- spring
- JavaScript
- MAP
- db
- css
- STS
- regExp
- JS
- regex
- PostgreSQL
- JSON
- lambda
- Java
- Python
- list
- html
- File
- jQuery
- SQL
- key
- jsp
- insert
- table
- port
- Session
- dict
- Linux
- Windows
- Today
- Total
목록Python (24)
step1
*len 99999 list 로 테스트시 소요 시간(microseconds) 1. using collections.Counter() import collections def getFreqByCollections(org_list): return collections.Counter(org_list) ⇒ 2735 microseconds 2. make it as a set → count def getFreqByCount(org_list): return {x:org_list.count(x) for x in set(org_list)} ⇒ 4987 microseconds 3. using itertools.groupby() from itertools import groupby def getFreqByGroupby(or..
def get_elaplsed_time(myfunc): start = datetime.now() myfunc() end = datetime.now() print((end-start).microseconds / 1000) lambda 사용해서 func를 param으로 넘기기 get_elaplsed_time(lambda: myfunc(i))
Binary Tree full complete : all the leaf nodes (nodes from the lowest level) should lean towards left no far right leaf node all the other levels should be completely filled except the lowest one skewed
1. NOT if not empty_list: (true) empty = [] full = [1,2,3] if full: print("full") if not empty: print("empty") 리스트에 원소가 존재하면, True 빈 리스트면, False 2. len() len(empty_list) == 0 empty = [] full = [1,2,3] if len(empty) == 0 : print("empty") 3. == [ ] empty = [] full = [1,2,3] if empty == []: print("empty")
map(func, iter) iter의 각 원소에 func를 적용해서 그 결과값을 map 타입으로 return eg) def plus_one(n): return n+1 a = [1,2,3] a = map(plus_one, a) #type : map #ele : 2,3,4