CS105-L1-Intro

Download Report

Transcript CS105-L1-Intro

Introduction
CS 105
1
Why study data structures and
algorithms?



Programs solve problems
Programs process information
Information needs to be organized


Programs carry out tasks


Data structures
Algorithms
Data structures and algorithms need to
be correct and efficient
2
Data structure


A systematic way of organizing and accessing
data
Examples



Dictionary: words and definitions are arranged for
convenient lookup
Queue: data is arranged so that insertion and
removal follow the “first-in, first-out” rule
Data structures are often components of
larger programs
3
Algorithm


A step-by-step procedure for performing
some task in a finite amount of time
Properties of an algorithm




It must correctly solve a problem; i.e. produce the
correct output from its given input
Its instructions must be clear and unambiguous
It must terminate
Contrast an algorithm from a program
4
“Good” data structures and
algorithms

Objectives of this course:



Design and recognize good data structures and
algorithms
Be able to write complex programs (in Java) that
implement algorithms and employ data structures
This entails the analysis and comparison of


Different algorithms that solve a problem
Different implementations of a data structure
5