{"id":27422396,"url":"https://github.com/bosl95/algorithm","last_synced_at":"2025-04-14T10:20:10.992Z","repository":{"id":48586751,"uuid":"233779355","full_name":"bosl95/Algorithm","owner":"bosl95","description":" Algorithm master","archived":false,"fork":false,"pushed_at":"2022-01-10T02:07:06.000Z","size":2932,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T10:20:07.354Z","etag":null,"topics":["algorithm","java","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bosl95.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-14T07:10:52.000Z","updated_at":"2022-01-10T02:07:09.000Z","dependencies_parsed_at":"2022-07-26T07:47:27.826Z","dependency_job_id":null,"html_url":"https://github.com/bosl95/Algorithm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosl95%2FAlgorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosl95%2FAlgorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosl95%2FAlgorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bosl95%2FAlgorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bosl95","download_url":"https://codeload.github.com/bosl95/Algorithm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860007,"owners_count":21173342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","java","python"],"created_at":"2025-04-14T10:20:10.446Z","updated_at":"2025-04-14T10:20:10.941Z","avatar_url":"https://github.com/bosl95.png","language":"Python","readme":"# tada::tada: Algorithm:tada:tada:\n\n\u003cbr\u003e \n\n## :heavy_check_mark: Contents\n\n### :dart: Algorithm\u003cbr\u003e\n\n- [*Back Tracking*](https://github.com/bosl95/Algorithm/tree/master/BACK_TRACKING)  \n- [*Brute Force*](https://github.com/bosl95/Algorithm/tree/master/BRUTE_FORCE)  \n- [*BINARY_SEARCH*](https://github.com/bosl95/Algorithm/tree/master/BINARY_SEARCH)\n- [*DFS/BFS*](https://github.com/bosl95/Algorithm/tree/master/DFS_BFS)  \n- [*Divide and Conquer*](https://github.com/bosl95/Algorithm/tree/master/DIVIDE%20AND%20CONQUER)  \n- [*Dynamic Programming*](https://github.com/bosl95/Algorithm/tree/master/DYNAMIC%20PROGRAMMING)  \n- [*Function*](https://github.com/bosl95/Algorithm/tree/master/FUNCTION)  \n- [*Floyd-Warshell*](https://github.com/bosl95/Algorithm/tree/master/FLOYD-WARSHELL)   \n- [*Greedy*](https://github.com/bosl95/Algorithm/tree/master/GREEDY)  \n- [*Graph*](https://github.com/bosl95/Algorithm/tree/master/Graph)  \n- [*Mathematics 1*](https://github.com/bosl95/Algorithm/tree/master/MATHEMATICS)\n- [*Hash\u0026Binary Search\u0026Heap*](https://github.com/bosl95/Algorithm/tree/master/HASH_BINARY%20SEARCH_HEAP)  \n- [*MST*](https://github.com/bosl95/Algorithm/tree/master/MST)  \n- [*Recursion*](https://github.com/bosl95/Algorithm/tree/master/RECURSION)\n- [*Simulation*](https://github.com/bosl95/Algorithm/tree/master/SIMULATION)\n- [*Sort*](https://github.com/bosl95/Algorithm/tree/master/SORT)  \n- *[IF](https://github.com/bosl95/Algorithm/tree/master/IF)/[For](https://github.com/bosl95/Algorithm/tree/master/FOR)/[While](https://github.com/bosl95/Algorithm/tree/master/WHILE)*  \n- [*String*](https://github.com/bosl95/Algorithm/tree/master/STRING)  \n- [*Tree*](https://github.com/bosl95/Algorithm/tree/master/TREE)\n  \n ### :dart: Data Structure  \n- [*Array*](https://github.com/bosl95/Algorithm/tree/master/ARRAY)  \n- [*Stack*](https://github.com/bosl95/Algorithm/tree/master/STACK)  \n- [*Queue/Deque*](https://github.com/bosl95/Algorithm/tree/master/QUEUE_DEQUE)  \n  \n  \n### :dart: Etc.  \n- [*Samsung Software Expert Academy*](https://github.com/bosl95/Algorithm/tree/master/SW_Expert_Academy)\n- [*Programmers*](https://github.com/bosl95/Algorithm/tree/master/Programmers)\n\n\u003cbr\u003e\n  \n---\n\n## :pushpin: Time Complexity\n\n|*Size of N*| *Maximum Time Complexity* |\n|:--:|:--:|\n| *N ≤ 11* |*O(N!)*|\n|*N ≤ 25*|*O(2\u003csup\u003eN\u003c/sup\u003e)*|\n|*N ≤ 100*|*O(N\u003csup\u003e4\u003c/sup\u003e)*|\n|*N ≤ 500*|*O(N\u003csup\u003e3\u003c/sup\u003e)*|\n|*N ≤ 3,000*|*O(N\u003csup\u003e2\u003c/sup\u003elogN)*|\n|*N ≤ 5,000*|*O(N\u003csup\u003e2\u003c/sup\u003e)*|\n|*N ≤ 1,000,000*|*O(NlogN)*|\n|*N ≤ 10,000,000*|*O(N)*|\n|*10,000,000~*|*O(logN)*, *O(1)*|\n\n\u003cbr\u003e\n\n- #### 컴퓨터는 1초에 대략 3-5억 개정도의 연산을 처리한다. \u003cbr\u003e\n- #### 단, 연산이 AND, OR, 비교, 덧셈 등과 같은 단순 연산인지 아니면 나눗셈, 곱셈, 대입, 함수  호출과 같은 복잡한 연산인지에 따라 차이가 날 수있다.\u003cbr\u003e\n\n\u003cbr\u003e\n\n## :pushpin: Space Complexity\n\n- #### int는 4byte의 메모리를 가진다. \u003cbr\u003e\n- #### 512MB는 1.2 억개의 int를 가진다.\u003cbr\u003e\n- #### 만약, 풀이가 5억인 배열이 필요하다면 주어진 메모리 제한을 만족하지 못하므로 다른 풀이를 찾아야한다.\n\n\u003cbr\u003e\n\n## :pushpin: Python EOF\n\n### #1\n\n\twhile True:\n\t\ttry:\n\t\t\ta, b = map(int, input().split())\n\t\t\tprint(a+b)\n\t\texcept:\n\t\t\tbreak\n\t\t\t\n### #2\n\t\n\timport sys\n\tfor line in sys.stdin:\n\t\ta, b = map(int, line.split())\n\t\tprint(a + b)\n\t\t\n### cf\n#### sys.stdin.readline은 \\n을 포함하는 것에 주의 ==\u003e strip()을 통해 공백을 제거 \n\t\t\n\u003cbr\u003e\n\n## :pushpin: Python KeyError\n\t\n\tX = dict()\n\tif not X[i]:\t# KeyError\n\t\n\tif X.get(i):\t# OK\n\t\n\u003cbr\u003e\n\t\n## :pushpin: 완전 탐색 시 시간 초과가 나는 경우\n\n1. 투 포인터 알고리즘 시도해보기\n2. 이분 탐색 시도해보기(binary search)\n3. dp(Dynamic programming) 시도해보기\n4. 그리디(Greedy) 시도해보기\n\n\u003cbr\u003e\n\n## :pushpin: Python에서 많이 쓰이지만 헷갈리는 Lambda 함수에 대해 알아보기\n\n      # 일반 함수\n      def ten(x):\n        return x+10\n       \n      ten(1)       # 11\n      \n      # lambda 함수\n      ten = lambda x: x+10\n      ten(1)        # 11\n\n- 일반 함수를 한 줄로 짧게 쓸 수 있다.\n\n\u003cbr\u003e\n\n- result라는 dictionary가 있다고 가정해보자.\n\n      sorted(result, key=lambda x:result[x], reverse=True)\n      \n   1. result는 [result의 키]로 이루어진 리스트 형태이다.\n   2. 키값을 하나씩 꺼낸 것이 x이다.\n   3. result[x]는 결국 키가 x인 딕셔너리의 값이다. 즉, '값'을 기준으로 거꾸로 정렬한다는 의미이다\n   4. 대신 결과값으로는 키 값만 다시 되돌아온다. 1번에서 키로 주어졌기 때문이다.\n  \n- 같은 결과를 가지는 코드는 아래와 같다.\n\n      sorted(result.items(), key=lambda x:result[x[0]], reverse=True)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbosl95%2Falgorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbosl95%2Falgorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbosl95%2Falgorithm/lists"}