Algorithm for sorting an array segment

Assignment Help Business Management
Reference no: EM131912150

Consider the following algorithm for sorting an array segment A[0..n-1]. In the first step the algorithm performs the bubble-up operation on the range [0..n-1] and it places the smallest item on position 0. In the second step it performs the bubble-down operation on the range [1..n-1] and it places the largest item on position n-1. In the third step it performs bubble-up operation on the range [1..n-2] and it places the second smallest item on position 1. In the fourth step it performs the bubble-down operation on the range [2..n-2] and it places the second largest item on position n-2. The algorithm continues alternating bubble-up and bubble-down operations until the range consists of a single field.

(i) What is the number of swap operations performed in the worse case?

(ii) What is the average number of swap operations performed by this algorithm? Provide justifications to your answers.

Reference no: EM131912150

Questions Cloud

Reflect on the analysis of the sin of suicide : Reflect on the analysis of the sin of suicide and thus, euthanasia. Do you agree? Why or why not? 300 words.
Access management services : Today, several security services are increasingly provided as common security services. These include audit and monitoring services, authentication services
Comparing keys and operating : Let T be the decision tree of a sorting algorithm based on comparing keys and operating on a list containing n different keys. Show that the height
Was the original source of information reputable : Was the original source of information reputable? Why/Why not? Please provide evidence from reputable sources to support your response for each article/item.
Algorithm for sorting an array segment : Consider the following algorithm for sorting an array segment A[0..n-1]. In the first step the algorithm performs the bubble-up operation on the range
Construct the list of values for some initial segment : CSD3203 – History and Philosophy of Computing The Halting Problem and Uncomputability - Who proved that the halting problem was impossible to solve, and when
Describe an algorithm that makes use of the sorted : A sorted list of n strings is given. Describe an algorithm that makes use of the sorted order and determines whether a given string x is a member of this list.
Digital devices from paul douglas peters : Assume a warrant was granted to search and seize digital devices from Paul Douglas Peters' residence.
Find a formula expressing the sum of degrees : Find a formula expressing the sum of degrees of all nodes of a tree in terms of the number of its nodes. Prove your formula by structural induction.

Reviews

Write a Review

Business Management Questions & Answers

  Achievements of synergies across

It is sometimes argued that a matrix organization can serve as a mechanism for achieving strategic fit- the achievements of synergies across related business units resulting in a combined performance that is greater than units could achieve if the..

  Explain how should the industry respond to such criticisms

Some critics have claimed that by outsourcing so much work, Boeing has been exporting American jobs overseas. Is this criticism fair? Explain how should the industry respond to such criticisms?

  Usb attacks and protection

Discuss the different types of attacks launched against USB devices and countermeasure users can take to protect their devices.

  Order quantity in regards to inventory cost efficiency

Identify a firm currently using a JIT system of materials management and describe the relationships between service level, uncertainty, safety stock, and order quantity in regards to inventory cost efficiency.

  Prototype testing and concept validation

Prototype testing and concept validation are a key step in the new product development process. Describe a hypothetical new product prototype and how it could be tested and validated. What outcomes would lead to a stop, kill, go-back, or proceed r..

  Applicants and employees background information

1. List and briefly explain the four steps necessary for employers to be in compliance with federal and state laws governing the acquisition and use of applicants' and employees' background information.

  Volkswagen ag navigates china

Case Analysis: Volkswagen AG Navigates China

  Major event like challenger or columbia

Why do you feel it is so difficult to "sustain" cultural change in a large organization AFTER the immediate effects of a major event like Challenger or Columbia? What role should leadership play in working to "institutionalize" such cultural chang..

  .examine traditional, contemporary, and emerging leadership

Use the Internet or the Strayer Library to research a company for which you would like to work (or your current company if you are already employed).

  Why ethical decision-making is essential in an organization

Q1(a). Discuss briefly why ethical decision-making is essential in an organization.

  What particular elements of each organization culture

Imagine yourself as an innovation architect. What structures or processes would you put in place to foster a culture of innovation within your own organization?

  Concept of marginal utility

1) Which cup of coffee do you enjoy the most, the first one in the morning or the last one at night? Use the concept of marginal utility to explain your answer.

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