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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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