e)
The total number of nodes N in a full binary tree with L leaves is ?=2?−1
Proof:
=> Number of leaf nodes, L = (N + 1)/2 [proved]
NOTE: As per Chegg policy, I am allowed to answer only 2 questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
Exercise 1 (a) Proof that (by an example with10) the number of terminal vertices in a...
Discrete Mathematics 6: A: Draw a graph with 5 vertices and the requisite number of edges to show that if four of the vertices have degree 2, it would be impossible for the 5 vertex to have degree 1. Repetition of edges is not permitted. (There may not be two different bridges connecting the same pair of vertices.) B: Draw a graph with 4 vertices and determine the largest number of edges the graph can have, assuming repetition of edges...
(b.) Huffman code is a way to encode information using variable-length binary strings to represent symbols depending on the frequency of each individual letter. Specifically, letters that appear more frequently can be encoded into strings of shorter lengths, while rarer letters can be turned into longer binary strings. On average, Huffman code is a more efficient way to encode a message as the number of bits in the output string will be shorter than if a fixed-length code was used....
Recall the definition of the degree of a vertex in a graph. a) Suppose a graph has 7 vertices, each of degree 2 or 3. Is the graph necessarily connected ? b) Now the graph has 7 vertices, each degree 3 or 4. Is it necessarily connected? My professor gave an example in class. He said triangle and a square are graph which are not connected yet each vertex has degree 2. (Paul Zeitz, The Art and Craft of Problem...
Sc Python 1 Task 2 3 Consider a binary tree of N vertices 4 such that children of node K are 2* K + 1. Vertex 1 is the root Kand 2 of the tree and each node has an integer value associated with it. Such a tree may be represented as an array of N integers by writing down values from consecutive nodes For example, the tree below 8 Test might be represented as an array o A node...
. Huffman Encoding (a.) (6 points) Suppose a certain file contains only the following letters with the corresponding frequencies 1 AİB 73 9 30 44 130 28 16 In a fixed-length encoding scheme, cach character is given a binary representation with the same number of bits. What is the minimum number of bits required to represent each letter of this file under fixed-length encoding scheme? Describe how to encode all seven letters in this file using the number of bits...
1) (10 pts) Write a recursive function that counts and returns the number of nodes in a binary tree with the root root, that store an even value. Please use the struct shown and function prototype shown below. (For example, if the tree rooted at root stored 2, 3, 4, 8, 13, 18 and 20, the function should return 5, since there are five even values [2,4,8,18,20] stored in the tree. typedef struct node { int data; struct node* left;...
1.Fix any tree T on 10 vertices. Draw the recursion tree of the algorithm Find-size-node when run on the input T with a being the root of T. Can you use this to give a bound on the running time of T? 2. Consider the following problem. Check-BST • Input: A binary tree T • Output: 1 if T is a binary search tree, and 0 otherwise. Give an efficient algorithm for this problem. 3.Give a recursive algorithm for the...
Find the logical mistakes in these proofs, and explain why the mistakes you've identified cause problems in their arguments. (b)Claim: Suppose that G is a graph on n 3 vertices in which the degree of every vertex is exactly 2. Then G is a cycle Proof. We proceed by induction on n, the number of vertices in G. Our base case is simple: for n - 3, the only graph with 3 vertices in which all vertices have degree 2...
Find the logical mistakes in these proofs, and explain why the mistakes you've identified cause problems in their arguments. (b)Claim: Suppose that G is a graph on n 3 vertices in which the degree of every vertex is exactly 2. Then G is a cycle Proof. We proceed by induction on n, the number of vertices in G. Our base case is simple: for n - 3, the only graph with 3 vertices in which all vertices have degree 2...