Presentation is loading. Please wait.

Presentation is loading. Please wait.

Come on down! Take and fill out a survey Get a copy of lecture slides Please sit in the first 5 rows!

Similar presentations


Presentation on theme: "Come on down! Take and fill out a survey Get a copy of lecture slides Please sit in the first 5 rows!"— Presentation transcript:

1 Come on down! Take and fill out a survey Get a copy of lecture slides Please sit in the first 5 rows!

2 CSE 326: Data Structures Lecture #1 Introduction Dan Suciu Winter Quarter 2003

3 Today’s Outline Administrative Stuff Overview of 326 Survey Introduction to Complexity

4 Course Information Instructor: Dan Suciu Office hours: Mon. 2:30-3:30, 318 Sieg Hall TA: Nilesh Dalvi Office hours: TBA. TA (1/2): Adam Fuchs (afuchs@cs) Sections are held in: BLD 392, MEB 243. Text: Data Structures & Algorithm Analysis in Java 2 nd edition, by Mark Allen Weiss

5 Course Policies Written homeworks –Due at the start of class on due date Programming projects –Turned in electronically before 11pm on due date to Nilesh Dalvi No late homeworks accepted Work in teams only on explicit team projects –See website Grading –Weekly assignments:50% –Midterm:20% –Final:30%

6 Course Mechanics 326 Web page: www/education/courses/326/03wi 326 course directory: /cse/courses/cse326 326 mailing list: cse326@cs.washington.edu –subscribe using instructions on the homepage Course labs are 232 and 329 Sieg Hall –lab has NT machines w/X servers to access UNIX All programming projects graded on UNIX in java (preferred) or gcc –OK to develop using other tools (e.g. under Windows) but make sure you test under UNIX

7 What is this Course About? Clever ways to organize information in order to enable efficient computation –What do we mean by clever? –What do we mean by efficient?

8 Clever? Efficient? Lists, Stacks, Queues Heaps Binary Search Trees AVL Trees Hash Tables Graphs Disjoint Sets Insert Delete Find Merge Shortest Paths Union Data StructuresAlgorithms

9 Used Everywhere! Mastery of this material separates you from: Systems Theory Graphics AI Applications Perhaps the most important course in your CS curriculum! Guaranteed non-obsolescence!

10 Example 1 Towers of Hanoi: http://www.cut-the-knot.com/recurrence/hanoi.shtml or http://www.mazeworks.com/hanoi/ http://www.cut-the-knot.com/recurrence/hanoi.shtml http://www.mazeworks.com/hanoi/ Question to class: how long will it run for n = 10 n = 20 n = 50 n = 100

11 Example 1 How many moves do we need to solve it for some n ? T(1) = 1 T(n) = T(n-1) + 1 + T(n-1) = 2 T(n-1) + 1 It follows that T(n) = (2 n – 1)T, where T=T(1) (why ?) We know T(6) = 1 second Running times are (approximate): n = 10  T(10)  2 4 seconds = 16 seconds n = 20  T(20)  2 14 seconds = over one hour n = 50  T(50)  2 44 seconds  10 14 seconds  3 million years n = 100  T(100)  2 94 seconds  10 30 seconds (only 3 10 17 seconds since Big Bang !)

12 Example 2 n 2 “pretty print” routine nearly dooms major expert system project at AT&T –10 MB data = 10 days (100 MIPS) –programmer was brilliant, but he skipped 326…

13 Asymptotic Complexity Our notion of efficiency: How the running time of an algorithm scales with the size of its input –several ways to further refine: worst case average case amortized over a series of runs

14 Asymptotic Complexity This course is about asymptotic complexity –Deals with algorithms, and their analysis It is not about better coding –Does not deal with coding details I don’t need to take 326 because: I can buy a faster laptop I can write very good code

15 The Apocalyptic Laptop Seth Lloyd, SCIENCE, 31 Aug 2000 5.4 x 10 50 operations per second

16 What a Better Laptop Buys You 1 year 1 second Since Big Bang 1 day Ultimate Laptop, Today’s laptop (1000MIPS) Not much...

17 What Better Coding Buys You 1 year 1 second Ultimate Laptop, Ten times faster buys you… …nothing Since Big Bang 1 day Today’s laptop (1000MIPS)

18 Specific Goals of the Course Become familiar with some of the fundamental data structures in computer science Improve ability to solve problems abstractly –data structures are the building blocks Improve ability to analyze your algorithms –prove correctness –gauge (and improve) time complexity Become modestly skilled with the UNIX operating system (you’ll need this in upcoming courses)

19 One Preliminary Hurdle 1.Recall what you learned in CSE 321 … –proofs by mathematical induction –proofs by contradiction –formulas for calculating sums and products of series –recursion Know Sec 1.1 – 1.4 of text by heart!

20 A Second Hurdle 2.Unix Experience 1975 all over again! –Try to login, edit, create a Makefile, and compile your favorite “hello world” program right away –Programming Assignment 0 due next Monday –Bring your questions and frustrations to Section on Thursday!

21 A Third Hurdle: Java Public class Set_of_ints { Public void insert( int x ); Public void remove( int x ); … } Review the syntax Run your first program (assignment 0)

22 Handy Library From Weiss: http://www.cs.fiu.edu/~weiss/dsaajava/code/ most of CSE 326 in a box –don’t use (unless told); we’ll be rolling our own

23 Java  Data Structures One of the all time great books in computer science: The Art of Computer Programming (1968-1973) by Donald Knuth Examples in assembly language (and English)! American Scientist says: in top 12 books of the CENTURY! Very little about Java in class.

24 Abstract Data Types Data Types integer, array, pointers, … Abstract Data Type (ADT) Mathematical description of an object and the set of operations on the object Algorithms binary search, quicksort, … tradeoffs!

25 ADT Presentation Algorithm Present an ADT Motivate with some applications Repeat until it’s time to move on: –develop a data structure and algorithms for the ADT –analyze its properties efficiency correctness limitations ease of programming Contrast strengths and weaknesses

26 Queue operations –create –destroy –enqueue –dequeue –is_empty Queue property: if x is enQed before y is enQed, then x will be deQed before y is deQed FIFO: First In First Out First Example: Queue ADT F E D C B enqueue dequeue G A

27 Applications of the Q Hold jobs for a printer Store packets on network routers Make waitlists fair Breadth first search

28 Circular Array Q Data Structure enqueue(Object x) { Q[back] = x ; back = (back + 1) % size } bcdef Q 0 size - 1 frontback dequeue() { x = Q[front] ; front = (front + 1) % size; return x ; } How test for empty list? How to find K-th element in the queue? What is complexity of these operations? Limitations of this structure?

29 Linked List Q Data Structure bcdef frontback enqueue(Object x) { back.next = new Node(x); back = back.next; } dequeue() { saved = front.data; temp = front; front = front.next; return saved;} What are tradeoffs? simplicity speed robustness memory usage

30 To Do Return your survey before leaving! Sign up on the cse326 mailing list Check out the web page Log on to the PCs in course labs and access an instructional UNIX server Read Chapters 1 and 2 in the book


Download ppt "Come on down! Take and fill out a survey Get a copy of lecture slides Please sit in the first 5 rows!"

Similar presentations


Ads by Google