Week 8 - An Application of Stacks and Queues
Using the Stack and Queue classes, write a program that takes an infix expression S
as input and converts S to the corresponding postfix expression S and t
Week 11: (Part I) - Dictionaries: Binary Search Trees
1
Dictionaries
A dictionary is a set of elements that supports the following operations:
insert a given element into the set
delete a specified
Week 10: Huffman Codes - An application of binary trees and priority queues1
An Application of Binary Trees and Priority
Queues:
Huffman Codes
This week, we consider an application of of binary trees
Week 7 - Stacks and Queues
1. A linked list has exactly n nodes. The elements in these nodes are
selected from the set cfw_0, 1, . . . , n. There are no duplicates in the list.
Design an O(n) worst ca
Week 13: Part II - Graph Search Algorithms
PROGRAMMING PROJECT:
Finding Connected Components and Cutpoints of a Graph
This project is concerned with finding the connected components of an undirected
g
Week 9: (Part I) - Trees and Binary Trees
HOMEWORK EXERCISES
1. The degree of a node in a tree is the number of children the node has. If a
tree has n1 nodes of degree 1, n2 nodes of degree 2, ., nm n
Week 11: (Part I) - Dictionaries: Binary Search Trees
HOMEWORK EXERCISES
1. Suppose that we have numbers between 1 and 1000 in a binary search tree and
want to search for the number 363. Which of the
Week 4 - Introduction to Algorithms and Complexity
1. Show that the following statements are true:
(a)
n(n1)
2
is O(n2 )
(b) max(n3 , 10n2 ) is O(n3 )
(c)
Pn
i=1
ik is O(nk+1 ) and (nk+1 ), for intege
Week 13: Part I - Graph Search Algorithms
PROGRAMMING PROJECT:
Finding Connected Components of a Graph
This project is concerned with finding the connected components of an undirected
graph. A graph i
Week 5 - Template Classes and Sequence Containers
PROGRAMMING PROJECT:
class IntegerNumber cfw_ . . . ;
Implement the IntegerNumber class so that the following user codes works:
IntegerNumber A;
/ Int
Week 11: (Part II) - Dictionaries: Hash Tables
HOMEWORK EXERCISES
1. Consider inserting the keys 10, 22, 31, 4, 15, 28, 17, 88, 59 into a closed hash
table of length m = 11 using the primary hashing f
Week 11: (Part II) - Dictionaries: Hash Tables
1
Hash Tables
We discussed the binary search tree implementation of dictionaries in the last section.
A binary serach tree supports operations such as in
Week 12: Graph Algorithms
1
Graph Algorithms
Graphs are very useful in representing arbitrary relationships among data objects.
There are two kinds of graphs: Directed graphs (also known as digraphs)
Week 8 - An Application of Stacks and Queues
1
Algebraic Expressions (infix, postfix, and prefix):
This week we discuss a major application of stacks. Though it is one of the well
known applications,
Week 4 - Introduction to Algorithms and Complexity
1
Algorithm Analysis
Some Definitions
We begin with informal definitions of a some important notions that are frequently
used in this lecture notes.
Week 6 - Linked Lists
1
LISTS
A list, is a sequence container that stores elements in a linear order. Lists are normally
implemented using a collection of linked nodes (objects).
The linked list consi
Week 13: Part II - Graph Search Algorithms
A Closer Look at Depth-First-Search
Input:
Adjacency list of a graph G = (V, E) and a start node s V .
Output:
For each node, the depth-first number (dfn) of
Week 9: (Part II) - Complete Binary Trees and Priority Queues
1
Priority Queues
A Priority queue is an important abstract data type that supports insertion of a new
item (Insert) and deleletion of the
Week 13: Part I - Graph Search Algorithms
1
Exploration of Graphs (Depth First Search and Breadth First Search)
A basic requirement for most graph algorithms is the systematic explo ration of a
graph
Week 9: (Part I) - Trees and Binary Trees
1
Binary Trees
The notion of a tree is an important concept in computing. Trees represent hierarchical relationships among elements of a set.
We begin with so