Programming/Algorithm

    Sliding Window Algorithms

    1. What is Sliding Window https://levelup.gitconnected.com/an-introduction-to-sliding-window-algorithms-5533c4fe1cc7 An Introduction to Sliding Window Algorithms Slide into linear time with two pointers, a loop, and a little patience. levelup.gitconnected.com 슬라이딩 윈도우 알고리즘(Sliding Window Algorithms)은 프로그래머들이 그들의 코드를 간소화하는 방법이다. Sliding Window에서 Window는 데이터의 일정한 부분을 형성하고 다른 부분으로 미끄러져 이동할 수 있다. Sl..

    Bruth Force Algorithm

    브루투 포스(Bruth Force)는 검색 대상이 되는 원본 문자열의 처음부터 끝까지 차례대로 순회하며 문자들을 일일이 비교하는 방식의 고지식한 알고리즘으로 비교하고자 하는 문자열과 패턴을 한칸씩 이동하면서 비교하여 일치여부를 확인함. class Solution: def lengthOfLongestSubstring(self, s: str) -> int: def check(start, end): chars = [0] * 128 for i in range(start, end + 1): c = s[i] chars[ord(c)] += 1 if chars[ord(c)] > 1: return False return True n = len(s) res = 0 for i in range(n):# 모든 위치의 시작 인덱..

    Linked Lists

    Linked Lists

    1. Linked Lists https://stackabuse.com/python-linked-lists/ Python Linked Lists A linked list is one of the most common data structures used in computer science. It is also one of the simplest ones too, and is as well as fundamental to high... stackabuse.com 연결리스트(Linked Lists)는 컴퓨터 사이언스에서 가장 흔한 데이터 구조 중 하나이다. 리스트는 참조(reference)를 통해 연결되어 있는 단일 원소들의 집합이다. 예를들어, 데이터 원소들은 address data, geographical..

    Complexity of Algorithms

    1. Algorithms 알고리즘(Algorithm)은 수학과 컴퓨터과학, 언어학 또는 엮인 분야에서 어떠한 문제를 해결하기 위한 정해진 일련의 절차나 방법이다. 계산을 실행하기 위한 단계적 절차를 의미하며 프로그램 명령어의 집합을 의미하기도 한다. 2. Time Complexity 시간복잡도(Time Complexity)는 문제를 해결하는데 걸리는 시간과 입력의 함수 관계를 가리킨다. 즉, 문제를 해결하기 위한 알고리즘을 구성했다고 할 때, 입력값의 변화에 따라 연산에 진행되는 시간이 얼마나 걸리는가를 의미한다. 시간복잡도는 기본적으로 최악 선택 복잡도(Worst-base Complexity)를 기준으로 계산하게 된다. 즉 if문에 대해서도 모든 값이 if문을 통과한다는 가정하에 시간복잡도를 계산하게 ..