본문 바로가기

cs

(14)
[컴퓨터 네트워크] Chapter4) Network Layer 네트워크 계층 Chapter4) Network Layer 네트워크 계층 processing (2021.04.20~) 1. Introduction 전송 계층은 logical connection을 하고 있는 것으로 양 단 사이의 디바이스들은 이 연결을 몰라도 된다. 네트워크 계층은 논리적 연결이 아니라 물리적 연결이 필요하다 1.1 네트워크 계층에서 제공하는 서비스 1.1.1 패킷화 packetizing 송신측에서 캡슐화, 수신측에서 디캡슐화 송신측에서 네트워크 계층 패킷에 있는 페이로드 (상위 계층에서 받은 데이터)를 캡슐화 페이로드가 너무 크면 쪼갤 필요가 있음 수신측에서 네트워크 계층 패킷의 페이로드를 de-capsulating 1.1.2 라우팅 routing ** LAN과 WAN 의 조합으로 물리적 계층이 구성되기..
[컴퓨터 네트워크] Chapter3) Socket Programming 1. Socket - Interface programming socket 구조 family : PF_INET, IPv6, ... type : 4개 - TCP, UDP, SCTP, IP protocol: TCP/IP local socket address : 필드 길이, 패밀리 필드, 포트 넘버 필드, IP 주소 필드 remote socket address Socket used for UDP 각 클라이언트와 서버는 각각 하나의 소켓을 사용 서로 다른 클라이언트는 서로 다른 소켓을 사용 서버는 수동적 open / 항상 오픈된 상태를 유지하다가 연결 오면 받아줌 / run forever in loop 클라언트는 적극적 open / 직접 연결 시도 / open-close pair Socket used for TC..
Hash Table : open addressing Hash Table : open addressing 성균관대학교 소프트웨어학과 조대호 교수님의 2020년도 2학기 알고리즘 수업을 듣고 수행한 과제입니다. open addressing 방식으로 충돌을 해결하는 Hash Table을 C로 구현하였습니다. problem • m = 37 • Hash functions (not exactly same as the previous open address hash functions) linear probing: h(k, i) = (h'(k) + i) mod m where, h'(k) = k mod m quadratic probing: h(k, i) = (h'(k) + c1i + c2i2 ) mod m where, h'(k) = k mod m, c1 = 1, c2 =..
분할 정복 Divide and Conquer 알고리즘으로 행렬 곱셈 matrix multiplication 풀기 분할 정복 Divide and Conquer : 행렬 곱셈 matrix multiplication problem Program the divide and conquer matrix multiplication using 1) standard algorithm 2) recursion For the two cases 1) and 2), Compare the number of computations (multiplication, addition, and subtraction) between 1), 2) cases. In the matrix computation of C = A×B, matrices A and B are filled with rand()%1000, execute srand(time(NULL)) f..
연결리스트 삽입, 삭제, 출력 Linked List insert delete print 구현하기 연결리스트 Linked List 성균관대학교 소프트웨어학과 조대호 교수님의 2020년도 2학기 알고리즘 수업을 들으며 수행한 과제입니다. problem Write functions which perform according to the following descriptions. The input to each function is a linked list of integers. a) insert - Inserts an integer x to the front of a linked list. e.g.) insert(lst, x) where lst is a pointer to a linked list and x is an integer. b) delete - Deletes 2 nd last integer x..
합병 정렬 : Merge Sort 내림차순으로 구현하기 합병 정렬 Merge Sort 성균관대학교 소프트웨어학과 조대호 교수님의 2020년도 2학기 알고리즘 수업을 듣고 수행한 과제입니다. 배열을 내림차순으로 정렬하는 합병 정렬을 C로 구현하였습니다. input and output conditions Test the function with the following three types of integer inputs. int A[100] : filled with rand()%1000, execute srand(time(NULL)) first, (stdlib.h, time.h should be included) (Duplicate keys are ignored.) int A[100] : already sorted (Write a function for fil..
버블 정렬 Bubble Sort 오름차순으로 구현하기 버블 정렬 Bubble Sort 성균관대학교 소프트웨어학과 조대호 교수님의 2020년도 2학기 알고리즘 수업을 듣고 수행한 과제입니다. 값을 오름차순으로 정렬하는 버블 정렬을 C로 구현한 코드입니다. pseudo code BUBBLE_SORT(A): 1. for i = 0 to A.length 2. for j = 0 to A.length-1 3. if A[j] > A [j+1] 4. swap A[j] and A[j+1] input and output conditions /* - Test the function with the following three types of inputs. 1) int A[100] : filled by rand()%1000, execute srand(time(NULL)) fir..
Hash Table : separate chaining Hash Table : separate chaining 성균관대학교 소프트웨어학과 조대호 교수님의 알고리즘 수업을 들으며 수행했던 과제입니다. rand() 함수로 랜덤 값들을 뽑아 해시 테이블에 적절한 해시 함수를 적용하여 삽입하는 코드입니다. 해시 함수는 전역 변수 N 의 값으로 설정할 수 있습니다. source code #define _CRT_SECURE_NO_WARNINGS #include #include #include typedef struct Node { int key; int value; struct Node* next; } Node; typedef struct listItem { Node* head; Node* tail; int length; } ListItem; ListItem* hash..