B.Tech. (I) - ICP-132 (2008) Assignment 5 Level 0 ------- 1. Read 2 mobile numbers and roll numbers and print them using maps. Eg Input: 3753215444 God 005345545423 Lord Output: 3753215444 God 5345545423 Lord 2. A DNS table associates URL with Ip no.s. Given the following DNS table, print the IP for a given URL. Eg DNS Table: yahoo.com 206.190.60.37 google.com 72.14.207.97 google.com 72.14.207.97 mail.google.com 72.14.207.97 rediff.com 204.2.177.16 Input: google.com Output: 72.14.207.99 3. Given the SR No. of a student, print the name Data: MIR2008120 ABC MIR2008567 XYZ MIR2008657 IJK Input: MIR2008567 Output: XYZ Level 1 ------- 1. A sparse matrix is a matrix with very few non-zero elements. Given a sparse matrices A and B of order 100x100, print C=A+B. You shall be given only the non-zero elements and must print only the non-zero elements. All elements which are zero should not be stored or printed! Data: A: A(1,90) = 10 A(2,10) = 70 A(5,20) = 20 B: B(1,90) =-10 B(2,10) = 10 B(5,20) = 50 B(7,10) = 10 Output: C(2,10) = 20 C(5,20) = 70 C(7,10) = 10 2. Store the following data in a memory as a map and print it as a table. It consists of SR No., marks and you must find the average. Eg Data: IMB2009123 80.0 93.5 91.5 IMB2009124 87.5 53.0 71.0 IMB2009125 81.5 83.0 41.5 Input: IMB2009124 Output: IMB2009124 87.5 53.0 71.0 70.5 3. You are given movie names, name of Director, Producer, Hero(s) and Heroine(s). Given the movie name, print the names of the heros. Eg Data: Movie Name: Fool N Final Producer: Firoz A. Nadiadwala Director: Ahmed Khan Hero: Sunny Deol, Shahid Kapur, Suniel Shetty, Jackie Shroff Heroine: Ayesha Takia Movie Name: Dharm Producer: Sheetal Vinod Talwar Director: Bhavna Talwar Hero: Pankaj Kapoor Heroine: Supriya Pathak Input: Dharm Output: Pankaj Kapoor Level 2 ------- 1. Perform sparse matrix multiplication of two sparse matrices of order 100x100. 2. You are given number plates of vehicles in which the leading letters indicate states. Print all the number plates of UP. Eg: Data: AP12 3423 BH45 431 KN63 355 UP70 6533 UP92 3423 Output: UP70 6533 UP92 3423 3. You are given first name and last names of 5 people of which two have same first name and three share the last name. Find if any of them have both first and last names as same using map! Level 3 ------- 1. Huffman decoding is done using a lookup table. Each letter has a binary code associated and the length could be different. The decoding starts from the left side as shown below. Given the table, decode a text message. Eg Data: T 10 S 00 01 I 110 E 1110 H 11110 A 11111 Input: 10111101100001110000111111011011100010 (Should be split as "10 11110 110 00 01 110 00 01 11111 01 10 1110 00 10") Output: THIS IS A TEST 2. Given actor name in 1.3, print the movie name(s). 3. Given the IP no as in 0.2, print all the URLs with the same IP.