basic concept

25
1 Basic concepts Basic concepts 2 Data structures Text book: E. Horowitz, S. Sahni, S. Anderson-freed, Fundamentals of data structures in C, Computer Science Press, 2nd edition, 2008. Reference books L. Nyhoff, C++ An introduction to data structures, Prentice-Hall, 1999. R. F. Gilberg and B. A. Forouzan, Data structures A pseudocode approach with C++, Brooks/Cole, 2001. Grading: Midterm test: 30% Final test: 30% Quiz 15% Homework 25% Three or four homework assignments with computer programs. http://140.121.196.191/ds.htm

Upload: praveen-kumar-g

Post on 29-Oct-2014

88 views

Category:

Documents


2 download

DESCRIPTION

basic concept

TRANSCRIPT

Basic concepts

Data structuresText book:

E. Horowitz, S. Sahni, S. Anderson-freed, Fundamentals of data structures in C, Computer Science Press, 2nd edition, 2008. L. Nyhoff, C++ An introduction to data structures, Prentice-Hall, 1999. R. F. Gilberg and B. A. Forouzan, Data structures A pseudocode approach with C++, Brooks/Cole, 2001. Midterm test: 30% Final test: 30% Quiz 15% Homework 25%

Reference books

Grading:

Three or four homework assignments with computer programs.

http://140.121.196.191/ds.htm

Basic concepts

2

1

Data structures and algorithmsThe design of a program include deciding

how to organize the data involved in a problem, and how to design algorithms for the operations on thedata.

Basic concepts

3

How to represent these data in your computer program?We are here!!

Road map Adopted from GoogleEarth

Can you find the shortest path from Keelung to Yungho?Basic concepts 4

2

A graph representation

How to represent this problem in your program? (contd)

a11 a 21 M a1000000,1

a12

L

a1000000, 2

x1 c1 a2,1000000 x2 c2 = M M M L a1000000,1000000 x1000000 c1000000 a1,1000000

How to efficiently represent and manipulate a huge system of linear equations

Basic concepts

6

3

How to represent these data in your computer program? (contd)

How to organize a huge amount of text data for efficient web searching

Basic concepts

7

Important data structuresArrays Linked Lists Stacks Queues Graphs

Priority queueBinary search trees Optimal binary search trees Selection trees 2-3 trees 2-3-4 trees Red-black trees AVL trees B/B+ trees Splay trees Tries Digital search trees

Adjacency matrices Adjacency lists Min-max heaps Deaps Leftist trees Binomial heaps Fibonacci heaps

Trees

Heaps

Sets Hash tables

Basic concepts

8

4

Algorithm specificationAn algorithm is a finite set of instructions that satisfies the following criteria.

1. 2. 3. 4. 5.

Input

Zero or more quantities are externally supplied. At least one quantity is produced. Each instruction must be clear and unambiguous. For all cases, the algorithm always terminates after a finite number of steps. The algorithm uses finite sources. Every instruction must be basic enough to be carried out.

Output Definiteness Finiteness

Effectiveness

A program does not have to satisfy the 4th criterion.e.g. an operating system.Basic concepts 9

ExampleProblem: Sort a collection of n integers. Simple solution:

From those unsorted integers, find the smallest and place it next in the sorted list. Selection sort

Transform this idea to an algorithmvoid sort(int* a, const int n) { int i,j,k,temp; for(i = 0; i