What does this following algorithm calculate

Assignment Help Computer Engineering
Reference no: EM133105

Question

Algorithm Secret(A[0..n - 1])
//Input: An array A[0..n - 1] of n real numbers
minval ← A[0]; maxval ← A[0]
for i ← 1 to n - 1 do
if A[i] < minval
minval ← A[i]
if A[i] > maxval
maxval ← A[i]
return maxval - minval

a. What does this algorithm calculate?

b. What is its essential operation?

c. How many times is essential operation executed?

d. What is the effectiveness class of this algorithm?

e. propose a development or a better algorithm altogether and indicate its effectiveness class. If you cannot do it, try to prove that, in fact, it cannot be completed.

Reference no: EM133105

Questions Cloud

Write down python program : Write down Python program
An account of the historical development of social policy : The origin of social policy is closely linked to the establishment of the Fabian society in UK. In Mauritius the history of social policy can be dated back to the French colonisation period (i) Give an account of the historical development of so..
Why are most photographic images stored in a lossy format : Why are most photographic images stored in a lossy format
Write down an sql statement : Write down an SQL statement
What does this following algorithm calculate : What does this following algorithm calculate
Display all 52 cards in a standard deck of playing cards : Display all 52 cards in a standard deck of playing cards
What is essential address field width : What is essential address field width
Write down an application that reads 3 integers : Write down an application that reads 3 integers
Describe the term tco : Describe the term TCO

Reviews

Write a Review

Computer Engineering Questions & Answers

  Explain contents of an initially empty avl tree

Explain contents of an initially empty AVL tree

  How to write a report on object-oriented systems

How to write a report on Object-Oriented Systems?

  How to make an xml file in visual studio

How to make an xml file in Visual Studio

  The ways to depict constraint graph

The ways to depict constraint graph? illustrate how splitting a domain can be used to solve this problem.

  What occurs in an infinite loop

What occurs in an infinite loop? Create your own Repeat-until repetition arrangement.

  Write down a user-defined function

Write down a user-defined function

  Designing a solution to the problem

Designing a solution to the problem and implementing the design using principles of correct syntax

  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.

  What will be the exercise ratio of men and women

What will be the exercise ratio of men and women? Results indicated that women averaged 2 hours per week and men averaged 1.25 hour per week.

  Describes a function named insidecircle

Describes a function named insideCircle

  Write an essay on wifi performance

Write an essay on WiFi performance

  Write down a java implementation

Write down a Java implementation

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