6
CHAPTER
3
33
3
The List
Data Model
Like trees, lists are among the most basic of data models used in computer programs.
Lists are, in a sense, simple forms of trees, because one can think of a list as a binary
tree in which every left child is a leaf. H
5
CHAPTER
3
33
3
The Tree
Data Model
There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that
models hierarchical structure is called a tree and this
4
CHAPTER
Combinatorics
and
Probability
3
33
3
In computer science we frequently need to count things and measure the likelihood
of events. The science of counting is captured by a branch of mathematics called
combinatorics. The concepts that surround att
CHAPTER
3
3 33 3
The Running Time of Programs
In Chapter 2, we saw two radically dierent algorithms for sorting: selection sort and merge sort. There are, in fact, scores of algorithms for sorting. This situation is typical: every problem that can be solv
2
CHAPTER
Iteration,
Induction,
and
Recursion
3
33
3
The power of computers comes from their ability to execute the same task, or
dierent versions of the same task, repeatedly. In computing, the theme of iteration
is met in a number of guises. Many concep
CHAPTER
3
33
3
Abstraction
Exam
scheduling
1
Computer Science:
The Mechanization
of Abstraction
Though it is a new eld, computer science already touches virtually every aspect
of human endeavor. Its impact on society is seen in the proliferation of comput
6
CHAPTER
3
33
3
The List
Data Model
Like trees, lists are among the most basic of data models used in computer programs.
Lists are, in a sense, simple forms of trees, because one can think of a list as a binary
tree in which every left child is a leaf. H
5
CHAPTER
3
33
3
The Tree
Data Model
There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that
models hierarchical structure is called a tree and this
4
CHAPTER
Combinatorics
and
Probability
3
33
3
In computer science we frequently need to count things and measure the likelihood
of events. The science of counting is captured by a branch of mathematics called
combinatorics. The concepts that surround att
CHAPTER
3
3 33 3
The Running Time of Programs
In Chapter 2, we saw two radically dierent algorithms for sorting: selection sort and merge sort. There are, in fact, scores of algorithms for sorting. This situation is typical: every problem that can be solv
2
CHAPTER
Iteration,
Induction,
and
Recursion
3
33
3
The power of computers comes from their ability to execute the same task, or
dierent versions of the same task, repeatedly. In computing, the theme of iteration
is met in a number of guises. Many concep
CHAPTER
3
33
3
Abstraction
Exam
scheduling
1
Computer Science:
The Mechanization
of Abstraction
Though it is a new eld, computer science already touches virtually every aspect
of human endeavor. Its impact on society is seen in the proliferation of comput
Practice Problems 6
1. Evaluate the following postfix expressions using a stack
a. 5 3 + 2 *
b. 8 1
c. 8 2 / 1 5 + 3 * +
d. 1 2 3 4 5 + + + +
e. 1 2 + 3
2. Determine a longest common subsequenc