본문 바로가기

전체 글

(22)
SSD에 파일을 쓰기, 삭제, 읽기, 수정하는 프로그램 구현 플래시 메모리를 기반으로 한 SSD(Solid State Drive)는 반도체를 이용하여 정보를 저장하는 장치이다. SSD에 파일을 쓰기, 삭제, 읽기, 수정하는 프로그램을 구현하고자 한다. 주어지는 SSD는 N개(9 ≤ N ≤ 256)의 block으로 구성되며 하나의 블록은 M개(6 ≤ M ≤ 256)의 page로 구성된다. SSD는 기록하는 경우 page 단위로 기록되지만, 지우고자 하는 경우 block 단위로 삭제된다. 따라서 한 블록에 A, B 두 종류의 데이터가 있을 때 A를 삭제하려면 B를 다른 block에 복사하고 A를 포함하는 block을 삭제해야 한다. 그런데 block을 삭제하는 것은 SSD의 수명을 단축시킨다고 한다. 이로 인해 A를 삭제할 때 바로 삭제하는 것이 아니라 삭제된 데이터..
[Heap]중앙값관련 Problem Solving 제한시간: 5000 ms 메모리제한: 256 MB 여러 분은 인터넷 카페 관리자이다. 회원들의 카페 활동 참여도를 분석 하고자한다. 회원들의 참여도가 낮은 그룹과 높은 그룹으로 나누어 분석할 예정이다. 회원 id와 참여도 frequency​를 입력받아 아래 사용자 함수를 작성하는 프로그램을 작성하시오. [해야할 일] 1. 초기 회원수와 회원정보를 전달받아 초기화 : void userInit(int memberCount, Member members[])​ 2. 목록에 회원 추가 : void addMember(Member obj)​ 3. 목록 변경 : 목록의 특정 회원(들)을 삭제하고 새로운 회원을 추가한다. (main code 참조) 삭제는 아래 3가지 경우가 있다. mode == 0 : 참여도가 가장 낮..
[CS] Merge Sort 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 #include #include // 정렬에 사용 할 자료 typedef struct _score { int id; int jumsu; char name[10]; }SCORE; int main(void) { return 0; } int Sort_Merge(SCORE *d, SCORE *tmp, int order, int s, int e, int (*comp)(SCORE * x, SCORE * y)) { int m,idx1,idx2,idxtmp; if(s>=e) return -1; m = (s+e)/2; Sor..
[CS] Quick Sort 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 #include #include // 정렬에 사용 할 자료 typedef struct _score { int id; int jumsu; char name[10]; }SCORE; int Sort_Quick(SCORE *d, int order, int s, int e, int (*comp)(SCORE * x, SCORE * y)) { SCORE temp; int pivot, left, t = s; pivot = e; if(s >= e) return -1; for(l..
[CS] Stack, Queue (Heap기반) [HEAP기반 - Stack] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 #include #include typedef struct _stk { int num; struct _stk * next; }STACK; STACK * Sptr = (STACK *)0; void main(void) { } // 작성한 코드를 아래에 넣으시오. int Push_Stack(STACK *data..
[CS] Stack, Queue(Linear, Circular) [선형리스트 - Stack] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 #include #define MAX_STACK 10 #define STACK_EMPTY MAX_STACK #define STACK_FULL 0 int Push_Stack(int data); int Pop_Stack(int *p); int Print_Stack(void); int Count_Full_Data_Stack(void); int Count_Empty_Data_Stack(void); int a[MAX_ST..
[Hash] Chainning 방식 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 #include #include #include typedef struct _score { int id; int jumsu; char name[10]; struct _score * next; }SCORE; #define MAX_ST 20 #define HASH_KEY 5 SCORE Has..
[Hash]Open Address 방식 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 #include #include #include typedef struct _score { int id; int jumsu; char name[10]; struct _score * next; }SCORE; #define MAX_ST 20 #define HASH_KEY 5 #define STEP 1 SCORE Hash_table[HASH_KEY];..