Introduction to algorithms

Assignment Help Basic Computer Science
Reference no: EM13849779

All problem / exercise numbers are from the 3nd edition of Introduction to Algorithms (the 1st and 2nd editions are different!) Note the difference between problems and exercises!

1. Special Cases of Select:

(a) Give an algorithm to find the second smallest element in a list of n elements in at most n + |lg n| - 2 comparisons. Note: Your algorithm can use no more than n + |lg n| - 2 total comparisons in the worst case. Hint: Find the smallest element, too.

(b) Give an algorithm to find the 3rd smallest element in a list, using the smallest number of worst-case comparisons. Exactly how many comparisons does your algorithm take in the worst case? Hint: Use your solution to part a - you will need to find the smallest and second-smallest element as well!

2. Exercise 9.3-6 quantiles

The kth quantiles of an n-element set ar the k -1 order statistics that divide the sorted set into k equal-sized sets (to within 1). Give an O(n lg k)-time algorithm to list the k-th quantiles of a set. Elements within each quantitle can be listed in any order.

3. Exercise 9.3-8 Finding the median of two lists of numbers

Let X[1 . . . n] and Y [1 . . . n] be two arrays, each containing n elemetns already in sorted order. Give an O(lg n)-time algorithm to find the median of all 2n elements in arrays X and Y .

4. Does inserting and then immmediately deleting a unique element from a Binary Search Tree always leave the same tree? Does inserting and then immediatley deleting a unique element from a Red/Black tree always leave the same tree?

5. Exercise 14.3-6 (MIN-GAP) Show how to extend a red-black tree to support the operation MIN-GAP, which gives the magnitude of the difference of the two closest numbers in the tree. For example, if Q = {1, 5, 9, 15, 18, 22} then MIN-GAP(Q) returns 18-15 = 3 since 15 and 18 are the two closest numbers in Q.

Reference no: EM13849779

Questions Cloud

Limitations prevent the forecasts from being foolproof : Give examples of how ratios gleaned from the financial statements can be used as a tool in helping a firm plan for the future. What do these ratios tell an individual analyzing them? What limitations prevent the forecasts from being foolproof?
Presentation on reward is better than punish : Explanation Presentation- Topic: Reward is better than punish when training animals. Students will explain a complicated subject related to the course theme in 4 minutes to a classmate. The listener will be randomly assigned on the day of the prese..
What is the size of the last payment : Land is purchased for 75000. It is agreed for the land to be paid for over a 5 year period with compounding annual interest at 12%. Each payment is 3000 more than the previous. What is the size of the last payment?
What factors impact sourcing decisions : What factors impact sourcing decisions? The custom duties can be paid after the product has been acquired by the customer. True or False
Introduction to algorithms : All problem / exercise numbers are from the 3nd edition of Introduction to Algorithms (the 1st and 2nd editions are different!) Note the difference between problems and exercises!
Explain the various definitions of disability : Explain the various definitions of disability that are found in disability-income insurance. Explain the following disability insurance income provisions
What would you recommend smith do to help the situation : Evelyn Smith, the new president of Texas Wings Inc., had been recruited to the company in 2004 by a disgruntled investor who had lost faith in the business's management team and profitability prospects. What would you recommend Smith do to help the..
Complete a chart with recommended coverage : What should the Parkers consider when deciding what insurance coverage they need. Do they have sufficient insurance coverage. If not, what type of insurance coverage do you recommend for them
Explain how much total tax does he pay on the stock sale : How much principal must be invested today for 5 years. during a period when the inflation rate is 2%, if the investor is in the 25% Federal and 4% State tax bracket for ordinary income but taxed at a 15% Federal rate for dividend income, to accumu..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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