전체 글 (177) 썸네일형 리스트형 [Java] 2-1강 - 객체 지향 프로그래밍 1 (Encapsulation - Access Modifier) 1. Object-Oriented language 기본 개념 1) Object 대부분의 variable과 literal는 object이다. object : class의 instance (class는 object의 type이라고 봐도 된다.) object type instance class // Lecture.java class Employee { String name; public void setName(String name) { this.name = name; } public String getName() { return name; } } public class Lecture { public static void main(String[] args) { Employee m = new Employee();.. 4-1강 - Combinational System Design 1 (Full Adder, Ripple Carry Adder, Carry Look-Ahead Adder) half adder는 XOR 하나와 AND 하나가 합쳐진 구조 0. Half Adder 1) 정의 1bit 2진수 2개를 더할 때, 덧셈한 기존의 합(S)과 동시에 자리올림수(C)를 구하는 조합논리회로입니다. (예를 들어 1과 1을 더하면 결과는 0(S)이지만 자리올림수는 1(C)이 됩니다.) 2) Truth Table 3) 논리회로도 1> C(자리 올림수) - AND A와 B 모두 1이어야 자리 올림이 있으므로 AND gate를 통해 C를 구하고 2> S(합) - XOR A와 B의 실제 합은 XOR 연산자의 결과와 같으므로 이를 통해 S를 구합니다. 1. Full Adder 1) 정의 1> 이전 자리올림수 기존 반가산기 개념에서 더 나아가 뒷자리에서 올라온 자리올림수(C_i, C_in)를 포함하여 1b.. 4-2강 - Euler Cycle(Path) 2 (구현) 2. Euler Cycle(Path) Problem Solution 구현 1) Doubly Linked List Management 1> DBL Structure 아래 구조는 vertex에 대한 adjacent list이며 d에는 edge array의 index를 가지고 있다. (즉, 어떤 edge인지를 나타내는 것이다.) typedef struct _DBL { int d; // store edge array index struct _DBL *twin; // the other DBL pointer struct _DBL *lp , *rp; // reverse & forward ptr } DBL; 2> DBList class class DBList { private: DBL *DBL_pool; public:.. 4-1강 - Euler's path(cycle) 1 (개념 정리 및 구현 아이디어) 0. Review walk : vertex와 edge가 교대로 나타나는 sequence (sequence 내의 edge는 앞 뒤의 vertex를 이어야 한다.) walk edge 중복 불가 vertex 중복 불가 v_0 = v_n walk O X X X trail O O X X path O O O X cycle O O O O closed walk O X X O closed trail O O X O 1. Euler Cycle(Path) Problem 1) 문제 소개 1> 크게 아래 3가지 경우로 나눌 수 있다. - [1] Euler cycle이 존재하거나 - [2] Euler path만 존재하거나 - [3] 아무것도 존재하지 않거나 2> 이들을 판단하는 조건 vertex degree (d(v)) : 각 v.. 3-1강 - 카르노 맵 (The Karnaugh Map) cf> 카르노맵 주의사항 1) b'd' 부분 확인하기 (자주 놓쳐서) 2) 그 외 모서리 부분을 공유하는 부분 항상 주의하기 1. Review 1) 정의들 1> Boolean function 2> letter : constant (0, 1) or variable (x,...) 3> literal : letter, its complement 2) Product term & Sum term 1> Product term - 기본적으로 값이 1이다. (0이면 다른 어떤 값을 곱해도 0이 되어버리기 때문이다.) - non-constant literal이 존재 - 같은 non-constant literal에 대한 conjunction(곱셈)이 2번이상 나오면 안 된다. (4번째 예시는 x1과 x1'이 모두 곱셈에 .. [Java] 1-5강 - Inputs and Outputs 7. Inputs and Ouputs 1) user input 읽기 1> Scanner(class)의 nextLine(instance method)이용해서 standard input의 1개 line을 읽어들인다. Scanner in = new Scanner(System.in); System.out.println ("What is your name?"); String name = in.nextLine(); 2> 다른 method - next : (space로 구분해서) 1개 word를 읽어들인다. - nextInt : integer를 읽어들인다. - nextDouble : double type의 숫자를 읽어들인다. 2) Formatted output 1> System.out.print : 2> System.. 1-4강 - String 6. String C에서는 String은 특별한 type을 정의되지 않아 char의 pointer type 혹은 char의 array로 표현한다. Java에서는 library에서 따로 String이라는 class를 따로 제공해준다. 1) 연산 1> add (+) concatenate된다. String location = "Java"; String greeting = "Hello " + location; // greeting == "Hello Java" 2> 다른 type과의 add string으로 다른 type이 형변환 일어난다. int age = 42; String output = age + " years" // output == "42 years" 2) method 1> static method - .. 1-3강 - Java Arithmetic Operator 5. Arithmetic Operators 1) Base arithmetic 2) Unary operator 3) Mathematics method 기본 연산 외에 더 다양한 수학적 연산이 필요한 경우 Math를 가져와서 쓴다. Math.pow(x,y) : return x^y Math.sqrt(x): square root of x Math.random(): returns a random number in the range [0, 1). 추가로 min, max, PI, E 등등이 더 있다. cf> method 앞에 붙는 것 1> static method - method 앞에 오는 것 : class - instance를 만들지 않고 사용할 수 있다. - static 이라는 keyword를 사용해서 만든다. .. 이전 1 ··· 3 4 5 6 7 8 9 ··· 23 다음