Exercise 1.Computer Addresses Management Numeric addresses for computers on the wide area network Internet are composed
Posted: Fri May 20, 2022 12:13 pm
company are trying to minimize scheduling conflicts by scheduling the most popular presentations at different times. First the planners survey the ten participants to determine which of the five presentations they want to attend. Then they construct a matrix A in which a I in entry iſ means that participant i wants to attend presentation. The following table and matrix (A) give information about the participation 1. Participant Presentation 15 10101 1 10101 0011 2 0 0 0011 10000 3 1 0 0 0 0 0 01101 4 01 01 0 1 5 0 1 1 0 0 0 0 0 0 00101 0 0 1 0 1 01010 8 01010 10101 9 1 0 1 0 1 0 0 0 1 0 10 0 0 0 0 DI 0 0 0 0 0 It means matris A00000 1 Next the planners calculate the transpose of A(A) and the matrix product of A' A. In the resulting matrix, entry ij is the number of participants wishing to attend both presentation i and presentation. We then have 4 1 2 0 2 202 13!! 1 AXA = 2 15 15 = 01131 2155 notice that B = A' X A is symmetric (B)=B for all i, so the entries below the main diagonal (entries ij where in need not be calculated. If we supply zeros for the unnecessary entries, the resulting matrix is termed upper triangular matrix. The entries on the main diagonal (B) represent the total participants wanting to attend presentation i. (a) Write a C function TotalPart that creates the matrix A of participants preferences, from data received from data read from a file as sequence of couples of integers, where the first couple is such that the first number represent the number of presentation and the second number represents the number of participants and the rest of couples are such that for each couple the first number represents the participant and the second number represents one of the presentations he/she wants to attend this means a participant can appear several times in the sequence if he/she wants to attend more than one presentation. For example, the file containing the sequence 3 4 1 2 3 4 143 1 2 4 will produce ro 101 AOOO! 1001 (b) Given a matrix T with rows and p columns and a matrix S with p rows and 4 columns, if the product T x is equal to Cthen C; - ITSwhere i = 0,1,....-1 and }=0,1,....4-1. Given the matrix of preferences A write the function ComputeAt that computes A' A and saves it in another matrix C, and displays how many participants wish to attend each conference. Writer function Aunid Barchedule that receives as argument the matrix A of preferences, finds the three largest diagonal of A' x A, and displays on the screen up to three pairs of presentations d scheduling at the same time. You will display fewer than three pairs if one or user to enter the name (scheduling.txt) the file containing the attendance to and displays the pairs of presentations to be avoided.
Exercise 1.Computer Addresses Management Numeric addresses for computers on the wide area network Internet are composed of four parts separated by periods of the form xx.yy.22. mm, where xx,yy, 22, and mm are positive integers. Locally computers are usually known by a nickname as well. You are designing a program to process a list of internet addresses, identifying all pairs of computers from the same locality (ie, with matching xx and yy component) le . (a) Create a structure called InternetAddress with fields for the four integers and a fifth component to store an associated nickname (b) Define a function, ExtractinternetAddress that extracts a list of any number of addresses and nicknames from a data file whose name is provide as argument, and returns a dynamically allocated array that holds the indicated number of internet addresses (represented in InternetAddress) objects) retrieved from the file. The first line of the file should be the number of addresses that follow. Here is a sample data set: 4 111.22.3.44 555.66.7.88 111.22.5.88 234.45.44.88 plato gauss mar ubuntu (c) Define a function Common Locality that receives as arguments the array constructed in a) and the number internet addresses, and displays a list of messages identifying cach pair of computers from the same locality. In the messages. the computers should be identified by their nicknames. Here is a sample message: Machines plato and mars are on the same local network. (d) Define the main function that prompts the user to enter the name (computers.txt) of the file containing the Computer addresses as described in (b) and displays a list of messages identifying all pair of computers from the same locality. Exercise 2. Minimization of scheduling conflicts The transpose of a matrix is formed by interchanging the matrix's rows and columns. Thus the transpose of matrix of 4 168 is A [2 6 10 4 & 12 10 12 The organizers of an in-house Cloud Computing conference for small consulting