COMM Data Structures Fall 2006 COMM Data Structures

• Slides: 19

COMM Data Structures Fall 2006

COMM Data Structures What is data structure? n n Objective n n Ans: 探討一群相關資料的資料表示方法與資料運作方法 使用最有效率的方式, 對一群相關資料進行處理 Programs = Data structures + Algorithms How to analyze and design? 1. 找出並描述對該資料的各種運算 2. 考慮最適當的Data Structure, 使得各種運算的效率最佳 3. 設計一個完整的Algorithm

COMM Advantages of Studying DS n n Solving problems by existing methods Understanding good algorithms Learning analysis and design Building complex software systems n n n Documentation Better programming skills Knowing hardware & software

COMM Foundation for Other Fields n Seven fields in our department n n n n Communication system Electromagnetic Integrated Circuits Computer network Signal and Medium Communication VLSI/SOC Computer/mechatronics engineering Power and power processing

COMM Foundation for Other Fields n Theories n n n shortest path problem queuing theory spanning tree simulation Programming techniques n n n linked list stack, queue, heap, hash protocol, driver, firmware design

COMM Example n Maple. BBS n n Source code structure Network card driver n RTL 8139

COMM Question to Ask How do you start?

COMM Example n Problem: n n n Read in 3 integers Find the largest and the smallest Solution: n n Using flowchart Using pseudocode

COMM Structured Programming n n One IN one OUT flow Three basic constructs Sequence Selection Iteration

COMM Pseudocode n n n 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 n n English part – easy to read Code part – extended version of the basic algorithmic constructs

COMM Writing a Program n n n Problem statements Requirements analysis Design n n Abstract design Architectural design Detail design Implementation – coding in C Test

COMM C Programming in Unix n Tools n n Editor – vi, joe, pico, etc. Compiler – gcc – ANSI C Debugger – gdb Unix environments n Workstation at the Computer Center n n n telnet odin. ccunix. ccu. edu. tw Linux, Free BSD Linux on Windows or gcc on Windows – not recommended

COMM vi n n n Text editor Command driven Two modes n n n Command mode Text-entry mode Input – everything on the keyboard

COMM vi (cont. ) n n n <ESC> – to escape from the text-entry mode Single command, repeated command To go into the text-entry mode n n n a, A – append i, I – insert o, O – add below/above s, S – substitute R – replace cw – change word

COMM vi (cont. ) n Editing commands n n n dd – delete a line D – delete to the end of a line yy – copy a line p – paste what ever is in the buffer 5 dd – to delete 5 lines; 3 yy – to copy 3 lines File commands n n n : q, : q! – quit : w, : w! – quit ZZ – save and quit – : wq

COMM Computer Center n n n Account name & password Telnet to workstations Personal computers

COMM Linux n n n www. linux. org www. linuxdoc. org Distributions n n Linux on Windows n n n Fedora, Suse, Redhat, Mandrake, etc. VMware http: //www. vmware. com/ Colinux http: //www. colinux. org/ Linux-like environment for Windows n Cygwin http: //www. cygwin. com/ n http: //www. cyut. edu. tw/~ckhung/b/sa/cygwin. shtml

COMM What to do? n Get your account ready from the computer center. Telnet/ftp to Odin. n Install Linux on your PC. n n n Review “Introduction to C” Write and compile a C program under an Unix environment