Reference no: EM132109179
In this programming exercise you will create an algorithm for solving the following version of the m Smallest Numbers problem. Instead of just returning the m smallest values as in homework 1, you want to return a list of the positions where the m smallest values are located without changing the original array.
Your algorithm should meet the following specifications:
mSmallest( L[1..n], m )
Pre: L is a list of distinct integer values. n is the number of elements in the list. 0 < m = n
Post: A list [p1, p2, ..., pm] has been returned where pj is the position of the jth smallest element of L. The original list L has not been changed.
Determine the time complexity and space complexity of your algorithm.
Use C++, Java or Python to implement your algorithm. Your program should:
prompt the user to enter the list of numbers
prompt the user to enter the value for m
print a list of the positions where the m smallest values are located.
You may assume that the elements of the list are unique.
Turn in your algorithm and your complexity analysis
Prepapre a database of books that are stored using a vector
: Create a database of books that are stored using a vector. Keep track of the author, title, and publication date of each book.
|
What is the big deal with this as far as complex projects
: what is the big deal with this as far as complex projects are concerned? Surely it is a common characteristic of project management and those whom practice
|
Write a function that would be used in a recursive-descent
: "Given a production, write a function that would be used in a recursive-descent parser for handling that production."
|
Write a program that transmits a series of characters
: The sequence will consist of "AlphaNumber", where Alpha is meant to be a letter, cycling from A to Z, and Number is a digit that cycles through 0 to 9.
|
Create an algorithm for solving the following version
: Create an algorithm for solving the following version of the m Smallest Numbers problem. Instead of just returning the m smallest values.
|
Compute the january balance for hulse in accounts payable
: Hulse's sales journal for January shows a total of $111,109 in the selling price column, Compute the January balance for Hulse in Accounts Payable
|
Write a program in java to replace the word
: If a word ends in 'a', append an 'r'. For example "tuna" becomes "tunar", "Cuba" becomes "Cubar", and "idea" becomes "idear".
|
List the phrases and simple phrases and the handle
: Show the parse tree for the expression: ((id + id) * id) + id . List the phrases, simple phrases, and the handle.
|
Implement a recursive function static boolean
: We have a set of coins of arbitrary positive values and want to see whether a given nonnegative total can be made using a some subset of the coins.
|