Find the largest element of the array

Assignment Help Mathematics
Reference no: EM131578841

Question: Let A(i : j) denote the array of items in positions i through j of the Array A. In selection sort, we use the method of Exercise to find the largest element of the array A and its position k in the array, then we exchange the elements in position k and n of Array A, and we apply the same procedure recursively to the array A(1 : n - 1). (Actually we do this if n > 1; if n = 1 we do nothing.) What is the expected total number of times we assign a value to L in the algorithm selection sort?

Exercise: Given an array A of length n (chosen from some set that has an underlying ordering), we can select the largest element of the array by starting out setting L = A(1), and then comparing L to the remaining elements of the array one at a time, replacing L by A(i) if A(i) is larger than L. Assume that the elements of A are randomly chosen. For i > 1, let Xi be1if element i of A is larger than any element of A(1 : i - 1). Let X1 = 1. Then what does X1 + X2 + ··· + Xn have to do with the number of times we assign a value to L? What is the expected number of times we assign a value to L?

Reference no: EM131578841

Questions Cloud

Maximum amount of money a rational person would pay to play : In a card game, we remove the Jacks, Queens, Kings, and Aces from a deck of ordinary cards and shuffle them.
Discuss charged with trafficking drugs from texas to maine : ou are arrested and charged with trafficking drugs from Texas to Maine. You are the first defendant in the history
Prepare to orally present the commercial three times : Assignment: Business communication recording and essay. Prepare to orally present the commercial three times (in one recording) each with a different emotion.
Create a hypothetical scenario involving a deadly : Create a hypothetical scenario involving a deadly batch of heroin that is making its way
Find the largest element of the array : Let A(i : j) denote the array of items in positions i through j of the Array A. In selection sort, we use the method of Exercise to find the largest element.
Democrats and republicans in washington : To what degree have the discussions in the class been helpful in relating to the issues raised by the readings?
What is the expected number of times we assign a value to l : Given an array A of length n (chosen from some set that has an underlying ordering), we can select the largest element of the array by starting out setting.
Compare and contrast community-oriented policing : Compare and Contrast community-oriented policing with traditional policing
Which of the following types of radiation is not ionizing : Which type of radiation is most penetrating, if a person is exposed from a source outside the body?Which of the following types of radiation is not ionizing?

Reviews

Write a Review

Mathematics Questions & Answers

  How many additional parts must the company sell

the company is considering increasing its advertising by $50,000 in order to sell more car parts. How many additional parts must the company sell in order to justify the increased advertising costs?

  Percentage of grapefruits

The diameters of grapefruits in a certain orchard are normally distributed with a mean of 7.10 inches and a standard deviation of 0.50 inches.

  Devise the first term of a sequence of positive integers

Devise an algorithm that finds the first term of a sequence of positive integers that is less than the immediately preceding term of the sequence.

  How many of the employees earn

in a company with 3000 employees, the monthly salaries are normally distributed. The mean salary is $2700, with a standard deviation of $400. About how many of the employees earn more than $2460 per month?

  How far away is the target

A bullet is fired horizontally at a target, and the sound of its impact is heard 3.5 seconds later. If the speed of the bullet is 3300 ft/sec and the speed of sound is 1100 ft/sec, how far away is the target?

  Nondeterministic algorithm to an equivalent mc algorithm

One observes that the protocol UMC is based on a nondeterministic protocol that simply guesses the position j where x and y differ.

  Rolls of patterned wrapping paper

The math club is selling gift wrap for a fundraiser. They sold 45 rolls of solid wrapping paper at $4 each and rolls of patterned wrapping paper $5 each. If they made $265, how many rolls of patterned wrapping paper did they sell?

  Approximate the maximum possible percent error

Approximate the maximum possible percent error in the calculated volume by using the total differential as an approximation to volume change.

  What is the actual profit realized from renting given unit

MARGINAL PROFIT Lynbrook West, an apartment complex, has 100 two-bedroom units. The monthly profit (in dollars) realized from renting x apartments.

  Which measures of center are appropriate for each level

Relate the three measures of center, mean, median, and mode, with the levels of measurement, nominal, ordinal, interval, and ratio. Be sure to include which measures of center are appropriate for each level of measurement and why.

  Metric space has infinitely many distinct

Metric space has infinitely many distinct connected components - Is it possible (X,d) compact ? if yes ,give an example if no provide proof?

  How much work is required to pump all of the oil through

A hemispherical tank is lying on the ground with its flat side facing down. The tank is filled to a depth of 6 ft with oil of density of 50 lb/ft^3. How much work is required to pump all of the oil through a valve in the top of the tank to a point 5 ..

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