190 likes | 437 Vues
Data Structures. Fall 2004. Data Structures. What is data structure? Ans: 探討一群相關資料的 資料表示方法 與 資料運作方法 Objective 使用 最有效率 的方式 , 對一群相關資料進行處理 Programs = Data structures + Algorithms How to analyze and design? 1. 找出並描述對該資料的各種運算 2. 考慮最適當的 Data Structure, 使得各種運算的效率最佳 3. 設計一個完整的 Algorithm.
E N D
Data Structures Fall 2004
Data Structures • What is data structure? • Ans: 探討一群相關資料的資料表示方法與資料運作方法 • Objective • 使用最有效率的方式,對一群相關資料進行處理 • Programs = Data structures + Algorithms • How to analyze and design? 1. 找出並描述對該資料的各種運算 2. 考慮最適當的Data Structure,使得各種運算的效率最佳 3. 設計一個完整的Algorithm
Advantages of Studying DS • Solving problems by existing methods • Understanding good algorithms • Learning analysis and design • Building complex software systems • Documentation • Better programming skills • Knowing hardware & software
Foundation for Other Fields • Six fields in our department • Wireless communication • Computer network • Digital signal processing • VLSI • Computer/mechatronics engineering • Power and power processing
Foundation for Other Fields • Theories • shortest path problem • queuing theory • spanning tree • simulation • Programming techniques • linked list • stack, queue, heap, hash • protocol, driver, firmware design
Example • MapleBBS • Source code structure • Network card driver • RTL8139
Question to Ask How do you start?
Start with Understanding Analysis Design
Example • Problem: • Read in 3 integers • Find the largest and the smallest • Solution: • Using flowchart • Using pseudocode
Structured Programming • One IN one OUT flow • Three basic constructs Sequence Selection Iteration
Pseudocode • English-like (Chinese-like) representation of the code required for an algorithm • Algorithm– Logical steps necessary to solve a problem in a computer • Part English and part structured code • English part– easy to read • Code part– extended version of the basic algorithmic constructs
Writing a Program • Problem statements • Requirements analysis • Design • Abstract design • Architectural design • Detail design • Implementation – coding in C • Test
C Programming in Unix • Tools • Editor– vi, joe, pico, etc. • Compiler– gcc – ANSI C • Debugger– gdb • Unix environments • Workstation at the Computer Center • telnet odin.ccunix.ccu.edu.tw • Linux, Free BSD • Linux on Windows or gcc on Windows –not recommended
vi • Text editor • Command driven • Two modes • Command mode • Text-entry mode • Input – everything on the keyboard
vi (cont.) • <ESC> – to escape from the text-entry mode • Single command, repeated command • To go into the text-entry mode • a, A – append • i, I – insert • o, O – add below/above • s, S – substitute • R – replace • cw – change word
vi (cont.) • Editing commands • dd – delete a line • D – delete to the end of a line • yy – copy a line • p – paste what ever is in the buffer • 5dd – to delete 5 lines; 3yy – to copy 3 lines • File commands • :q, :q! – quit • :w, :w! – quit • ZZ – save and quit – :wq
Computer Center • Account name & password • Telnet to workstations • Personal computers
Linux • www.linux.org • www.linuxdoc.org • Distributions • Slackware, Redhat, Mandrake, etc. • Small trial systems • Zipslack • muLinux • Linux-like environment for Windows • Cygwin http://www.cygwin.com/ • http://www.cyut.edu.tw/~ckhung/b/sa/cygwin.shtml
What to do? • Get your account ready from the computer center. • Telnet/ftp to Odin. • Install Linux on your PC. • Review “Introduction to C” • Write and compile a C program under an Unix environment