What is CS171 about
- CS 171 is a
continuation of
CS 170:
- Problem solving
using
computer programs
|
- What exactly is a
computer program ?
(Text book
by Niklaus Wirth)
-
Algorithms ---
steps used
to solve problems
-
Data structures
---
efficient
information storage of
information
used by the
algorithms
|
|
What is an
algorithm ?
- Algorithm:
- Algorithm = a
method for
solving a problem
expressed
as a
sequence of steps
that is suitable for
execution by a
computer (machine)
|
- Different ways to
express
algorithms:
- Natural languages
(bad -
ambiguous)
- Flow charts
(good for
conceptualization of the
algorithm)
- Pseudo code
(good for
algorithm development !)
- Programming languages
(good for
communicating the
algorithm to
a
machine (computer)
-- because it's
unambiguous)
|
|
What is a
data structure ?
- Data structure:
- Data structure =
a way to
organize
(=
insert,
delete and
retrieve)
the data
used by an algorithm
|
-
Think:
- The data structure you
learned in
CS 170:
array
|
Strength and
weakness of the
array
data structures
- Every
data structure has
its
strengths and
its
weaknesses
- Array:
- The data is stored in
consecutive
array elements
- The array elements are
accessed efficiently using
an index
|
-
Strength:
efficient (low) storage cost
-
Weakness:
not
dynamic (cannot increase
in size easily)
|
What's more important:
algorithm
or data structure ?
- Quote from a
well-known
system programmer
Linus Torvalds
(creator of Linux):
- In CS 171, you will
learn some
basic
data structures
- In CS 253, you will
learn more
advanced
data structures
|
Measure
the "goodness"
of algorithms/data structures
- in CS 171, you will also
analyze
algorithms
- Is one algorithm
better than
another
algorithm ??
|
- Metrics used to
measure the
goodness of
algorithms:
-
Running time --
how long does it take
for the program to
finish
-
Storage requirment
-- how much memory does
the
program use to
store
its information)
|
- In CS 171,
we will:
- Study how to
categorize
algorithms by their
running time
- Study
running time of
various algorithms
|
|
❮
❯