본문 바로가기

분류 전체보기

(177)
7-0강 - Greedy Algorithm 0 (그리디 알고리즘) 0. Greedy Algorithm (대부분의 문제는 일련의 선택으로 구성되어 있는데) 현재 상황에서 가장 좋은 것을 선택 => 선택의 결과가 전체로 보았을 때 좋지 않을 수도 있습니다. 1) Optimality 1> global optimal & 2> local optimal 2) (Combinatorial) Optimization Problem 0> combinatorial : solution이 discrete & finite set이다. 1> 구성 [1] input [2] constraint [3] objective [4] output : [1]로 인해, [2]를 만족하는, [3]을 최소/최대화 하는 solution 2> solution feasible solution : constraint를 만족..
6-9강 - [중요] Dynamic Programming 9 (Directed Acyclic Graphs) 9. Directed Acyclic Graphs : cycle이 없는 graph 1) Activity On Vertex (AOV) Vertex : action Edge : precedence relation 0> 기본 용어 i = j의 predecessor (j = i의 successor) i = k의 immediate predecessor (k = i의 immediate predecessor) 1> relation - partial order [1] transitive (iRj & jRk => iRk) [2] irreflexive (iRi가 항상 성립하지 않는다.) 2> topology order 아래 조건을 만족하는 linear ordering "i = j의 predecessor" => "i prec..
[Java] 5-1강 - Generic Programming 1 (generic의 기본) 0. Generic Programming 각 type별로 코드를 따로 만드는 것이 아니라 같은 코드로 여러 type을 다루는 방법 (동일한 코드는 한 번만 만드는 게 좋다.) 이와 같이 A, B라는 class 말고 아래와 같이 Object라는 class로 한 번에 다루면 됩니다. 하지만 이 또한 type casting을 해야하는 등 불편한 점이 많습니다. 그래서 Generic class라는 것을 생성하도록 합니다. 1. Generic Class 1) Generic Class 기본 1> Generic Class 정의 [1] class 이름과 () [2] class 내부 특정 object의 type을 (T) 아래와 같이 T로 설정합니다. (T는 type에서 비롯된 글자이지만 T가 아닌 다른 문자를 써도 됩니..
[Java] 4-1강 - 예외 처리 cf> error의 종류 compile error : compile에 안 된다. (e.g. syntax error) run-time error : compile은 잘 되는데 프로그램 실행 시에 문제가 된다. logical error : computer는 error인지 모르는데, 프로그래머가 생각하는 대로 코드가 돌지 않는다. 0. Background 1) Run-time error Run-time error는 error와 exception으로 분류할 수 있습니다. 1> error 더 이상 프로그램을 지속할 수 없는 경우 e.g. out of memory 2> exception 프로그램을 종료하지 않아도 되는 경우 e.g. arithmetic exception, class cast exception, nu..
6-1강 - Sequential Circuit Design 1 (Finite State Machine, Moore Machine & Mealy Machine) 0. Background 순차회로의 경우 이전의 combinational system과 달리 history까지 고려해서 다음 state를 결정합니다. 그로 인해 Truth Table 만으로는 값의 변화를 효율적으로 나타내기 어려울 수 있습니다. 그래서 순차회로를 더 잘 표현할 수 있도록 State Diagram과 State Table을 사용합니다. 1) State Table Truth Table에서는 어떤 input들이 주어졌을 때, output이 어떤 state를 가지는지만 파악했다면 State Table은 순차회로 특성에 맞게 input과 history를 동시에 고려합니다. State Table은 위의 가로줄은 input 조합, 왼쪽 세로줄은 history(현재 상태)가 주어지고 '이 history(..
5-2강 - Analysis of Sequential Systems 2 (Flip Flops) 2. Flip Flops 이전에 배운 Latch와 달리, 기본적으로 Clock이 enable로 작용하는 순차회로 일반적으로 Flip Flop을 주로 사용합니다. 0) background 1> Leading edge triggered (rising edge) 2> Trailing edge triggered (falling edge) 3> D flip flop (input : D, clk) (D=0 -> Q+=0 & D=1-> Q+=1) 4> SR flip flop (input : S, R, clk) ( (S, R) = (0,0)일 때, undefined) 5> JK flip flop (input : J, K, clk) ( (J, K) = (0, 0)일 때, Q+ = Q) 6> T flip flop (inp..
5-1강 - Analysis of Sequential Systems 1 (Latch) 0. Sequential System 1) finite state machine state는 현재 0 또는 1의 값을 의미하므로 memory로 생각해도 된다. 그러므로 유한한 메모리를 저장하는 machine을 말한다. 1> memory를 가진 system 2> output은 [1] 현재 input과 [2] 과거 history를 통해 결정합니다. 2) Synchronous system clock이 input, internal, output signal에 영향을 미칩니다. cf> Clock 일정 속도로 0과 1이 반복되는 signal cf> Latch 1-bit를 저장하는 메모리 1. Latch 1) SR Latch 0> boolean function 1> 회로도 2> Truth table (S, R) = ..
6-5강 - Dynamic Programming 5 (The Traveling Salesperson Problem, TSP) 5. The Traveling Salesperson Problem (TSP) 0) The Traveling Salesperson Problem 1> tour (Hamiltonian cycle) 모든 vertex를 한 번씩 지나는 cycle 구하기 2> optimal tour minimum length(cost)로 tour를 만들기 => TSP : optimal tour 찾기 1) The Principle of Optimality 1> 전제 : T = [v1, vp1, vp2, ... , vpn-1, v1] = optimal tour => P = [vp1, vp2, ... , vpn-1, v1]라는 path가 minimum length(cost) 2> 가정 : P'라는 다른 path가 length(cost..