Algorithms - Mount Holyoke College

Download Report

Transcript Algorithms - Mount Holyoke College

CS312
Algorithms
Sami Rollins
[email protected]
Spring 2006
Introduction
• What is an algorithm?
• Why study algorithms?
• How do you evaluate an algorithm?
Administrative Information
•
•
•
•
Course Website
Syllabus
Academic Dishonesty
Calendar
http://www.mtholyoke.edu/courses/srollins/cs312/
Data Structures
• What is a data structure?
– “a scheme for organizing related pieces of
information.“ -http://www.webopedia.com/TERM/D/data_structure.html
• Typically describes the operations which
can be performed on the data and/or how
data are organized to support those
operations
• Example data structures?
– Array?
– Linked list?
Common Data Structures
• Stacks – Last In First Out (LIFO)
– Insert on top
– Remove top element
• Queues – First In First Out (FIFO)
– Insert at end
– Remove from beginning
• Trees - Hierarchy
– Root
– Parent
– Children
Choosing a Data Structure
• When would you use a…
– Stack?
– Queue?
– Tree?
Implementing Data Structures
• How would you implement a…
– Stack?
– Queue?
– Tree?