Develop an algorithm to fins a subset of sorted elements

Assignment Help Data Structure & Algorithms
Reference no: EM132403162

Exercise.

We have been told to develop an algorithm to fins a subset of sorted elements within a bigger set. Our customer does not care about how the algorithm is implemented as far as it is as quick as possible.

Therefore, we devise two methodologies we could use. To check which of these is the most efficient, we consider that we have an unsorted price list of 1010 distinct products and that we want to find the 5000 most expensive on that list.

The two algorithms we have come up with are the following:

Algorithm 1: repeat a sequential search (complexity O(n)) between the 1010 elements tofind the most expensive element on the list, for each of the 5000 elements we want to find.

Algorithm 2: convert the list to an array (complexity O(n)), sort the array by cost in descending order (complexity O(n log n)) and return the first 5000 elements.

Before choosing which of the two algorithms is the most suitable, we have to take into account the following conditions:
• Looking up 100 elements in an unsorted list costs 0,15 ms.
• Sorting 100 elements costs 0, 15 ms.

You can consider the fact of accessing memory data to cost 0 ms.

Therefore, taking into account these conditions, which of the two algorithms you think is the most afficient? Justify your answer.

Reference no: EM132403162

Questions Cloud

Explain the methods and techniques such as radius and ras : What are the advantages, strengths and/or weaknesses of remote access methods and techniques such as RADIUS, RAS, TACACS+ and VPN?
Literature review of technology adoption models : You read THE LITERATURE REVIEW OF TECHNOLOGY ADOPTION MODELS AND THEORIES FOR THE NOVELTY TECHNOLOGY
Discuss criminal law and civil law : This week we discuss criminal law and civil law, commonly referred to as tort law. What is the difference between criminal law and tort law?
Avoid the duplication of data within the database system : This module covers the concepts of data redundancy and the need for an organization to avoid the duplication of data within the database system.
Develop an algorithm to fins a subset of sorted elements : Develop an algorithm to fins a subset of sorted elements within a bigger set. Our customer does not care about how the algorithm is implemented as far as it is
Compare different cloud computing services : Compare and contrast two different cloud computing services (Amazon Web Service and Microsoft Azure). Explain the differences and the similarities and select.
Recognizing potential vulnerabilities : Securing Windows networks requires recognizing potential vulnerabilities and selecting the best control to address that vulnerability.
Best way to learn excel for financial analysis : What is the best way to learn excel for financial analysis? Please give a detailed answer need advice before graduating. I have very basic knowledge
Compute the dollar receipt of the euro receivable : The management of us company decides to use the money market hedge to deal with this euro account receivable,. explain the process of a money market hedge

Reviews

len2403162

11/19/2019 1:54:09 AM

The problem of comparing the efficiency between diverse solutions is that the cost usually depends on the concrete input data. For example, there are algorithms that are better than others for concrete input data or for small input data. This makes that we can not predict in general the cost from measurements for concrete input data. The indicator that will use to measure the efficiency is the order of growth, a mathematical expression that describes the relation between the cost of the algorithm and the size of the input data.

len2403162

11/19/2019 1:53:53 AM

efficiency, cost of algorithm, memory is the way that this question need to be answered see some theory he concept of efficiency of an algorithm or data structure, in terms of time of execution and/or memory space. In particular, we are interested in comparing different alternative solutions to a problem to choose the most appropriate.

Write a Review

Data Structure & Algorithms Questions & Answers

  Tic tac toe game - design a gui and implement tic tac toe

tic tac toe game - design a gui and implement tic tac toe game in java-implement a random move using two methods

  Find the value of each given expression

Answer all the sub-questions for Problem 2 but for the following circular doubly-linked list with the two references P1 and P2: Find the value of each expression.

  Draw the human encoding tree of these six characters

Show how to nd the maximum spanning tree of a graph, that is, the spanning tree of largest total weight.

  Explain an application level protocol

Create and explain an application level protocol to be used in an automatic teller machine and a bank's centralized computer. Your protocol should permit a user's card and password to be verified,

  Create a program could perform over an array of items

Create a program could perform over an array of items that would be used by a small business. Your task must include the following: Declaring array, Populating the array and Processing the items in the array.

  Identify nodes that are cut-off

Use Alpha-Beta Search to compute the final value of the root node for the tree below. Use depth-first, left-to-right progression. Be sure to: identify nodes that are cut-off

  What is a race condition in software

What is a race condition in software? Why are race conditions difficult to debug?

  Display all columns and all rows from the employees table.

Write SELECT statements for the following questions. Make sure to include the statement execution, including the resulting data.

  Determine the activity precedence relationships

Two brothers have purchased a small lot, in the center of town, where they intend to build a gas station. The station will have two pumps, a service area.

  Implement a bellman ford algorithm

Implement a Bellman Ford Algorithm. Find an application that can best be solved by bellman ford algorithm.

  An embedded system is a computer system performing

an embedded system is a computer system performing dedicated functions within a larger mechanical or electrical system.

  Implement radixsort algorithm to base for sorting integers

Implement the radixsort algorithm to base 216 for sorting 32-bit unsigned integers given in a linked list. The structure of the linked list is struct listnode.

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