Description of the steps of the algorithm and justify it

Assignment Help Data Structure & Algorithms
Reference no: EM13943796

Consider a set G consisting of m integers.

a) Design an algorithm that finds and gives as output the k smallest numbers of the whole G sorted in ascending order and has time complexity O(m*lg(m)) and spatial complexity O(m).

Note: lg denote the logarithm base 2.

b) Design an algorithm that solves the above problem using a mandatory heap and has time complexity O(m + k*lg(m)) and space complexity O(m).

In response give either pseudocode or the description of the steps of the algorithm and justify the complexities.

Reference no: EM13943796

Questions Cloud

Number of men and women in the sample : In addition, is it a problem that the number of men and women in the sample is different? Why or why not? Note: This is a two sample test for proportion, please use the following guidelines
Create a table that depicts the runtime for arrays of length : Create a table that depicts the runtime for arrays of length 1 to 10. Would you expect the general runtime to be O(n), O(n2), O(n3), or some other function of n? Explain.
Write a response to nato architecture framework : What's the message to the business? What are ways to attain early wins? Write a response to NATO Architecture Framework 200 words or less
Prepare the net cash flows from operating activities : Prepare the net cash flows from operating activities using the indirect method. What are the causes of the major differences between net income and net cash flow from operating activities?
Description of the steps of the algorithm and justify it : Design an algorithm that solves the above problem using a mandatory heap and has time complexity O(m + k*lg(m)) and space complexity O(m).
Calculate the export price and profit : Calculate the export price and profit in $. Market price is $240.00 (what customer pays); manufacturing cost is $60.00; freight is 10% (market price); customs duty is 5.4% (market price). Calculate the export price if the distribution chain is a)
Weighted average cost of capital after recapitalization : Cops & Co. expects its EBIT to be $60,000 every year forever. Cops currently has no debt and its cost of equity is 22 percent. The firm is considering issuing new par bonds and uses the proceeds of the new debt to repurchase equity. The firm can borr..
Implements a method that receives an array parameter : Continue to properly document your source code. Write this program as if you were explaining it to someone new to arrays. Fully document your code in such a way newcomers to Java will understand and be able to implement a Java array.
Advantages and disadvantages of twisted pair cabling : Create an 8- to 10-slide presentation explaining the advantages and disadvantages of twisted pair cabling and fiber optics as well as the importance of wireless communication in today's business environment

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Question about lan and wan

Think about the following two scenarios two computers are connected to a LAN using a total of 20-feet of cable, and two computers are connected over the Internet and are 8000 miles from each other.

  Determinethe assymtotic complexity

Determinethe assymtotic complexity (Big Theta) int terms of n (not sum) for the following code fragment in the average case.

  Write a code fragment to find the hottest and coldest days

Declare an array of double of size 365 to store daily temperatures for one year. Using this data structure, write a code fragment to find the hottest and coldest days of the year. The average temperature of each month.

  Suppose you develop an algorithm that processes the first

consider searching algorithms on the following array of data 22 21 9 4 16 2 10 14 20 31 26 19 17 28 8 13 suppose you

  Using java, design and implement an api euclidean graph

Using Java, design and implement an API EuclideanGraph for graphs whose vertices are points in the plane that include coordinates.

  Construct minimal avl trees of height

Construct minimal AVL trees of height 0, 1, 2, 3, and 4. you do not need to fill in the values, just draw the structure of the tree. Tip: Use the recursive definition for the number of nodes in a minimal AVL tree.

  Portfolio website containing thumbnail imagery

Explain in general terms what you think the role of good design is. Next, recognize 3-characteristics of an effective gallery website. Then find an example of a portfolio website containing thumbnail imagery.

  Describe types of information systems

Describe five types of information systems, and give an example of each and describe 3 common reasons for a systems request. Try and find one not listed in the text.

  Using big-o notation state the runtime for this algorithm

1 consider searching algorithms on the following array of datanbsp22 21 9 4 16 2 10 14 20 31 26 19 17 28 8

  Write an algorithm that computes the depth-first search

Write an algorithm that computes the depth-first search in­ terval labeling scheme (see Subsection 4.4. 2) for an arbitrary connected net­ work. Can it be done in O(N) time units? Can it be done using O(N) messages?

  Find the average number of bits needed to encode

Suppose that the symbols are compressed using Huffman Coding and that the most likely symbol is encoded as a 0, determine the decompressed value of the following compressed string of bits?

  Write the algorithm which takes as input npda

Write the algorithm (described informally) which takes as input NPDA A and determines whether the language of A is nonempty.

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