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 le
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
searc
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
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
pig
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
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,
h
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 rig
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
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 follo
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 a
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
da
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 compu
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
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 address
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 sa