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

Questions Cloud

Develop a marketing plan : Prepare a marketing plan for one or two new products in your own business and/or another business in your country or region with which you are familiar.
Design a class-based solution to a problem : To design a class-based solution to a problem using multiple data structures.
Open a named pipe and to read data from the pipe : Open a named pipe and to read data from the pipe in matlab
Analysis of wal-mart : Analysis of Wal-Mart as an MNE and its international position using concepts learned in class (for example, CSA/FSA, Hofstede's model etc.) Discuss factors considered in developing international business in China including the political environm..
Write a recursive implementation of euclids algorithm : Write a recursive implementation of Euclids algorithm
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.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

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

  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.

  Implementation of memory management

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

  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

  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?

  Implementation of memory management

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

  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.

  Prepare a proposal to deploy windows server

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

  Security policy document project

Analyze security requirements and develop a security policy

  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.

  Define a suitable functional unit

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

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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