Computers and Technology, 20.01.2020 16:31 brainewashed11123
Me with my assigment
in the given code we are using two classes and two functions. the first class heapnode_min will consist of data members and a constructor. the second class analyze will consist of a function which will compare two heap nodes and will return the result. we are also using display function to print the codes of huffman tree from the root. hcodes function is used to build a huffman tree, this function is using two while loops and at the end it calls display_codes function. in main function we are using two arrays, one for frequency and the second one for alphabets. we are using size_of variable to store the size of data types after their division. at the end of the main function we will call hcodes function.
#include
using namespace std;
class heapnode_min { // tree node of huffman
public:
//add data members here.
heapnode_min(char d, unsigned f)
{
//complete the body of heapnode_min function
}
};
class analyze { // two heap nodes comparison
public:
bool * l, heapnode_min* r)
{
(l-> f > r-> f); //complete this statement
}
};
void display_codes(heapnode_min* root, string s) // to print codes of huffman tree from the root.
{
if (! root)
return;
if (root-> d ! = '$')
cout < < root-> d < < "\t: " < < s < < "\n";
display_codes(root-> l, s + "0");
display_codes( ); //complete this statement by passing arguments
}
void hcodes(char data[], int freq[], int s) // builds a huffman tree
{
heapnode_min *t,*r, *l ; // top, right, left
priority_queue, analyze> h_min;
int a=0;
while (a
while (h_min. size() ! = 1) {
l = h_min. top(); h_min. pop();
r = h_min. top(); h_min. pop();
t = new heapnode_min('$', r-> f + l-> f);
t-> r = r; t-> l = l;
h_min. push(t);
}
display_codes(h_min. "");
}
int main()
{
int frequency[] = { 3, 6, 11, 14, 18, 25 }; char alphabet[] = { 'a', 'l', 'o', 'r', 't', 'y' };
int size_of = sizeof() / sizeof(); //complete this statement by passing data type to both sizeof operators
cout< < "alphabet"< < ": "< < "huffman code\n";
cout< < "";
//call huffman_codes function.
return 0;
Answers: 2
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen too
Answers: 2
Computers and Technology, 23.06.2019 09:30
Given a link with a maximum transmission rate of 32.8 mbps. only two computers, x and y, wish to transmit starting at time t = 0 seconds. computer x sends filex (4 mib) and computer y sends filey (244 kib), both starting at time t = 0. statistical multiplexing is used, with details as follows packet payload size = 1000 bytes packet header size = 24 bytes (overhead) ignore processing and queueing delays assume partial packets (packets consisting of less than 1000 bytes of data) are padded so that they are the same size as full packets. assume continuous alternating-packet transmission. computer x gets the transmission medium first. at what time (t = ? ) would filey finish transmitting? give answer in milliseconds, without units, and round to one decimal places (e.g. for an answer of 0.013777 seconds you would enter "13.8" without the quotes)
Answers: 3
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
Computers and Technology, 24.06.2019 15:00
Universal windows platform is designed for which windows 10 version?
Answers: 1
Me with my assigment
in the given code we are using two classes and two functions. the f...
in the given code we are using two classes and two functions. the f...
Mathematics, 09.04.2021 17:40
Mathematics, 09.04.2021 17:40
Mathematics, 09.04.2021 17:40
Arts, 09.04.2021 17:40
Chemistry, 09.04.2021 17:40
Social Studies, 09.04.2021 17:40
Mathematics, 09.04.2021 17:40
Mathematics, 09.04.2021 17:40
History, 09.04.2021 17:40
Mathematics, 09.04.2021 17:40
Mathematics, 09.04.2021 17:40