Docsity
Docsity

Prepare-se para as provas
Prepare-se para as provas

Estude fácil! Tem muito documento disponível na Docsity


Ganhe pontos para baixar
Ganhe pontos para baixar

Ganhe pontos ajudando outros esrudantes ou compre um plano Premium


Guias e Dicas
Guias e Dicas


Complexidade de Algorítmos Lista 8, Exercícios de Algoritmos e Programação

Apostilas de Complexidade de Algorítmos da Universidade Estadual de Campinas, Segundo Semestre de 2011, 8 Lista de Exercícios.

Tipologia: Exercícios

2013

Compartilhado em 03/12/2013

Salamaleque
Salamaleque 🇧🇷

4.5

(113)

201 documentos

1 / 1

Toggle sidebar

Esta página não é visível na pré-visualização

Não perca as partes importantes!

bg1
MO417 Complexidade de Algoritmos
Segundo Semestre de 2011
Oitava Lista de Exerc´
ıcios
´
Arvore Geradora M´
ınima
1. Let (u, v)be a minimum-weight edge in a graph G. Show that (u, v)belongs to some minimum
spanning tree of G.
2. Given a graph G and a minimum spanning tree T, suppose that we decrease the weight of one
of the edges not in T. Give an O(n)-time algorithm for finding the minimum spanning tree in
the modified graph.
3. Is the Fibonacci-heap implementation of Prim’s algorithm asymptotically faster than the binary-
heap implementation for a sparse graph G = (V, E), where |E|=Θ(V)? What about for a
dense graph, where |E|=Θ(V2)? How must |E|and |V|be related for the Fibonacci-heap
implementation to be asymptotically faster than the binary-heap implementation?
4. Suppose that all edge weights in a graph are integers in the range from 1 to |V|. How fast can
you make Kruskal’s algorithm run? What if the edge weights are integers in the range from 1to
Wfor some constant W?
5. Suppose that all edge weights in a graph are integers in the range from 1to |V|. How fast can
you make Prim’s algorithm run? What if the edge weights are integers in the range from 1to
Wfor some constant W?
6. Suppose that the edge weights in a graph are uniformly distributed over the half-open interval
[0,1). Which algorithm, Kruskal’s or Prim’s, can you make run faster?
7. Suppose that a graph G has a minimum spanning tree already computed. How quickly can the
minimum spanning tree be updated if a new vertex and incident edges are added to G?
8. Professor Toole proposes a new divide-and-conquer algorithm for computing minimum span-
ning trees, which goes as follows. Given a graph G = (V, E), partition the set V of vertices into
two sets V1and V2such that |V1|and |V2|differ by at most 1. Let E1be the set of edges that are
incident only on vertices in V1, and let E2be the set of edges that are incident only on vertices
in V2. Recursively solve a minimum-spanning-tree problem on each of the two subgraphs G1
=(V1, E1)and G2=(V2, E2). Finally, select the minimum-weight edge in E that crosses the
cut (V1, V2), and use this edge to unite the resulting two minimum spanning trees into a single
spanning tree.
Either argue that the algorithm correctly computes a minimum spanning tree of G, or provide
an example for which the algorithm fails.
1
docsity.com

Pré-visualização parcial do texto

Baixe Complexidade de Algorítmos Lista 8 e outras Exercícios em PDF para Algoritmos e Programação, somente na Docsity!

MO417 – Complexidade de Algoritmos

Segundo Semestre de 2011

Oitava Lista de Exerc´ıcios

´Arvore Geradora M´ınima

  1. Let (u, v) be a minimum-weight edge in a graph G. Show that (u, v) belongs to some minimum spanning tree of G.
  2. Given a graph G and a minimum spanning tree T, suppose that we decrease the weight of one of the edges not in T. Give an O(n)-time algorithm for finding the minimum spanning tree in the modified graph.
  3. Is the Fibonacci-heap implementation of Prim’s algorithm asymptotically faster than the binary- heap implementation for a sparse graph G = (V, E), where |E| = Θ(V )? What about for a dense graph, where |E| = Θ(V 2 )? How must |E| and |V | be related for the Fibonacci-heap implementation to be asymptotically faster than the binary-heap implementation?
  4. Suppose that all edge weights in a graph are integers in the range from 1 to |V |. How fast can you make Kruskal’s algorithm run? What if the edge weights are integers in the range from 1 to W for some constant W?
  5. Suppose that all edge weights in a graph are integers in the range from 1 to |V |. How fast can you make Prim’s algorithm run? What if the edge weights are integers in the range from 1 to W for some constant W?
  6. Suppose that the edge weights in a graph are uniformly distributed over the half-open interval [0, 1). Which algorithm, Kruskal’s or Prim’s, can you make run faster?
  7. Suppose that a graph G has a minimum spanning tree already computed. How quickly can the minimum spanning tree be updated if a new vertex and incident edges are added to G?
  8. Professor Toole proposes a new divide-and-conquer algorithm for computing minimum span- ning trees, which goes as follows. Given a graph G = (V, E), partition the set V of vertices into two sets V 1 and V 2 such that |V 1 | and |V 2 | differ by at most 1. Let E 1 be the set of edges that are incident only on vertices in V 1 , and let E 2 be the set of edges that are incident only on vertices in V 2. Recursively solve a minimum-spanning-tree problem on each of the two subgraphs G 1 = (V 1 , E 1 ) and G 2 = (V 2 , E 2 ). Finally, select the minimum-weight edge in E that crosses the cut (V 1 , V 2 ), and use this edge to unite the resulting two minimum spanning trees into a single spanning tree. Either argue that the algorithm correctly computes a minimum spanning tree of G, or provide an example for which the algorithm fails.

docsity.com