As information centers are progressively centered on energy efficiency, it gets to be imperative to create Low control usage of the different applications that run on them. Data or Information compression plays a basic part in information centers to reduce storage capacity and communication costs. This work pivot on building a Low control, High performance execution usage for canonical Huffman encoding.
Suppose given Letters I, Q, R, A, C, M, P, U, S with following frequencies.
Frequency Table
Character Frequency
I 20
Q 11
R 8
A 12
C 49
M 10
P 5
U 5
S 33
A. Create a Single Huffman tree to determine the Binary codes for each character.
B. Encode the following secret message sequence using Huffman encoding scheme.
“IQRACAMPUS”
C. Compress and encode the given Information using Huffman coding Scheme.
“STAY HOME STAY SAFE”
Consider a hash table of size 10, and the following items are to be stored. Item
are in the (key, value) format. Map the key values to the indexes of an array.
• (1,20)
• (2,70)
• (42,80)
• (4,25)
• (12,44)
• (14,32)
• (17,11)
• (13,78)
• (37,98)
What is a Priority Queue? How is it Different from an ordinary Queue? Is Heap a Priority Queue? Explain your answers in own words.
Convert the H array into a Binary Max-Heap. Provide simulations for each step.
H: {15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26}
Consider the following two sample codes in different language for software complexity analysis using Halstead matrics. Calculate the length, vocabulary, volume, difficulty, Effort, time, and number of delivered Bugs of each code. Create a comparison chart of time, Effort, bugs, and difficulty using any language. Use the below Table to compare Halstead matrics analysis of both example. Halstead Matrics Code 1 Code 2 N1 N2 n1 n2 Length (N) Vocabulary (n) Volume (V) Difficulty (D) Effort (E) Time Bugs Sample code 1 in Java: import java.util.HashSet; // program to remove duplicate values from the array public class DuplicateDetection { // method to remove duplicates static void removeDuplicate(int arr []) { HashSet uniqueSet = new HashSet<>(); for (int i = 0; i < arr.length; i++) { //check whether value exist already or not if(!uniqueSet.add(new Integer(arr[i]))){ System.out.println("Duplicate found : "+ arr[i]); continue; } } // print all unique value of the array for (Integer integer : uniqueSet) { System.out.println(integer); } } public static void main(String[] args) { // take integer array as an input int arr [] = {3,6,2,8,5,9,3,2,0,5,7}; // calling method to remove duplicates removeDuplicate(arr); } } Sample code 2 in Python: # program to remove duplicate value of the array # function to remove duplicates def removeduplicates(arr): s = set() for value in arr: # check whether value already exist or not if value in s: print("Duplicate found ", value) s.add(value) #printing unique values of array print(s) #take array as an input arr = [2,5,6,2,7,4,7,3,5,5]
You are so lucky in 2021 and finally you have bought your dream car. You decided to travel to many cities. The car tank capacity is C litres. And each trip will cost x liters of fuel. You can fill the tank when visiting each city. The expected inputs N : number of cities C : Tank capacity A[]: the fuel amount you can fill from each city B[]:the fuel consumption to travel from city i and city i+1 The output The maximum number of cities you can travel
Q: Write the Algorithm of Binary Search using binary search tree. Explain with example .
Q: What is Recursion Function, also write Algorithm/Pseudocode for finding factorial recursively.
Translate each of these regular expressions into a context-free grammar.
a. ((xy∗x)|(yx∗y))?
b. ((0|1)+"."(0|1)∗)|((0|1)∗"."(0|1)+)