data structures fall 2004. data structures what is data structure? ans:...

19
Data Structures Fall 2004

Upload: junior-hudson

Post on 18-Jan-2018

222 views

Category:

Documents


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Data Structures

Fall 2004

Page 2: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Data Structures What is data structure?

Ans: 探討一群相關資料的資料表示方法與資料運作方法

Objective 使用最有效率的方式 ,對一群相關資料進行處理

Programs = Data structures + Algorithms

How to analyze and design?1. 找出並描述對該資料的各種運算2. 考慮最適當的Data Structure,使得各種運算的效率最佳3. 設計一個完整的 Algorithm

Page 3: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 4: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Foundation for Other Fields

Six fields in our department Wireless communication Computer network Digital signal processing VLSI Computer/mechatronics engineering Power and power processing

Page 5: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 6: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Example MapleBBS

Source code structure Network card driver

RTL8139

Page 7: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Question to Ask

How do you start?

Page 8: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Start with Understanding

AnalysisDesign

Page 9: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Example Problem:

Read in 3 integers Find the largest and the smallest

Solution: Using flowchart Using pseudocode

Page 10: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Structured Programming One IN one OUT flow Three basic constructs

Sequence SelectionIteration

Page 11: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 12: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Writing a Program Problem statements Requirements analysis Design

Abstract design Architectural design Detail design

Implementation – coding in C Test

Page 13: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 14: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

vi Text editor Command driven Two modes

Command mode Text-entry mode

Input – everything on the keyboard

Page 15: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 16: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 17: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

Computer Center Account name & password Telnet to workstations Personal computers

Page 18: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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

Page 19: Data Structures Fall 2004. Data Structures What is data structure? Ans: 探討一群相關資料的資料表示方法與資料運作方法 Objective 使用最有效率的方式, 對一群相關資料進行處理

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