CS2210
Data Structures and Algorithms
Lecture 8: Binary Search Trees
<
2
1
6
9
>
4=
Instructor: Olga Veksler
8
Outline
Return to the ordered dictionary ADT
will spend the next 2-3 weeks on several different ways
of implementing an ordered dictionary ADT
O
CS210a Data Structures and Algorithms
Fall 2013
Assignment 3
Due date: October 23
Total of 20 Marks
Put your assignment in an envelope labelled with your name and course number and drop it in the CS2210 locker
(locker #302 located on the third oor of the
CS2210b: Data Structures and Algorithms
Winter 2014: Assignment 3(concept)
Solutions
1. Consider the algorithm AddSomething (A, n) :
Algorithm AddSomething(A,n)
Input: Array A and integer n. A has size at least n
if n < 1 return 0
else
temp 3 A[n 1] + Add
CS2210
Data Structures and Algorithms
Lecture11:Multiway and(2,4)Trees
9
257
2004Goodrich,Tamassia
10 14
Outline
Anewtypeofsearchtrees,Multiway Seach Tree
forordereddictionaryADT
Searchinginmultiway trees
(2,4)trees:specialcaseofmultiway trees
Heightprop
CS2210
Data Structures and Algorithms
Lecture 9: AVL TREES
definition, properties, insertion
6
v
8
3
z
4
BST Performance
For a binary search tree with n nodes and of height h
methods find, insert and remove take O(h) time
Height h is O(n) in the worst cas
CS2210
Data Structures and Algorithms
Lecture 2:
Analysis of Algorithms
Asymptotic notation
Instructor: Olga Veksler
2004 Goodrich, Tamassia
Outline
Comparing algorithms
Pseudocode
Theoretical Analysis of Running time
Primitive Operations
Counting primit
CS2210
Data Structures and Algorithms
Lecture 12 : B Trees
2004 Goodrich, Tamassia
Outline
B-tree
Special case of multiway search trees
used when data must be stored on the disk, i.e. too
large to fit in the memory
2
Reasons for using B-Trees
Accessing d
CS2210
Data Structures and Algorithms
Lecture 13 : Graphs
337
LAX
2004 Goodrich, Tamassia
43
17
1233
ORD
802
SFO
1843
DFW
Outline
Start a new data structure: Graphs
very common and very useful data structure
my favorite data structure
different graph tha
CS2210a: Data Structures and Algorithms
Winter 2013: Midterm Examination Solutions
110 minutes
Instructions:
Write your name in the space provided.
Please check that your exam is complete. It should have 13 pages in total
The examination has a total of
CS2210b: Data Structures and Algorithms
Winter 2014: Assignment 1 (concept)
Due: January 20
Solutions
1. (10%) Use the denition of big-O to prove that 12n5 + 0.5n4 log(n) is O(n5 ).
Solution: 12n5 + 0.5n4 log(n) 12n5 + 0.5n5
n 2. Therefore 12n5 + 0.5n4
1
CS2210
Data Structures and Algorithms
Lecture 1: Course Overview
Instructor: Olga Veksler
2004 Goodrich, Tamassia
What is this course about?
We will study moderately complex data structures
and algorithms that are essential in core areas of
computer scie
CS2210
Data Structures and Algorithms
Lecture 16 : Directed Graphs
BOS
ORD
JFK
SFO
DFW
LAX
MIA
Outline
Directed Graphs
Properties
Algorithms for Directed Graphs
DFS and BFS
Strong Connectivity
Transitive Closure
DAG and Topological Ordering
2
Digraphs
E
A
CS2210
Data Structures and Algorithms
Lecture15:BreadthFirstSearch
L0
L1
B
L2
2004Goodrich,Tamassia
A
C
E
D
F
Outline
BreadthFirstSearch(BFS)
ApplicationsofBFS
2
BFSAlgorithm
Exploresverticesandedgesinsystematicorder,goforbreadth
startatsomevertexv
explo
CS 2210 Data Structures and Algorithms
Fall 2013
Instructor
Roberto Solis-Oba
Lecture times: Tu 1:30-3:30 pm and Th 2:30-3:30 pm
Oce: MC417
Email: [email protected]
Oce hours: Monday and Thursday 3:30 pm to 5:00 pm
Additional oce hours on week when an assi
CS 2210 Data Structures and Algorithms
Fall 2013
Solution for Assignment I
1. To show that
2
n
+ 3 is O(1) we must nd constants c > 0 and n0 1 such that
2
+ 3 c 1 = c, n n0
n
We can simplify this inequality by moving 3 to the right-hand side to get
2
(c
Data Structures and ADTs
Abstract Data Types (ADTs) are user dened data types. An
ADT has 2 parts:
1. A name or type, specifying a set of data (e.g. Dictionary).
2. Descriptions of all the operations (or methods) that do things
with that type (e.g. find,
CS 2210a Data Structures and Algorithms
Assignment 1 (20 marks)
Due September 26
Put your assignment in a letter-size envelope labelled with your name and course number and drop
it in the CS2210 locker (the locker is on the third oor of the Middlesex Coll
CS2210
Data Structures and Algorithms
Lecture 9: AVL TREES
definition, properties, insertion
6
v
8
3
z
4
BST Performance
For a binary search tree with n nodes and of height h
methods find, insert and remove take O(h) time
Height h is O(n) in the worst cas
CS2210
Data Structures and Algorithms
Lecture 8: Binary Search Trees
<
2
1
6
9
>
4=
Instructor: Olga Veksler
8
Outline
Return to the ordered dictionary ADT
will spend the next 2-3 weeks on several different ways
of implementing an ordered dictionary ADT
O