Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Data Structures Introduction Homepage : Mail :

Similar presentations


Presentation on theme: "1 Data Structures Introduction Homepage : Mail :"— Presentation transcript:

1 1 Data Structures Introduction Homepage : www.cs.hongik.ac.kr/~rhanhawww.cs.hongik.ac.kr/~rhanha Mail : jhbang@cs.hongik.ac.krjhbang@cs.hongik.ac.kr

2 2 Schedule 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. 기말고사

3 3 Grading Policy (1) Total=3  Project(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)

4 4 Grading Policy (2) Copy 적발 시 Program = 0 No Late Submission No Submission F

5 5 Data Structures #1 Introduction to Unix

6 6 기본 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

7 7 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 : use debug More info. >man g++

8 8 Compile & Debug (GNU).c.c.h.h

9 9 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 For more info. > (gdb) help > man gdb

10 10 #include 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)

11 11 Example Compile & Debug (GNU )

12 12 Example Compile & Debug (GNU)

13 13 Make (1) make 의 필요성 여러 개의 파일로 나누어 개발할 경우  링크 에러의 원인이 되기도 함  에러의 원인을 제대로 찾기가 힘이 든다 수정한 file 만 새롭게 update 할 필요가 있을 때 make 를 사용 make 명령으로 여러 file 을 compile

14 14 Make (2) Make file 은 반드시 makefile 이라는 file name 사용 다른 file name 을 사용 할 경우 -f option 사용 makefile 의 구성 target dependency command ex) test.o (target):test.h test.c (dependency) g++ -c test.c (command) command 부분은 반드시 제일 앞에 TAB character 사용

15 15 Make (3) Example test test.otest1.o test.c test.h test1.c test1.h

16 16 Make (4) Example must tab

17 17 Make (5) Example

18 18 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

19 19 Assignment 제출 요령 (2) Usage : submit #> submit (Prof. Or T/A 계정 ) ( 제출 디렉토리 ) ( 제출할 화일이름 ) - 계정 : jhbang - 제출 디렉토리 구성 : 반이름 / 과제 + 과제번호 예 ) f 반, 숙제 #1 또는 project#1 : f/hw1 or f/pro1

20 20 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 ) */ /*********************************************************************/

21 21 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*/ /*********************************************************************/

22 22 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 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 ********************/

23 23 Report 제출 요령 Program Overview Algorithm pseudo code flow char etc. Analysis

24 24 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; }

25 25 Report 제출요령 - example (2) Algorithm - Flow Chart (Each function) Start Make head node Find inserted position Insert End Find head node


Download ppt "1 Data Structures Introduction Homepage : Mail :"

Similar presentations


Ads by Google