Question

When building a Huffman tree, the two nodes with the smallest frequencies are combined. Which line correctly creates a new parent node newNode with left and right children and its data (frequency)? // Assume Node class has data, left, right members // Node* l and Node* r are the two lowest frequency nodes Node* newNode = new Node(__________); // Line to complete newNode->left = l; newNode->right = r;

A l->data + r->data
B max(l->data, r->data)
C min(l->data, r->data)
D l->data * r->data
E l->data - r->data
Practice Next

Hey! Ask a query