Write a recursive implementation of euclids algorithm

Assignment Help Computer Engineering
Reference no: EM13775

Part-1

Selecting Array Elements Implement the following C++ code in assembly language, using the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit signed integers: int array[] = {10,60,20,33,72,89,45,65,72,18}; int sample = 50;

intArraySize = sizeof array / sizeof sample; int index = 0; int sum = 0; while( index <ArraySize ) { if( array[index] <= sample ) {  sum += array[index]; } index++; } Optional: show a flowchart of your code.

Part-2

Greatest Common Divisor (GCD) The greatest common divisor (GCD) of two integers is the largest integer that will evenly divide both integers. The GCD algorithm involves integer division in a loop, described by the following C++ code: intGCD(int x, int y) { x = abs(x); y = abs(y); do {   int n = x % y;   x = y;   y = n; } while (y > 0); return x; } // absolute value Implement this function in assembly language and write a test program that calls the function several times, passing it different values. Display all results on the screen.

Part-3

Greatest Common Divisor Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers. Descriptions of this algorithm are available in algebra books and on the Web. Write a test program that calls your GCD procedure five times, using the following pairs of integers: (5,20), (24,18), (11,7), (432,226), (26,13). After each procedure call, display the GCD.

Reference no: EM13775

Previous Q& A

  Prepare the necessary journal entries for stone company

Prepare the necessary journal entries for Stone Company

  Stand alone child process

Forking the child process

  Write a paper on leadership and transformation

Write a paper on Leadership and Transformation and aslo Impact of Transformational Experience.

  Supply and demand in professional sports

Draw the individual cost curves on one graph: marginal cost, average total cost, average ?xed cost, and average variable cost. Place costs ($) on the y-axis and quantity (Q) on the x-axis.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

  Theory of interest

Theory of Interest: NPV, IRR, Nominal and Real, Amortization, Sinking Fund, TWRR, DWRR

  Compute a shortest superstring

Dynamic programming algorithm to compute a shortest superstring.

  Cost-benefit analysis

Create a cost-benefit analysis to evaluate the project

  Determine the temperature of the electric heater element

Determine the temperature of the electric heater element and drawing of the temperature profile.

  Determine the heat transfer characteristics

To determine the heat transfer characteristics of a cylinder under cross flow conditions when the cylinder is isolated.

Reviews

Write a Review

 

Similar Q& A

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Security policy document project

Analyze security requirements and develop a security policy

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd