목록Computer (236)
Machineboy空

https://www.acmicpc.net/problem/2468 2468번: 안전 영역 재난방재청에서는 많은 비가 내리는 장마철에 대비해서 다음과 같은 일을 계획하고 있다. 먼저 어떤 지역의 높이 정보를 파악한다. 그 다음에 그 지역에 많은 비가 내렸을 때 물에 잠기지 않는 www.acmicpc.net 문제요약 connected component 개수의 최댓값 찾기 난이도 Silver 1 풀이 포인트 DFS 3차원으로 활용할 수 있음. x,y좌표와 depth를 활용하여 탐색하는 식으로 활용 브루트포스(brute force) brute: 무식한, force: 힘 모든 경우의 수를 탐색하면서 요구조건에 충족되는 결과를 가져오는 완전탐색. 높이를 하나씩 늘려가며 connected component가 최대가 ..

1.1 Arrays An array stores data in blocks of sequential memory. so that as soon as one element ends, the next element begins. Array Limitation #1 : 모든 요소가 같은 데이터 타입 Elements are all the same type: ex) An integer array must only contain integers. The size(number of bytes) of the type of data is known. We can calculate the offset to any given index from the start of the array: *offset: 고정점으로부터의 위치..

https://blog.naver.com/jhc9639/222289089015 [알고리즘 강의] 2주차. 그래프이론, 인접행렬, 인접리스트, DFS, BFS, 트리순회 이번주차는 그래프이론과 DFS(깊이우선탐색), BFS(너비우선탐색) 그리고 트리순회인 preorder, inord... blog.naver.com 트리 순회(Tree traversal)은 트리 구조에서 각각의 노드를 정확히 한 번만 체계적으로 방문하는 과정 노드를 방문하는 순서에 따라 후위 순회 (postorder traversal) 전위 순회 () 중위 순회 () 보통 설명할 때 이진트리 기반으로 설명하지만 다른 모든 트리에서 일반화시킬 수 있다. *이진트리(binary tree) : 각각의 노드와 자식 노드 수가 2개 이하로 구성되어 ..

탐색이란, 주어진 데이터에서 자신이 원하는 데이터를 찾아내는 알고리즘이다. 즉, 주어진 데이터 성질(정렬 데이터 또는 비정렬 데이터)에 따라 적절한 탐색 알고리즘을 선택하는 것이 중요하다. https://blog.naver.com/jhc9639/222289089015 [알고리즘 강의] 2주차. 그래프이론, 인접행렬, 인접리스트, DFS, BFS, 트리순회 이번주차는 그래프이론과 DFS(깊이우선탐색), BFS(너비우선탐색) 그리고 트리순회인 preorder, inord... blog.naver.com 그래프를 탐색할 때 쓰는 알고리즘들 깊이우선탐색(DFS, Depth First Search) 어떤 노드부터 시작해 인접한 노드들을 재귀적으로 방문 방문한 정점은 다시 방문하지 않으며, 각 분기(가지)마다 가능..

https://blog.naver.com/jhc9639/222289089015 [알고리즘 강의] 2주차. 그래프이론, 인접행렬, 인접리스트, DFS, BFS, 트리순회 이번주차는 그래프이론과 DFS(깊이우선탐색), BFS(너비우선탐색) 그리고 트리순회인 preorder, inord... blog.naver.com 연결된 컴포넌트 (connected component) 연결된 하위 그래프, 연결된 하나의 덩어리 이 덩어리는 연결된 컴포넌트에 속한 모든 정점을 연결하는 경로가 있다. Flood Fill (seed fill) 각 덩어리에 속한 vertex에 같은 숫자를 부여함

https://blog.naver.com/jhc9639/222289089015 [알고리즘 강의] 2주차. 그래프이론, 인접행렬, 인접리스트, DFS, BFS, 트리순회 이번주차는 그래프이론과 DFS(깊이우선탐색), BFS(너비우선탐색) 그리고 트리순회인 preorder, inord... blog.naver.com 4방향(상하좌우)을 탐색! dy[] = {-1,0,1,0}; dx[] = {0,1,0,-1}; // dy : direction y, ny : next y for(i=0 ~4) ny = y + dy[i]; nx = x + dx[i]; 예제 Q. {0,0} 좌표에서 dy, dx를 만들어 4방향 (상하좌우)을 탐색하며 좌표를 출력하시오. #include using namespace std; const..

4.6 Inheritance Inheritance allows for class to inherit all member functions and data from a base class into a derived class. Generic to Specialized A base class is a generic form of a speciallized, derived class. without having to rewrite logic, Initialization When a derived class is initialized, the derived class must construct the base class: Cube must construct Shape By default, uses default..

4.5 Templates and Classes C++ allows for us to use the power of templates in building our own classes and functions. Templated Functions A template variable is defined by declaring it before the beginning of a class or function: //class template class List{ private: T data; }; //function template int max(T a, T b){ if(a >b) {return a;} return b; } Compile-TIme Binding Templated variables are che..