Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 . Let Q be an implementation of a min priority queue where: - Q . Init ( ) takes Theta ( 1 )
Let Q be an implementation of a min priority queue where:
QInit takes Theta time. Initially, Q has elements.
QInsertx takes Theta logs time where s is the number of elements in Q QInsert adds one element to Q
QDeleteMin takes Theta s time where s is the number of elements in Q
QDeleteMin removes one element from Q
Consider the following procedure whose input is an undirected graph G Edges GE are represented by an adjacency LIST.
weightvi vj is a positive weight assigned to edge vi vj
weightvi is a positive weight assigned to vertex vi
ProcG
QInit;
foreach vertex vi of GV do
foreach edge vi vj incident on vi do
QInsertweightvi weightvi vj;
end
end
y ;
for each vertex vi of GV do
if QSize then
y y QDeleteMin;
end
end
return y;
Let n be the number of vertices of G and let m be the number of edges of G
For this problem, assume that m n
a Analyze lines of Proc giving a bound on their asymptotic running time in terms of n and m
b Analyze lines of Proc giving a bound on their asymptotic running time in terms of n and m
Note: Assume that m n
c Give the asymptotic running time of Proc in terms of n and mLet be an implementation of a min priority queue where:
QInit takes time. Initially, Q has elements.
QInsert takes time where is the number of elements in Q QInsert adds one
element to
QDeleteMin takes time where is the number of elements in
QDeleteMin removes one element from
Consider the following procedure whose input is an undirected graph G Edges GE are represented by
an adjacency LIST.
weight is a positive weight assigned to edge
weight is a positive weight assigned to vertex
Let be the number of vertices of and let be the number of edges of
For this problem, assume that
a Analyze lines of Proc giving a bound on their asymptotic running time in terms of and
b Analyze lines of Proc giving a bound on their asymptotic running time in terms of and
Note: Assume that
c Give the asymptotic running time of Proc in terms of and
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started