Anda di halaman 1dari 20

Prologue

Data Structures

Class Info

Instructor Info.
Oh-Heum Kwon Email: ohkwn@pknu.ac.kr Office: 2312 Phone: 051-629-6255

Text
- Koffman and Wolfgang, Data Structures: Abstraction and Design Using Java, 2nd Ed. Wiley Pub.

Prerequisite
- Java programming language - Java development environment Eclipse

Fall 2012

Data Structure

Class Info

Grading Policy
60% Java 4 1 A Java 3 (nonlinear degradation) 2 = 1

30%

10%

Course Homepage
- find course material and submit your homework at: http://alg.pknu.ac.kr

Fall 2012

Data Structure

1. .

2. .

3. .

Schedule
week 1 2 3 Topic Introduction OOP and Java OOP and Java P.A #1 Assignment week 9 10 11 Stack Stack Queue P.A #3 Topic Assignment

4 5
6 7 8

List List
List List Mid Exam P.A #2

12 13
14 15 16

Queue Recursion
Tree Tree Final Exam P.A #4

Fall 2012

Data Structure

Programming Courses

Important because its not knowledge, but skill.


Fall 2012 Data Structure 6

What is Data Structure?

Suppose that you are to make a phone directory using notebook and pencil. You need to have
- a way of recording the numbers and names in your notebook (data structure) - ways to lookup, add, and delete items (algorithms )

In general, a program is a combination of data structures and algorithms.

Fall 2012

Data Structure

Unordered List
010-4566-2746
017-3456-2726 051-2345-2445 042-1234-5679 031-2453-2957

No specific rule How to look up a persons number? How to add a new person? How to remove x-girl/boy friends number?

Fall 2012

Data Structure

Ordered List
031-2453-2957
017-3456-2726 051-2345-2445 042-1234-5679 010-4566-2746

Alphabetical order Look up? Add? Remove?

Fall 2012

Data Structure

Linked List

031-2453-2957 017-3456-2726 051-2345-2445 042-1234-5679 010-4566-2746

A card for each person Lookup? Add? Remove?

Fall 2012

Data Structure

10

Indexed Structure
010-3455-6543 011-124-2345 051-2345-2445 031-2453-2957 042-1234-5679 017-3456-2726 010-4566-2746

One page for each alphabet Lookup? Add? Remove?

Fall 2012

Data Structure

11

There are smarter ways to store phone numbers. You will learn them later in this course: binary search tree hash table

Why should we study data structure?

A program is a combination of data structure and algorithm. Algorithms depend on data structures. Good data structure is a key to the good program. - Well-designed data structure yields an easy, intuitive, natural and efficient algorithm.

Learning skills to design data structure appropriate to the application is the main goal of this course.

Fall 2012

Data Structure

13

Common Data Structures

Phone directory is a sort of list. There are a few common data structures which are used by many different applications: - list, stack, queue, set, tree, graph etc.

Studying common data structures is another goal of this course.

Fall 2012

Data Structure

14

Abstract Date Type (ADT)

A major goal of software engineering is to make the program to have high modularity. High modularity makes the program easy - to understand, - to modify, - and to reuse. One way to achieve it is to encapsulate data element together with methods that operate on that data in a separate program module.

Fall 2012

Data Structure

15

Phone Directory data structure GUI

other components

operations lookup(); add(); remove();

Encapsulating data and operations means that nobody can access the data without passing through the operations it provides.

Phone Directory data structure


031-2453-2957 017-3456-2726 051-2345-2445

GUI

other components

operations lookup(); add(); remove();

Encapsulation makes it independent to other parts of the program. So, we can modify it without touching other parts of the program.

Abstract Date Type

Abstract Data Type (ADT)


- The combination of data structure together with related operations - An interface is a way to specify (but not implement) an ADT in Java. - A class provides one way to implement an ADT.

The user need not know about the implementation of the ADT A user interacts with the ADT using only public methods it provides.

Fall 2012

Data Structure

18

Abstract Date Type

In this course, we study a few abstract data types: - List, Stack, Queue, Tree, Graph, etc. Each ADT can have different implementations.
- For example, the list ADT can be implemented using an array, a linked list, or even a tree.

Understanding merits and demerits of different implementations of an ADT is another goal of this course.

Fall 2012

Data Structure

19

ABET

, , () /

, ,

Fall 2012

Data Structure

20