Solution Idea!
#include <bits/stdc++.h> using namespace std; class HeapNode_Min { // Tree node of Huffman public: //Add data members here. char d; unsigned f; HeapNode_Min *l, *r; HeapNode_Min(char d, unsigned f = -1) { //Complete the body of HeapNode_Min function this->d = d; this->f = f ; this->l = NULL; this->r = NULL; } }; class Analyze { // two heap nodes comparison public: bool operator()(HeapNode_Min* l, HeapNode_Min* r) { //add return before statement and statement is completed. return (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(root->r, s + "1"); //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<HeapNode_Min*, vector<HeapNode_Min*>, Analyze> H_min; int a=0; while (a<s){H_min.push(new HeapNode_Min(data[a], freq[a])); ++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.top(), ""); } int main() { int frequency[] = { 3, 6, 11, 14, 18, 25 }; char alphabet[] = { 'A', 'L', 'O', 'R', 'T', 'Y' }; //Complete this statement by passing data type to both sizeof operators int size_of = sizeof(alphabet) / sizeof(*alphabet); cout"Alphabet"":""Huffman Code\n"; cout"--------------------------------\n"; //Call Huffman_Codes function. HCodes(alphabet, frequency, size_of); return 0; }MTH603 Grand Quiz Solution and Discussion
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
In Jacobi’s Method, the rate of convergence is quite ______ compared with other methods.
https://cyberian.pk/topic/838/mth603-mid-term-past-and-current-solved-paper-discussion
-
In Jacobi’s Method, the rate of convergence is quite ______ compared with other methods.
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
For the system of equations; x =2, y=3. The inverse of the matrix associated with its coefficients is-----------.
⌈ 3 -2⌉ ⌈ x ⌉ = ⌈ 5 ⌉
⌊ 4 3⌋ ⌊ y ⌋ ⌊ -2 ⌋⌈ x ⌉ = (1/17) ⌈ 3 2 ⌉ ⌈ 5 ⌉
⌊ y ⌋ ⌊ -4 3 ⌋ ⌊-2⌋⌋= (1/17)⌈11⌉ ⌊-26⌋ = ⌈11/17⌉ ⌊-26/17⌋
x = 11/17 and y = -26/17
-
For the system of equations; x =2, y=3. The inverse of the matrix associated with its coefficients is-----------.
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
The linear equation: x+y=1 has --------- solution/solutions.
This is an stand alone linear equation in two variables. It would have infinite number or solutions. Assign any real value to x, there would be a corresponding real value of y. All these pairs of values are solution of the equation.
-
The linear equation: x+y=1 has --------- solution/solutions.
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
Gauss–Seidel method is also known as method of …………….
In numerical linear algebra, the Gauss–Seidel method, also known as the Liebmann method or the method of successive displacement, is an iterative method used to solve a system of linear equations.
-
Gauss–Seidel method is also known as method of …………….
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
Differences methods are iterative methods. yes or no
- Which of the following is not an iterative method? Explanation: Jacobi’s method, Gauss Seidal method and Relaxation method are the iterative methods and Gauss Jordan method is not as it does not involves repetition of a particular set of steps followed by some sequence which is known as iteration.
-
Differences methods are iterative methods. yes or no
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
Power method is applicable if the eigen vectors corresponding to eigen values are linearly _______.
The Jacobi’s method is a method of solving a matrix equation on a matrix that has no zeros along its main diagonal. Power method is applicable if the eigen vectors corresponding to eigen values are linearly independent.
-
Power method is applicable if the eigen vectors corresponding to eigen values are linearly _______.
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
Two matrices with the same characteristic polynomial need not be similar.
Two similar matrices have the same characteristic polynomial. The converse however is not true in general: two matrices with the same characteristic polynomial need not be similar. The matrix A and its transpose have the same characteristic polynomial. … In this case A is similar to a matrix in Jordan normal form.
-
Two matrices with the same characteristic polynomial need not be similar.
-
@zaasmi said in MTH603 Grand Quiz Solution and Discussion:
If A is a nxn triangular matrix (upper triangular, lower triangular) or diagonal matrix , the eigenvalues of A are the diagonal entries of A.
The eigenvalues of B are 1,4,6 since B is an upper triangular matrix and eigenvalues of an upper triangular matrix are diagonal entries. We claim that the eigenvalues of A and B are the same.
-
If A is a nxn triangular matrix (upper triangular, lower triangular) or diagonal matrix , the eigenvalues of A are the diagonal entries of A.


100% Off on Your FEE Join US! Ask Me How?


