Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Programming

Part - 1:

Remember: For each of these four programs, you are expected to write a report that uses that program as a research tool

1. Write a program, using your favorite computer (under some operating system that must support VMM) and your favorite programming language, which demonstrates that the timings of matrix addition differ substantially for large enough matrices, depending whether you use Version 1 or Version 2:

for i:=1 to n do for j :=1 to n do                          for j:=1 to n do for i.:=1 to n do
C[i,j]:=A[LjJ+B[1,5]                                             C[i,j]:=A[i,j]-1-13(i,j)

Version 1                                                            Version 2

Specifically, use this sequence of values for n, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536, and study the timings of both versions. (Be aware that some runs may take longer than you are willing, or able, to wait!) Keep in mind that the two versions should have the same timings and the doubling the value of n should result in a quadrupling of time spent to do the addition, assuming everything were done in core (which is of course not the case, since the last value corresponds to a memory requirement of almost 50 Gigabytes, assuming four bytes per word). Note that you must initialize your matrices A and B but the time required for this should not be part of the measurements.

2. Write a program, using your favorite computer (under some operating system, supporting VMM) and your favorite programming language, to implement the algorithm on p. 126 for n=16, 64, 256, 1024, 4096, and 16384, and for two values for m, m=1 677 721 600 and m=13 421 772 800(that is, m does not depend on n). Determine the timings for your twelve instances. What should be the computational complexity of the twelve runs?

3. Conduct the following experiment that should provide information about the use of garbage collection on your specific computing platform: Implement insertion and deletion for AVL trees, except instead of having as the content 1(N) of the node N a single integer val, let it consist of that integer val (to govern the insertion into its appropriate location in the search tree) plus a large matrix of size M. Furthermore, choose M as follows: If val = 0 mod 3, then M = 220; if val = 1 mod 3, then M = 219 + 218; if val = 2 mod 3, then M = 23+2" (these values should guarantee that fragmentation of the available memory will occur quite rapidly). Now randomly choose a large number, perhaps 100,000, of values between 0 and 299 for insertion and deletion, making sure that your tree never contains more than 50 nodes. (If your compiler is very clever, it may be necessary to assign values to some of the array elements - to ensure that the compiler is unable to conclude that the array is not needed since it is never used.)

Measure the time each of the insertions and deletions takes. Since your tree never has more than 50 nodes, its height cannot exceed 6 (since an AVL tree of height 7 must have at least 54 nodes); consequently, the complexity of the insertion and deletion operations is quite small. However, the repeated insertions and deletions, together with the size of the matrices in the nodes created, should result in extensive memory fragmentation, which in turn should engage garbage collection and subsequently memory compaction in a major way.

4. Design a program that illustrates the influence of virtual memory management on execution. Specifically, for a computer platform that uses VMM, determine the size of the active memory set and the access characteristics of the components involved in the VMM (size of page, access times, etc.). Then write a synthetic program that uses a relatively small amount of data for extensive computations. In more detail, if the size of the active memory set is M, have your program load a data set of size C into the cache and carry out a number of operations (involving this data set) that is several orders larger than C. Determine and plot the timings for C = 0.5.M, 0.6.M, 0.7.M, 0.8.M, 0.9 M, 0.95.M, 0.99.M, 1.0.M, 1.01.M, 1.1.M, 1.5.M, 2.M, 5.M, 10.M, and 100.M. Pay attention to the replacement policy of the VMM and structure your computations so that you can be certain that thrashing occurs for C>M.

Part - 2:

Theory
1. Assume you are given two matrices A, B (1:n, 1:n) and consider the problem of determining whether any element of A is an element of B (not value element!!).

(a) Derive a lower bound for this problem.
(b) Design an algorithm for this problem. Derive its time complexity. It should be as close to your lower bound as possible.

2. Construct a Huffman code for the following symbols, listed together with their frequency counts:

a:1  b:5  c:7  d:12  e:13  f:18  g:19  h:29  i:39  j:46  k:60

Determine the expected length of your resulting code.

3. On-line median

In class, we discussed the on-line kklargest problem. We solved it, using an augmented AVL-tree structure, with the following characteristics:

Insert(x) in time and space 0(log2n) where n is the number of elements in the structure at this time
(i. e., the number of Insert operations, minus the number of Delete operations, up until now).

Delete(x) in time and space 0(log2n) where n is the number of elements in the structure at this time
(i. e., the number of Insert operations, minus the number of Delete operations, up until now).

Find(k) in time 0(log2n) and space 0(1) where n is the number of elements in the structure at this time (i. e., the number of Insert operations, minus the number of Delete operations, up until now).

Suppose that instead of doing the Find(k) operation, with k an arbitrary positive integer that can vary from one Find to the next, we replace it by
Find(in/51)

where n is the number of all elements that are currently stored in the structure.

Can you devise a data structure and algorithms for
Insert(x)
Delete(x)
Find((n/51)

which improve over the Find(k) approach discussed in class. (Obviously, that approach will still apply, so we know that all three operations can certainly be done in time and space O(log2n); however, the question for you to solve is: Can you do better??).

Carefully formulate your data structure, outline the three algorithms in some detail, and determine with care the time and space complexities of your three algorithms.

(If your structures/algorithms are based on standard structures/algorithms, emphasize in what way yours are different. Do not repeat everything!)

4. Multiplying rectangular matrices

Assume that every possible way of evaluating a sequence of n such matrices (every possible way of placing parentheses) is equally likely. Design and algorithm that determines the average amount of work (in terms of scalar multiplications) for a given sequence of n matrices. Precisely define what is "average work"! Determine its time and space complexity.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91976095

Have any Question?


Related Questions in Computer Engineering

A string in c is simply an array of characters with the

A string in C++ is simply an array of characters with the null character(\0) used to mark the end of the string. C++ provides a set of string handling function in as well as I/O functions in . With the addition of the ST ...

Question 1 describe and explain the role and function of

Question: 1. Describe and explain the role and function of network connectivity in current computing. 2. Describe and explain the protocols and interactions that implement network communications. 3. Describe and explain ...

Research the web for an example of a startup using a cloud

Research the Web for an example of a startup using a cloud infrastructure. What were the main reasons for choosing a cloud infrastructure? What alternatives did the startup have? Answer should be at least 1 page long dou ...

Question using an organization of your choicedevelop a

Question: Using an organization of your choice: Develop a Complete Disaster Recovery Plan to be submitted to the executive board of your company. Please note that this is a formal writing, all references (peer-reviewed) ...

What are the characteristics of perfect competition and

What are the characteristics of perfect competition, and does is exist in the real world?

Please help me with the assignment and describe your

Please help me with the assignment and describe your answer. Consider the following random sample of data: -1, 3, -2, -9, -3, 3, -5, -3, 8, 86 a) What is the mean of the sample data? Round your response to at least 2 dec ...

Remembering the pythagorean theorem - the square of the

Remembering the Pythagorean Theorem - The square of the hypotenuse is equal to the sum of the squares of the other two sides Your assignment is to design a Fortran 95 program with three solutions for the quadratic equati ...

Start your c development tool and view the swatthebugs16cpp

Start your C++ development tool and view the SwatTheBugs16.cpp file. The file is contained in either the Cpp7\Chap05\Swat TheBugs16 Project folder or the Cpp7\Chap05 folder. (Depending on your C++ development tool, you m ...

Elmers utility function isnbspuxnbspy minxnbspy2 if the

Elmer's utility function is  U ( x ,  y ) = min{ x ,  y 2 }. If the price of  x  is $10 and the price of  y  is $15 and if Elmer chooses to consume 4 units of  y , what must his income be? a. $220 b. $100 c. $320 d. Ther ...

What is the probability of a value from a normal

What is the probability of a value from a normal distribution being between 0.75 standard deviations above the mean and 1.75 standard deviations below the mean? (Round calculations to nearest thousandth (3 digits))

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As