SlideShare a Scribd company logo
1 of 27
Come on down!
• Take and fill out a survey
• Get a copy of lecture slides
• Please sit in the first 5 rows!
CSE 326: Data Structures
Lecture #1
Introduction
Alon Halevy
Spring Quarter 2001
Today’s Outline
• Administrative Stuff
• Overview of 326
• Survey
• Introduction to Complexity
Course Information
• Instructor: Alon Halevy <alon@cs>
Office hours: Wed. 4:30-5:30, 310 Sieg Hall
• TA: Maya Rodrig <rodrig@cs>
Office hours: Monday 1:30-2:30.
Meet in Sieg 226B
• TA (1/2) (and C++ expert): Nicholas Bone (bone@cs)
• Sections are held in: BLD 392, EE1 031.
• Text: Data Structures & Algorithm Analysis in C++,
2nd edition, by Mark Allen Weiss
Course Policies
• Several written homeworks
– Due at the start of class on due date
• Several programming projects
– Projects turned in electronically before 11pm on due date
• 10% penalty for 1 weekday late; afterward, NOT accepted
• Work in teams only on explicit team projects
• Grading
– homework: 25%
– projects: 25%
– midterm: 20%
– final: 30%
Course Mechanics
• 326 Web page: www/education/courses/326/01sp
• 326 course directory: /cse/courses/cse326
• 326 mailing list: cse326@cs.washington.edu
– subscribe to the mailing list using majordomo, see
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/g++
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?
Clever? Efficient?
Lists, Stacks, Queues
Heaps
Binary Search Trees
AVL Trees
Hash Tables
Graphs
Disjoint Sets
Insert
Delete
Find
Merge
Shortest Paths
Union
Data Structures Algorithms
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!
Anecdote #1
• N2 “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…
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
The Apocalyptic Laptop
Seth Lloyd, SCIENCE, 31 Aug 2000
1
100000
1E+10
1E+15
1E+20
1E+25
1E+30
1E+35
1E+40
1E+45
1E+50
1E+55
1E+60
1 10 100 1000
2^N
1.2^N
N^5
N^3
5N
Big Bang
Ultimate Laptop,
1 year
1 second
1000 MIPS,
since Big Bang
1000 MIPS,
1 day
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)
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!
A Second Hurdle
• Unix
Experience 1975 all over again!
– Try to login, edit, create a Makefile, and compile your
favorite “hello world” program right away
– Programming Project #1 distributed Wednesday
– Bring your questions and frustrations to Section on
Thursday!
A Third Hurdle: Templates
class Set_of_ints {
public:
insert( int x );
boolean is_member( int x ); … }
template <class Obj> class Set {
public:
insert( Obj x );
boolean is_member( Obj x ); … }
Set <int> SomeNumbers;
Set <char *> SomeWords;
In Every Silver Lining, There’s a Big
Dark Cloud – George Carlin
• Templates were invented 12 years ago, and still no
compiler correctly implements them!
• Using templates with multiple source files tricky
– See Course Web pages and TAs for best way
• MAINTAINING SANITY RULE
– Write/debug first without templates
– Templatize as need
– Keep it simple!
Handy Libraries
• From Weiss:
vector < int > MySafeIntArray;
vector < double > MySafeFloatArray;
string MySafeString;
• Like arrays and char*, but provide
– bounds checking
– memory management
• STL (Standard Template Library)
– most of CSE 326 in a box
– don’t use (unless told); we’ll be rolling our own
C++  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 C++ in class.
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!
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
• 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
Applications of the Q
• Hold jobs for a printer
• Store packets on network routers
• Make waitlists fair
• Breadth first search
Circular Array Q Data Structure
enqueue(Object x) {
Q[back] = x ;
back = (back + 1) % size }
b c d e f
Q
0 size - 1
front back
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?
Linked List Q Data Structure
b c d e f
front back
enqueue(Object x) {
back->next = new Node(x);
back = back->next; }
dequeue() {
saved = front->data;
temp = front;
front = front->next;
delete temp ;
return saved;}
What are tradeoffs?
• simplicity
• speed
• robustness
• memory usage
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

More Related Content

Similar to lecture1.ppt

lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.pptDevliNeeraj
 
UsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptUsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptvinu28455
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...Jose Quesada (hiring)
 
The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)
The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)
The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)EDB
 
Database Systems - Lecture Week 1
Database Systems - Lecture Week 1Database Systems - Lecture Week 1
Database Systems - Lecture Week 1Dios Kurniawan
 
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesFallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesSnehilKeshari
 
C++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of ClassC++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of ClassYogendra Rampuria
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop Kumar
 
Fundamentals of Programming in C++.ppt
Fundamentals of Programming in C++.pptFundamentals of Programming in C++.ppt
Fundamentals of Programming in C++.pptAamirShahzad527024
 
Tips & Tricks SQL in the City Seattle 2014
Tips & Tricks SQL in the City Seattle 2014Tips & Tricks SQL in the City Seattle 2014
Tips & Tricks SQL in the City Seattle 2014Ike Ellis
 

Similar to lecture1.ppt (20)

lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
geekgap.io webinar #1
geekgap.io webinar #1geekgap.io webinar #1
geekgap.io webinar #1
 
01_intro-cpp.ppt
01_intro-cpp.ppt01_intro-cpp.ppt
01_intro-cpp.ppt
 
01_intro-cpp.ppt
01_intro-cpp.ppt01_intro-cpp.ppt
01_intro-cpp.ppt
 
c++ ppt.ppt
c++ ppt.pptc++ ppt.ppt
c++ ppt.ppt
 
UsingCPP_for_Artist.ppt
UsingCPP_for_Artist.pptUsingCPP_for_Artist.ppt
UsingCPP_for_Artist.ppt
 
Ch1
Ch1Ch1
Ch1
 
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
 
The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)
The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)
The Land Sharks are on the Squawk Box (Where Did Postgres Come From?)
 
Database Systems - Lecture Week 1
Database Systems - Lecture Week 1Database Systems - Lecture Week 1
Database Systems - Lecture Week 1
 
linked list in c++
linked list in c++linked list in c++
linked list in c++
 
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queuesFallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
Fallsem2015 16 cp1699-20-jul-2015_rm01_stacks_and_queues
 
lecture02-cpp.ppt
lecture02-cpp.pptlecture02-cpp.ppt
lecture02-cpp.ppt
 
C++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of ClassC++ 11 Style : A Touch of Class
C++ 11 Style : A Touch of Class
 
Introduction to oop
Introduction to oop Introduction to oop
Introduction to oop
 
Lecture1
Lecture1Lecture1
Lecture1
 
Fundamentals of Programming in C++.ppt
Fundamentals of Programming in C++.pptFundamentals of Programming in C++.ppt
Fundamentals of Programming in C++.ppt
 
lecture4.pdf
lecture4.pdflecture4.pdf
lecture4.pdf
 
Tips & Tricks SQL in the City Seattle 2014
Tips & Tricks SQL in the City Seattle 2014Tips & Tricks SQL in the City Seattle 2014
Tips & Tricks SQL in the City Seattle 2014
 

Recently uploaded

Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 

Recently uploaded (20)

Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

lecture1.ppt

  • 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 Alon Halevy Spring Quarter 2001
  • 3. Today’s Outline • Administrative Stuff • Overview of 326 • Survey • Introduction to Complexity
  • 4. Course Information • Instructor: Alon Halevy <alon@cs> Office hours: Wed. 4:30-5:30, 310 Sieg Hall • TA: Maya Rodrig <rodrig@cs> Office hours: Monday 1:30-2:30. Meet in Sieg 226B • TA (1/2) (and C++ expert): Nicholas Bone (bone@cs) • Sections are held in: BLD 392, EE1 031. • Text: Data Structures & Algorithm Analysis in C++, 2nd edition, by Mark Allen Weiss
  • 5. Course Policies • Several written homeworks – Due at the start of class on due date • Several programming projects – Projects turned in electronically before 11pm on due date • 10% penalty for 1 weekday late; afterward, NOT accepted • Work in teams only on explicit team projects • Grading – homework: 25% – projects: 25% – midterm: 20% – final: 30%
  • 6. Course Mechanics • 326 Web page: www/education/courses/326/01sp • 326 course directory: /cse/courses/cse326 • 326 mailing list: cse326@cs.washington.edu – subscribe to the mailing list using majordomo, see 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/g++
  • 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 Structures Algorithms
  • 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. Anecdote #1 • N2 “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…
  • 11. 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
  • 12. The Apocalyptic Laptop Seth Lloyd, SCIENCE, 31 Aug 2000
  • 13. 1 100000 1E+10 1E+15 1E+20 1E+25 1E+30 1E+35 1E+40 1E+45 1E+50 1E+55 1E+60 1 10 100 1000 2^N 1.2^N N^5 N^3 5N Big Bang Ultimate Laptop, 1 year 1 second 1000 MIPS, since Big Bang 1000 MIPS, 1 day
  • 14. 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)
  • 15. 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!
  • 16. A Second Hurdle • Unix Experience 1975 all over again! – Try to login, edit, create a Makefile, and compile your favorite “hello world” program right away – Programming Project #1 distributed Wednesday – Bring your questions and frustrations to Section on Thursday!
  • 17. A Third Hurdle: Templates class Set_of_ints { public: insert( int x ); boolean is_member( int x ); … } template <class Obj> class Set { public: insert( Obj x ); boolean is_member( Obj x ); … } Set <int> SomeNumbers; Set <char *> SomeWords;
  • 18. In Every Silver Lining, There’s a Big Dark Cloud – George Carlin • Templates were invented 12 years ago, and still no compiler correctly implements them! • Using templates with multiple source files tricky – See Course Web pages and TAs for best way • MAINTAINING SANITY RULE – Write/debug first without templates – Templatize as need – Keep it simple!
  • 19. Handy Libraries • From Weiss: vector < int > MySafeIntArray; vector < double > MySafeFloatArray; string MySafeString; • Like arrays and char*, but provide – bounds checking – memory management • STL (Standard Template Library) – most of CSE 326 in a box – don’t use (unless told); we’ll be rolling our own
  • 20. C++  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 C++ in class.
  • 21. 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!
  • 22. 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
  • 23. • 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
  • 24. Applications of the Q • Hold jobs for a printer • Store packets on network routers • Make waitlists fair • Breadth first search
  • 25. Circular Array Q Data Structure enqueue(Object x) { Q[back] = x ; back = (back + 1) % size } b c d e f Q 0 size - 1 front back 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?
  • 26. Linked List Q Data Structure b c d e f front back enqueue(Object x) { back->next = new Node(x); back = back->next; } dequeue() { saved = front->data; temp = front; front = front->next; delete temp ; return saved;} What are tradeoffs? • simplicity • speed • robustness • memory usage
  • 27. 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