250 likes | 360 Views
This webpage offers a comprehensive introduction to data structures, fundamental programming concepts, and Unix tools. It covers essential topics including arrays, queues, stacks, linked lists, trees, and graphs. Additionally, it incorporates project and assignment details, grading policies, and submission guidelines for students. By utilizing various programming methods and Unix commands, students will enhance their coding skills and understand the impact of data structures on algorithm efficiency. The curriculum includes both practical assignments and theoretical examinations.
E N D
Data Structures Introduction Homepage : www.cs.hongik.ac.kr/~rhanha Mail : jhbang@cs.hongik.ac.kr
1. Introduction to Unix 2. Array / 과제#1 3. Queue & Stack 4. Project #1 제출/설명 5. 식목일 6. Linked list / 과제#2 7. Tree 8. 중간고사 9. Project#2 제출/설명 10. Encoding 11. Graph / 과제 #3 12. Sorting 13. Project #3 제출/설명 14. Hashing 15. 기말고사 Schedule
Grading Policy (1) • Total=3Project(35)+3x숙제(15)+출석(10) • Project (35) = Project (100) 0.35 • 숙제 (15) = 과제(100) 0.15 • Assignment(100) = Program (90) + Report (10) • Program (90) = • Compile (10) • Comment (10) • Execution (Correctness) (70)
Grading Policy (2) • Copy 적발 시 • Program = 0 • No Late Submission • No Submission F
Data Structures #1 Introduction to Unix
기본 Tool 사용법 • man: find and display reference manual pages • Usage: >man [query] • ftp: User interface to file transfer protocol • Usage:>ftp [ip_address | Hostname] • telnet: communicate with another host • Usage: >telnet [ip_address | Hostname] • vi editor: Screen-oriented display editor based on ex • Usage: >vi [options][filename] • More Info.: man page
Compile & Debug (GNU) • g++: C and C++ compilers are integrated • Usage : g++ [-options | filenames]… • -c [source_filename] : compile & generate an object file (.o) • -o [execute_filename] [object_files] [libraries] : generate execution file • -g <source_filename> : use debug • More info. >man g++
Compile & Debug (GNU) .c .h
Compile & Debug (GNU) • gdb: Debugger for gcc and g++ > gdb [executable file] > (gdb) b or break [line_number] > (gdb) r or run > (gdb) n or next > (gdb) s or step > (gdb) display <variable> • For more info. > (gdb) help > man gdb
Example Compile & Debug (GNU) • #include <stdio.h> • struct samp{ • int a, b; • }; • main() • { • struct samp ob[5]={{1,2},{3,4},{5.6},{7.8},{9,10}}; • int i; • samp *p; • p=ob; /* get stating address of array */ • for( i=0; i<4; i++){ • printf(“%d ”, p->a); • printf(“%d \n”, p->b); • p++; • } • printf(“\n”); • return 0; • }
Example Compile & Debug (GNU)
Example Compile & Debug (GNU)
Make (1) • make의 필요성 • 여러 개의 파일로 나누어 개발할 경우 • 링크 에러의 원인이 되기도 함 • 에러의 원인을 제대로 찾기가 힘이 든다 • 수정한 file만 새롭게 update 할 필요가 있을 때make를 사용 • make명령으로 여러file을 compile
Make (2) • Make file은 반드시makefile이라는 file name 사용 • 다른 file name을 사용 할 경우 -foption 사용 • makefile의 구성 • target • dependency • command • ex)test.o (target):test.h test.c (dependency) <TAB>g++ -c test.c (command) command 부분은 반드시 제일 앞에 TAB character 사용
Make (3) • Example test.c test.h test1.c test1.h test.o test1.o test
Make (4) • Example must tab
Make (5) • Example
Assignment 제출 요령 (1) • >telnet 203.249.75.51 or telnet ce1.ce.hongik.ac.kr로 접속 • Using Submit, can’t overwrite • tar: create tape archives and add or extract files • make assign.tar at parent directory of assign >tar cvf assign.tar assign • unpack .tar file >tar xvf assign.tar • File_name: Student-ID_Version.tar • A011001_hw1.tar (Must be include *.h, *.c, makefile) • Make sure your program on ce execution before submission
Assignment 제출 요령 (2) Usage : submit #> submit (Prof. Or T/A 계정) (제출 디렉토리) (제출할 화일이름) - 계정 : jhbang - 제출 디렉토리 구성 : 반이름/과제+과제번호 예) f반, 숙제#1 또는 project#1 : f/hw1 or f/pro1
Comment - example (1) • File Head Comment /*********************************************************************/ /* File Name : Main.c */ /* Date : 2001/3/09 */ /* Compiler : g++ 2.8.1 */ /* Os : Solaris 7.2 */ /* Author : Bang ji ho */ /* Student ID : A011053 */ /* ----------------------------------------------------------------- */ /* ver : 1.0.0 */ /* Description : … */ /* Etc.. : Data Structure Homework #1 ( sparse matrix ) */ /*********************************************************************/
Comment - example (2) • Function Head Comment /*********************************************************************/ /* TMatrix :: _InsertNode */ /* ================================================================= */ /* Input: Node* -> Insert Node, */ /* Node* -> Column node before insert node */ /* Node* -> Row node before insert node */ /* (Input parameter Description) */ /* Output: int - 1 success */ /* 0 - fail */ /* (Out parameter Description) */ /* Purpose: Insert node */ /*********************************************************************/
Comment - example (3) • In-Line Comment /**********************Row insert **************************/ if( pRowPos->pNextRow != pRowPos ) { pTemp->pNextRow = pRowPos->pNextRow; // pTemp set next row if( !( pRowPos->pNextRow->bHead ) ){ pRowPos->pNextRow->NodeItem.pPrevRow = pTemp; } // end of if } // end of if else { pTemp->pNextRow = pRowPos; // pTemp set next row } // end of else pTemp->NodeItem.pPrevRow = pRowPos; // pTemp set previous row pRowPos->pNextRow = pTemp; /********************** End of row insert ********************/
Report 제출 요령 • Program Overview • Algorithm • pseudo code • flow char • etc. • Analysis
Report 제출요령 - example (1) • Algorithm-pseudo code FixHeap(Node *root, Key k) { Node vacant, largerChild; vacant = root; while( vacant is not leaf ) { largerChild = the child of vacant with the larger key; if( k < largerChild’s Key ) { copy lagerChild’s key to vacant; vacant = largerChild; } else exit loop; } }
Report 제출요령 - example (2) • Algorithm - Flow Chart (Each function) Start Find head node Make head node Find inserted position Insert End