Mena Sargios
Quiz por , criado more than 1 year ago

Algorithms and Data Structures | Test 3 Review | CSCI-3110-002 MTSU

214
1
0
Mena Sargios
Criado por Mena Sargios quase 8 anos atrás
Fechar

16. Greedy Algorithm (Huffman code)

Questão 1 de 9

1

What is the greedy algorithm(the 3 steps) to create an encoding tree to compress files?

Selecione uma das seguintes:

  • 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

Explicação

Questão 2 de 9

1

What is the purpose of a greedy algorithm?

Selecione uma das seguintes:

  • A.To find the shortage path

  • B.To find a cycle in a graph

  • C.All of the above

  • D.none of the above

Explicação

Questão 3 de 9

1

Sometimes, a greedy algorithm dose not arrive at the optimal solution.

Selecione uma das opções:

  • VERDADEIRO
  • FALSO

Explicação

Questão 4 de 9

1

Dijkstra's Algorithim and Primm's Algorithim are both examples of
which of the following?

Selecione uma das seguintes:

  • A) Materialistic Algorithim

  • B) Simple Algorithim

  • C) Generous Algorithim

  • D) Greedy Algorithim

Explicação

Questão 5 de 9

1

When you choose a path or route that minimizes the cost of the result.

Selecione uma das seguintes:

  • Greedy algorithms

  • none

Explicação

Questão 6 de 9

1

Huffman codes are primarily used to:

Selecione uma das seguintes:

  • A. compress

  • B. encrpypt

  • C. find the shortest path between nodes

  • D. find a path touching all vertices once

Explicação

Questão 7 de 9

1

What are the two major parts of Huffman Coding?

Selecione uma das seguintes:

  • 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

Explicação

Questão 8 de 9

1

When creating a Huffman tree. Which of the following are the three steps needed to remember?

Selecione uma das seguintes:

  • 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

Explicação

Questão 9 de 9

1

Create a Huffman tree from the given frequency list:

a b c d
20 15 40 23

Selecione uma das seguintes:

  • Answer:

    98
    / \
    c 35
    / / \
    d b a

  • none

Explicação