Introduction CptS 223 Advanced Data Structures Larry Holder - - PowerPoint PPT Presentation

introduction
SMART_READER_LITE
LIVE PREVIEW

Introduction CptS 223 Advanced Data Structures Larry Holder - - PowerPoint PPT Presentation

Introduction CptS 223 Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University 1 Advanced Data Structures Why not just use a big array? Example problem Search


slide-1
SLIDE 1

1

Introduction

CptS 223 – Advanced Data Structures Larry Holder School of Electrical Engineering and Computer Science Washington State University

slide-2
SLIDE 2

2

Advanced Data Structures

“Why not just use a big array?” Example problem

Search for a number k in a set of N numbers

Solution

Store numbers in an array of size N Iterate through array until find k Number of checks

Best case: 1 (k= 15) Worst case: N (k= 27) Average case: N/2

15 10 22 3 12 19 27

slide-3
SLIDE 3

3

Advanced Data Structures

Solution # 2

Store numbers in a binary search tree Search tree until find k Number of checks

Best case: 1 (k= 15) Worst case: log2 N (k= 27) Average case: (log2 N) / 2

15 22 27 19 10 12 3

slide-4
SLIDE 4

4

Analysis

Does it matter?

N vs. (log2 N)

10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90 100 N Number of Checks N log2 N

slide-5
SLIDE 5

5

Analysis

Does it matter? Assume

N = 1,000,000,000

1 billion (Walmart transactions in 100 days)

1 Ghz processor = 109 cycles per second

Solution # 1 (10 cycles per check)

Worst case: 1 billion checks = 10 seconds

Solution # 2 (100 cycles per check)

Worst case: 30 checks = 0.000003 seconds

slide-6
SLIDE 6

6

Advanced Data Structures

Moral

Appropriate data structures ease design

and improve performance

Challenge

Design appropriate data structure and

associated algorithms for a problem

Analyze to show improved performance

slide-7
SLIDE 7

7

Course Overview

Advanced data structures

Trees, hash tables, heaps, disjoint sets,

graphs

Algorithm development and analysis

Insert, delete, search, sort

Applications Object-oriented implementation in C+ +

slide-8
SLIDE 8

Course Details

Course website

www.eecs.wsu.edu/~ holder/courses/CptS223.html

Email list

Homework 0: Send me your name and

email address

8

To: holder@wsu.edu Subject: Student in 223 Name: … Email: …