일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- BFS
- 큐(Queue)
- 플로이드 워셜 알고리즘(Floyd-Warshall Algorithm)
- 분할 정복(Divide and Conquer)
- DFS & BFS
- 백준 2504번
- 이분 탐색(Binary Search)
- 백준 10000번
- 그래프(Graph)
- 백준 1707번
- 스택(Stack)
- 트리(Tree)
- 알고리즘 개념
- DFS
- 백준 1948번
- 백준 2812번
- 백준 9012번
- 백준 17608번
- 그리디 알고리즘(Greedy Algorithm)
- 백준 2493번
- DFS(Depth First Search)
- 동적 프로그래밍(Dynamic Programming)
- 백준 18352번
- 이분 그래프(Bipartite Graph)
- 위상 정렬(Topological Sort)
- 백준 21606번
- BFS(Breadth First Search)
- 백준 2261번
- 위상 정렬(Topology Sort)
- 다익스트라 알고리즘(Dijkstra Algorithm)
- Today
- Total
목록알고리즘 (101)
Always Be Wise
해시 테이블 또는 해시 맵은 키를 값에 매핑할 수 있는 구조인, 연관 배열 추상 자료형(ADT)을 구현하는 자료구조이다. 해시 테이블의 가장 큰 특징은 대부분의 연산이 분할 상환 분석에 따른 시간 복잡도가 O(1)이라는 점이다. 해시 테이블의 핵심은 해시 함수다. 해시 함수란 임의 크기 데이터를 고정 크기 값으로 매핑하는 데 사용할 수 있는 함수를 말한다. 성능 좋은 해시 함수들의 특징은 다음과 같다. 해시 함숫값 충돌의 최소화 쉽고 빠른 연산 해시 테이블 전체에 해시 값이 균일하게 분포 사용할 키의 모든 정보를 이용하여 해싱 해시 테이블 사용 효율이 높을 것 로드 팩터란 해시 테이블에 저장된 데이터 개수 n을 버킷의 개수 k로 나눈 것이다. 로드 팩터 비율에 따라서 해시 함수를 재작성해야 될지 또는 해..
해시 테이블(Hash Table)은 키(Key)를 값(Value)에 매핑할 수 있는 자료구조를 의미한다. 해시 테이블의 가장 큰 특징은 대부분의 연산이 분할 상환 분석에 따른 시간 복잡도가 O(1)이라는 점이다. 덕분에 데이터 양에 관계 없이 빠른 성능을 기대할 수 있다. 해시 함수(Hash Function) 해시 테이블의 핵심은 해시 함수이다. 해시 함수란 임의 크기 데이터를 고정 크기 값으로 매핑하는 데 사용할 수 있는 함수를 의미한다. 예를 들어, 입력값 ABC, 1324BC, AF32B로 각각 3글자, 6글자, 5글자를 2바이트의 고정 크기 값으로 매핑하는 함수를 해시 함수라고 한다. 해시 테이블을 인덱싱하기 위해 이처럼 해시 함수를 사용하는 것을 해싱이라고 하며, 해싱은 정보를 가능한 빠르게 저..
▶ 문제 : https://leetcode.com/problems/daily-temperatures/ Daily Temperatures - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### # 매일의 화시 온도 리스트를 입력 받아서, 더 따뜻한 날씨를 위해서는 며칠을 기다려야 하는지 출력하라. ##### 입력 ##### # temperatures = [73, 74, 75, 71, 69, 72, 76, 73] ##### 출력 ##### # ..
▶ 문제 : https://leetcode.com/problems/remove-duplicate-letters/ Remove Duplicate Letters - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### # 중복된 문자를 제외하고 사전식 순서로 나열하라. ##### 입력 ##### # bcabc ##### 출력 ##### # abc ▶ 접근 방법 스택을 이용하여 해결할 수 있는 문제이다. 우선, 문자열(s)에서 개별 문자(char)..
▶ 문제 : https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### # 괄호로 된 입력값이 올바른지 판별하라. ##### 입력 ##### # ( ) [ ] { } ##### 출력 ##### # True ▶ 접근 방법 전형적인 스택 문제이다. 괄호 ( , [ , { 는 스택에 push하고 ), ] , } 는 스택에서 pop을..
▶ 문제 : https://leetcode.com/problems/best-time-to-buy-and-sell-stock/ Best Time to Buy and Sell Stock - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### # 한 번의 거래로 낼 수 있는 최대 이익을 산출하라. ##### 입력 ##### # prices = [7, 1, 5, 3, 6, 4] ##### 출력 ##### # 5 ▶ 접근 방법 1) 브루트 포스로 계..
▶ 문제 : https://leetcode.com/problems/3sum/ 3Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### # 배열을 입력받아 합으로 0을 만들 수 있는 3개의 엘리먼트를 출력하라. ##### 입력 ##### # nums = [-1, 0, 1, 2, -1, -4] ##### 출력 ##### # [[-1,-1,2],[-1,0,1]] ▶ 접근 방법 1) 브루트 포스로 계산 입력 받은 리스트를 우선 정렬하고, 리..
▶ 문제 : https://leetcode.com/problems/trapping-rain-water/ Trapping Rain Water - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### 높이를 입력받아 비 온 후 얼마나 많은 물이 쌓일 수 있는지 계산하라. ##### 입력 ##### height = [0,1,0,2,1,0,1,3,2,1,2,1] ##### 출력 ##### 6 ▶ 접근 방법 height 리스트에서 가장 큰 값은 3이다..
▶ 문제 : https://leetcode.com/problems/two-sum/ Two Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### 덧셈하여 타겟을 만들 수 있는 배열의 두 숫자 인덱스를 리턴하라. ##### 입력 ##### nums = [2, 7, 11, 15] target = 9 ##### 출력 ##### [0, 1] ▶ 접근 방법 여러 가지 접근 방법을 생각해볼 수 있었다. 우선, 브루트 포스 방식의 완전탐색을 수행..
▶ 문제 : https://leetcode.com/problems/longest-palindromic-substring/ Longest Palindromic Substring - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ##### 문제 ##### 가장 긴 팰린드롬 부분 문자열을 출력하라. ##### 입력 ##### "babad" ##### 출력 ##### "bab" ▶ 접근 방법 팰린드롬이 가능한 경우의 문자열을 찾고 해당 문자열을 확장하는 식의 풀이로 접..