find the minimum and maximum values in s

Assignment Help Data Structure & Algorithms
Reference no: EM13934512

Given an array s =(s[1], s[2], . . . , s[n]), and n = 2^d for some d = 1. We want to find the minimum and maximum values in s. We do this by comparing elements of s.

(a) The "obvious" algorithm makes 2n - 2 comparisons. Explain.

(b) Can we do it better? Carefully specify a more efficient divide-and-conquer algorithm.

(c) Let T(n) = the number of comparisons your algorithm makes. Write a recurrencerelation for T(n).

(d) Show that your recurrence relation has as its solution T(n) = 3n/2 - 2.

Reference no: EM13934512

Questions Cloud

What is the ionization state of each residue at ph5.2 : The active site of lysozyme contains two amino acid residues essential for catalysis: Glu35 and Asp52. The pka values of the carboxyl side chains of these low residues are 5.9 and 4.5 respectively. What is the ionization state (protonated or deprot..
What is the maximum profit and loss for position : An investor purchases a stock for $45 and a put option for $.85 with a strike price of $41. The investor also sells a call option for $.85 with a strike price of $54. What is the maximum profit and loss for this position?
Static methods for processing an array of marks : For this task you will create a class containing a number of static methods for processing an array of marks, which are scores in a test. Each mark is an integer in the range 0 to 100 inclusive. On the Interact site for this subject, you will be p..
Zero coupon treasury bonds are currently selling : The U.S. 5-years zero coupon Treasury bonds are currently selling at $791,031.15. No payments will be made until the bond matures 5 years from now, at which time it will be redeemed for $1,000,000. What annualized interest rate would you earn if you ..
find the minimum and maximum values in s : Given an array s =(s[1], s[2], . . . , s[n]), and n = 2^d for some d = 1. We want to find the minimum and maximum values in s. We do this by comparing elements of s.
What property of water gives rise to capillary action : The antibiotic, polymyxin B, attaches itself to the phospholipids in the bilayers of bacterial cells and increases the permeability of the membrane. What is a likely result that this antibiotic will have on bacterial cells?
Would it be the availability of credit : What is tipping theory? how would you apply it to any part of our economy? Most important, where does it start? For instance, if you apply the theory to the auto industry, then what would tip new car purchases? Would it be the availability of credit?..
Communication and interpersonal skills in clinical practice : Write a reflective essay on student development in practice and at the university. ‘A reflection, Relating to ...... Communication and interpersonal skills in clinical practice.
For the list of product manufacturers below : For the list of product manufacturers below, indicate whether a job-cost system (J) or a process cost system (P) would be most appropriate.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Evaluate each of the following statements

If x = 5, y = 6, z = 4, and w = 3.5, evaluate each of the following statements, if possible. If it is not possible, state the reason.

  Generates all the possible n-node binary tree

Implement a function that generates all the possible N-node binary tree configurations. The value N is a parameter to the function and the function should return a list of binary tree. Any container ADT (list, queue, vector, etc...) will be used t..

  Algorithm to decide flavor of ice cream from three option

A group of ten people require to decide which one flavor of ice cream they will all order, out of three options. The algorithm can question and re-question participants.

  Design a bfs-based algorithm

Design a BFS-based algorithm (pseudo code) for directed graph that computes the total number of paths from vertex srcU to vertex destV.

  Design analgorithm that decides for each node

Design an O(n) algorithm that decides (schedules) for each node at which time slot to start sending data such that the total number of time (slots) is minimized.

  Substituted the following expression

can be substituted for. if (isalpha(c) && isdigit(c)) a) if...  The following expression can be substituted for. if (isalpha(c) && isdigit(c))  a) if (isalnum(c)) b) if (isalphanum(c))

  Hierarchy chart and design the logic

Draw the hierarchy chart and design the logic for a program that calculates the projected cost of an automobile trip. Assume that the user's car travels 20 miles per gallon of gas. Design a program that prompts the user for a number of miles drive..

  Create a hierarchy chart depicting the chosen situation

Create a hierarchy chart depicting the chosen situation. Develop a flowchart and provide a brief explanation for it. Develop an algorithm and provide a brief explanation for it

  Question about disk writing speed

Think about a disk holding documents with an average file length of 5 KB. Each document is allocated contiguously on adjacent sectors.

  Write a program that implements kruskals algorithm

Write a program that implements Kruskal's algorithm

  Show the brute-force attack against single des

Your task is to show that breaking the scheme is approximately as difficult as a brute-force attack against single DES.

  How to use depth-first search to find out in time

Illustrate how to use depth-first search to find out in time O(|E|+|V |) whether undirected graph is 2-colorable. Describe and explain your strategy.

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