Lower Bounds: Big-Omega () Notation
Let f(n) and g(n) be functions mapping PR+.
f(n) is (g(n) if there exist constants c > 0 (cR+) and n0P such
that for all n n0
f(n) cg(n).
We say that:
f(n) is at least order g(n)
f(n) is bounded from below by g(n)
f(n)
B+-Trees
(Note: This material is not in our two textbooks.)
Here is an example of a B+-tree containing 16 data entries. Observe
how the tree is structured. Can you see any similarities to binary
search trees? Any differences? What might B+-trees be used f
CPSC 221: Dictionaries (Maps, Tables) and Hashing
A dictionary (or map or table) is a collection of key/value pairs. In
general, the objects in a table have no fixed order and each object
is accessed by using the associated key.
For example, we could have
CPSC 221: Pigeonhole Principle
[Informal version] If k+1 pigeons fly into k pigeonholes, then some
pigeonhole contains at least 2 pigeons.
But, we dont know which pigeonhole contains the 2 or more
pigeons. Furthermore, we dont know how many pigeons are in
Priority Queues, Binary Heaps, and HeapSort
A priority queue is an abstract data type (ADT) that maintains
a set of items and supports the operations: Insert(item) and
RemoveMin (or RemoveMax).
Every item has a priority. RemoveMin returns an item of
small
Binary Trees
Suppose we want to search for data in a data structure. In an array,
we can use a linear search (an O(N) algorithm) or we can use binary
search (an O(lg N) algorithm).
In a linked list,
head
data1
data2
data3
data4
we can, again, use linear s
Binary Search Trees
A binary search tree (BST) is a binary tree such that for every node
v in the tree: (a) all of the keys (elements) in vs left subtree are
vs key, and (b) all of the keys in vs right subtree are vs key.
6
3
2
6
7
5
a binary search tree
CPSC 221Counting, Part 2: Permutations & Combinations
There are 4 kinds of situations in which we might want to choose a
number of objects from a pool of objects. For example, we might
choose r balls from a barrel containing n numbered or coloured balls.
CPSC 221: Counting
In CS, we often encounter situations where we want to count the
number of possible outcomes of an event. For example, we may
wish to determine: the number of possible paths to follow in a
directed network (graph), the number of possible
CPSC 221: Discrete Math & Data StructuresIntroduction
What is discrete math?
Examples of discrete objects include:
CPSC 221
What is meant by the term abstraction? (Think about why we
want to have an abstraction of discrete objects.)
Introduction, Sets, Fu
CPSC 221: Recursion (see pages 521-533 in the Nyhoff textbook)
The term recursion refers to the situation where a function calls
itself (usually on a smaller instance of the problem). As we explore
data structures, we will see that recursion is an extreme
CPSC 221Complexity
Complexity theory addresses the issue of how efficient an algorithm
is. Some measure of efficiency is needed to compare one algorithm
to another (assuming that both algorithms compute the same result).
What are some things that we can m
CPSC 221: Insertion Sort (starts at left side, re-orders out-ofplace entries)
3
-2
1
-4
15
12
Here, we are performing the insertion sort in place for an unsorted
array, putting each successive element into its appropriate place.
Once an array is sorted, t
CPSC 221Introduction to Data Structures: Arrays, SinglyLinked Lists, Stacks, Queues, Doubly-Linked Lists, Deques
When implementing data structures in C+, we often need to
consider pointers and addressing.
What are the differences among the following decla
An Introduction to Graph Theory
A graph G=(V,E) consists of: (a) a non-empty set of vertices V,
and (b) a set of edges E between pairs of those vertices. An edge
e E VV, where e=(u,v) and u,v V. We say that edge e is
incident on vertices u and v. Furtherm