Computer Systems: A Programmer's Perspective Plus Mastering Engineering With Pearson Etext -- Access Card Package (3rd Edition)
Computer Systems: A Programmer's Perspective Plus Mastering Engineering With Pearson Etext -- Access Card Package (3rd Edition)
3rd Edition
ISBN: 9780134123837
Author: Randal E. Bryant, David R. O'Hallaron
Publisher: PEARSON
Question
Book Icon
Chapter 5.11, Problem 5.9PP
Program Plan Intro

Given C code:

void merge(long src1[], long src2[], long dest[], long n)

{

long i1 = 0;

long i2 = 0;

long id = 0;

while(i1<n && i2<n)

{

if(src1[i1]<src2[i2])

dest[id++] = src1[i1++];

else

dest[id++] = src2[i2++];

}

while(i1<n)

dest[id++] = src1[i1++];

while(i2<n)

dest[id++] = src2[i2++];

}

Cycles per element (CPE):

  • The CPE denotes performance of program that helps in improving code.
  • It helps to understand detailed level loop performance for an iterative program.
  • It is appropriate for programs that use a repetitive computation.
  • The processor’s activity sequencing is controlled by a clock that provides regular signal of some frequency.

Memory aliasing:

  • It denotes a case where two pointers might designate to memory location that is same.
  • The compiler should assume that unlike pointers might be aliased for safe optimizations.
  • The program aspects that could limit chances for a compiler in generating optimized code denote optimization blockers.
  • If a compiler is unable to determine whether two pointers might be aliased, it should adopt that either case would be possible.
  • The possible optimization set is been limited in this case.

Blurred answer
Students have asked these similar questions
3. The diagram below shows the main land routes for vehicular traffic between points A and G in a city. The figures in the arcs represent the cost of traveling between each pair of nodes.   a) Manually apply Dijkstra's algorithm to find the cheapest route between A and G (visited nodes and total distance). b) Formulate a linear programming problem in extended form, to determine the shortest route to travel from A to G. Do not use subscripts, name 14 variables, for example XFE would be the variable that indicates that the arc from F to E is used. c) If there is a fixed cost for visiting each node, modify the formulation of the problem to include said fixed cost in the objective function, and the variables and restrictions that are required.     NODE A B C D E F G FIXED COST 25 18 32 20 28 18 34
R-13.17 - There are eight small islands in a lake, and the state wants to build seven bridges to connect them so that each island can be reached from any other one via one or more bridges. The cost of constructing a bridge is proportional to its length. The distances between pairs of islands are given in the following table. Find which bridges to build to minimize the total construction cost.
Problem 15 (#2.3.30).If f and f◦g are one-to-one, does it follow that g must be one-to-one? Justify your answer.
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr