Algorithm Analysis
(log n)
Carlos Moreno
(n)
(1)
cmoreno @ uwaterloo.ca
EIT4103
https:/ece.uwaterloo.ca/~cmoreno/ece250
Algorithm Analysis
Standard reminder to set phones to
silent/vibrate mode, please!
Algorithm Analysis
Previously, on ECE250.
We looke
Algorithm s and Data Structures
ECE 250  Fall 2014
Tutorial 8
November 17, 2014
Solution Set
ECE 250
Tutorial 8
1
Solution to Question 1:
BBT(i, j ) = e E biebTej = e E biebje
If i = j, then biebje = 1 (it is 1*1 or (1)*(1) whenever e enters or leaves
Algorithm s and Data Structures
ECE 250  Fall 2014
Tutorial 4
October 6 , 2014
Solution Set
ECE 250
Tutorial 4
1
Solution to Question 1:
If we have an array of length n, then during the last reallocation, we copied n d
elements and increased the size of
Algorithm s and Data Structures
ECE 250  Fall 2014
Tutorial 5
October 27 , 2014
Solution Set
ECE 250
Tutorial 5
1
Solution to Question 1:
Let x be a node with two children. In an inorder tree walk, the nodes in xs left subtree
immediately preceed x and
ECE 250 : Algorithms and Data Structures
Tutorial 10 December 1, 2014
Question 1
(k
The FloydWarshall algorithm requires (n 3 ) space, since we compute dij ) for
i, j, k = 1, 2,., n . Show that the following procedure, which simply drops all the
superscr
ECE 250 : Algorithms and Data Structures
Tutorial 4 October 6 , 2014
Question 1
A computer program reads the input symbol into an array in memory, adding symbols to the end
of the array until the endoffile symbol is met. The number of input symbols is n
Algorithm s and Data Structures
ECE 250  Fall 2014
Tutorial 3
September 2 9, 2014
Solution Set
ECE 250
Tutorial 3
1
Solution to Question 1:
a) To show that (n + a)b = (nb ) , we want to find constant c1, c2 , and n0 > 0 such that
0 c1n b (n + a)b c2 n b
ECE 250 : Algorithms and Data Structures
Tutorial 3 September 29 , 2014
Question 1
Using the definition of big oh or theta, solve the followings:
a) Show that for any real constants a and b , where b 0 , (n + a)b = (nb ) .
b) Is 2n+1 = (2n ) ?
c) Is 22n =
ECE 250 : Algorithms and Data Structures
Tutorial 6 November 3 , 2014
Question 1
Write an O (n) algorithm to determine whether the contents of an array of integers form a
binary max heap. Your algorithm should take an array of integers a of arbitrary leng
ECE250:
Algorithms and Data Structures
Hash Tables (Part B)
Ladan Tahvildari, PEng, SMIEEE
Associate Professor
Software Technologies Applied Research (STAR) Group
Dept. of Elect. & Comp. Eng.
University of Waterloo
Materials from CLRS: Chapter 11.3, 11.4
ECE250:
Algorithms and Data Structures
Hash Tables (Part A)
Ladan Tahvildari, PEng, SMIEEE
Associate Professor
Software Technologies Applied Research (STAR) Group
Dept. of Elect. & Comp. Eng.
University of Waterloo
Materials from CLRS: Chapter 11.1, 11.2,
Algorithm s and Data Structures
ECE 250  Fall 2014
Tutorial 10
December 1 , 2014
Solution Set
ECE 250
Tutorial 10
1
Solution to Question 1 :
(
)
(
(
(
(
With the superscripts, the computation is dijk ) min dijk 1) , dikk 1) + d kjk 1) . If, having
droppe
ECE250:
Algorithms and Data Structures
Elementary Data Structures
Ladan Tahvildari, PEng, SMIEEE
Associate Professor
Software Technologies Applied Research (STAR) Group
Dept. of Elect. & Comp. Eng.
University of Waterloo
Materials from CLRS: Chapter 10.1,
ECE250:
Algorithms and Data Structures
Solving Recurrences (Master Theorem Case 2 & 3)
Ladan Tahvildari, PEng, SMIEEE
Associate Professor
Software Technologies Applied Research (STAR) Group
Dept. of Elect. & Comp. Eng.
University of Waterloo
Materials fro
ECE 250 : Algorithms and Data Structures
Tutorial 5 October 27, 2014
Question 1
Show that if a node in a binary search tree has two children, then its successor has no left
child and its predecessor has no right child.
Question 2
An alternative method of
ECE 250 : Algorithms and Data Structures
Tutorial 9 N ovember 24 , 2014
Question 1
Let G = (V, E) be a weighted, directed graph with nonnegative weight function
: E cfw_0,1,.,W for some nonnegative integer W. Modify Dijkstras algorithm to
compute the
Asymptotic Analysis
Carlos Moreno
cmoreno @ uwaterloo.ca
EIT4103
https:/ece.uwaterloo.ca/~cmoreno/ece250
Asymptotic Analysis
Today's class:
Introduce and justify the notion of Asymptotic
Analysis.
Introduce Asymptotic notation (Landau symbols).
Look at s
Proofs and Mathematical Induction
N
log k
e
x 2
dx
0
k =0
Carlos Moreno
cmoreno @ uwaterloo.ca
a+ba+b
i
e 1 = 0
EIT4103
https:/ece.uwaterloo.ca/~cmoreno/ece250
Proofs and Mathematical Induction
Standard reminder to set phones to
silent/vibrate mode, ple
Mathematical Proofs
N
log k
e
x 2
dx
0
k =0
Carlos Moreno
cmoreno @ uwaterloo.ca
a+ba+b
i
e 1 = 0
EIT4103
https:/ece.uwaterloo.ca/~cmoreno/ece250
Mathematical Proofs
Standard reminder to set phones to
silent/vibrate mode, please!
Mathematical Proofs
Tod
Welcome to ECE250 !
Carlos Moreno
cmoreno @ uwaterloo.ca
EIT4103
https:/ece.uwaterloo.ca/~cmoreno/ece250
About the course
The instructor .
About the course
The instructor . (blah blah going on while you
read this .
About the course
The instructor . (bla
Mathematical Background
N
log k
e
x 2
dx
0
k =0
Carlos Moreno
cmoreno @ uwaterloo.ca
a+ba+b
i
e 1 = 0
EIT4103
https:/ece.uwaterloo.ca/~cmoreno/ece250
Mathematical Background
Standard reminder to set phones to
silent/vibrate mode, please!
Mathematical Ba
2011 by Douglas Wilhelm Harder. All rights reserved.
ECE 250 Algorithms and Data Structure
Department of Electrical and Computer Engineering
University of Waterloo
Please send any comments or criticisms to dwharder@alumni.uwaterloo.ca
with the subject EC
2011 by Douglas Wilhelm Harder. All rights reserved.
ECE 250 Algorithms and Data Structure
Department of Electrical and Computer Engineering
University of Waterloo
Please send any comments or criticisms to dwharder@alumni.uwaterloo.ca
with the subject EC
2011 by Douglas Wilhelm Harder. All rights reserved.
ECE 250 Algorithms and Data Structure
Department of Electrical and Computer Engineering
University of Waterloo
Please send any comments or criticisms to dwharder@alumni.uwaterloo.ca
with the subject EC
2011 by Douglas Wilhelm Harder. All rights reserved.
ECE 250 Algorithms and Data Structure
Department of Electrical and Computer Engineering
University of Waterloo
Please send any comments or criticisms to dwharder@alumni.uwaterloo.ca
with the subject EC
2011 by Douglas Wilhelm Harder. All rights reserved.
ECE 250 Algorithms and Data Structure
Department of Electrical and Computer Engineering
University of Waterloo
Please send any comments or criticisms to dwharder@alumni.uwaterloo.ca
with the subject EC
2011 by Douglas Wilhelm Harder. All rights reserved.
ECE 250 Algorithms and Data Structure
Department of Electrical and Computer Engineering
University of Waterloo
Please send any comments or criticisms to dwharder@alumni.uwaterloo.ca
with the subject EC
Algorithm s and Data Structures
ECE 250  Fall 2014
Tutorial 9
November 24 , 2014
Solution Set
ECE 250
Tutorial 9
1
Solution to Question 1:
Observe that if a shortestpath estimate is not , then its at most (V  1)W. Why? In
order to have d[v] < , we must
Index of /~talguind/ece250/tutorials/secondC+
Name
Last modified
Parent Directory
Size Description

C+TutorialTiuleyPart2.pdf
22Sep2014 14:15 602K
samples/
22Sep2014 14:17

ECE 250 Algorithms and Data Structures
A Brief Introduction to C+
Douglas Wilhelm Harder
Department of Electrical and Computer Engineering
University of Waterloo
Waterloo, Ontario, Canada
Copyright 20069 by Douglas Wilhelm Harder. All rights reserved.
In
ECE 250 Algorithms and Data Structures
Binary Heaps
Douglas Wilhelm Harder
Department of Electrical and Computer Engineering
University of Waterloo
Waterloo, Ontario, Canada
Copyright 20069 by Douglas Wilhelm Harder. All rights reserved.
Binary Heaps
Out
ECE 250 Algorithms and Data Structures
A Brief Introduction to C+
Douglas Wilhelm Harder
Department of Electrical and Computer Engineering
University of Waterloo
Waterloo, Ontario, Canada
Copyright 20069 by Douglas Wilhelm Harder. All rights reserved.
In
ECE 250 Algorithms and Data Structures
Mapping Down to 0, ., M 1
Douglas Wilhelm Harder
Department of Electrical and Computer Engineering
University of Waterloo
Waterloo, Ontario, Canada
Copyright 20069 by Douglas Wilhelm Harder. All rights reserved.
Map
ECE 250 Algorithms and Data Structures
Mathematical Background
Douglas Wilhelm Harder
Department of Electrical and Computer Engineering
University of Waterloo
Waterloo, Ontario, Canada
Copyright 20069 by Douglas Wilhelm Harder. All rights reserved.
Mathe