16. Greedy Algorithm (Huffman code)

Descripción

Algorithms and Data Structures | Test 3 Review | CSCI-3110-002 MTSU
Mena Sargios
Test por Mena Sargios, actualizado hace más de 1 año
Mena Sargios
Creado por Mena Sargios hace más de 7 años
197
1

Resumen del Recurso

Pregunta 1

Pregunta
What is the greedy algorithm(the 3 steps) to create an encoding tree to compress files?
Respuesta
  • 1. Assign each character to a node (making each a tree) and assign the frequency of the character as a weight. 2. Combine the two trees with the smallest weights as children into a new tree. Assign the weight of the new tree to the sum of the weights of it's children. 3. Repeat step 2 until all trees are combined.
  • none

Pregunta 2

Pregunta
What is the purpose of a greedy algorithm?
Respuesta
  • A.To find the shortage path
  • B.To find a cycle in a graph
  • C.All of the above
  • D.none of the above

Pregunta 3

Pregunta
Sometimes, a greedy algorithm dose not arrive at the optimal solution.
Respuesta
  • True
  • False

Pregunta 4

Pregunta
Dijkstra's Algorithim and Primm's Algorithim are both examples of which of the following?
Respuesta
  • A) Materialistic Algorithim
  • B) Simple Algorithim
  • C) Generous Algorithim
  • D) Greedy Algorithim

Pregunta 5

Pregunta
When you choose a path or route that minimizes the cost of the result.
Respuesta
  • Greedy algorithms
  • none

Pregunta 6

Pregunta
Huffman codes are primarily used to:
Respuesta
  • A. compress
  • B. encrpypt
  • C. find the shortest path between nodes
  • D. find a path touching all vertices once

Pregunta 7

Pregunta
What are the two major parts of Huffman Coding?
Respuesta
  • A. Deconstruct a Huffman tree from input characters and invert the Huffman Tree's codes
  • B. Build a Huffman tree from input characters and traverse the Huffman Tree and assign codes to characters
  • C. Build a Huffman tree from output characters and traverse the Huffman Tree and assign codes to specific lines
  • D. Deconstruct a Huffman tree from input characters and remove the Huffman Tree and assign codes

Pregunta 8

Pregunta
When creating a Huffman tree. Which of the following are the three steps needed to remember?
Respuesta
  • A.Characters are only stored at the leaves
  • B.Traversing to the left child, appends a 0
  • C.Traversing to the right child, appends a 1
  • D. Only B and C
  • E. A and B and C

Pregunta 9

Pregunta
Create a Huffman tree from the given frequency list: a b c d 20 15 40 23
Respuesta
  • Answer: 98 / \ c 35 / / \ d b a
  • none
Mostrar resumen completo Ocultar resumen completo

Similar

2. Red Black Tree
Mena Sargios
12. Graph Traversal
Mena Sargios
5. B-Tree
Mena Sargios
3. 2-3 Tree
Mena Sargios
7. Algorithm Growth Rate
Mena Sargios
4. 2-3-4 Tree
Mena Sargios
10. Hashing Collision
Mena Sargios
14. Graph Shrtest Path
Mena Sargios
15. Graph Spanning Tree
Mena Sargios
1. Trees Splay Trees
Mena Sargios
6. Algorithm Intro
Mena Sargios