Create an algorithm for solving the following version

Assignment Help JAVA Programming
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

Reference no: EM132109179

Questions Cloud

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.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create two functions that computes the given for each state

The data represents the Sales Tax information for the 50-city States in US. 'Create two functions that computes the following for each state.

  Create a javafx animated application

Create a JavaFX Animated Application named NeighborhoodDrive. Make sure your main class is called NeighborhoodDrive.

  Analyze a task and describe it succinctly

Programming the Familiar Good programmers are able to analyze a task and describe it succinctly, accurately, and unambiguously. Even tasks that you perform without much thought are surprisingly complex when you stop and consider all of their compo..

  Create pipe-and-filter network that will read data stream

Create a pipe-and-filter network that will read the data stream in FlightData.dat file, convert the temperature measurements from Fahrenheit to Celsius, and convert altitude from feet to meters - How would this impact the key quality attributes of ..

  Allows the user to specify a triangle with three mouse press

Write a program that allows the user to specify a triangle with three mouse presses. After the first mouse press, draw a small dot. After the second mouse press, draw a line joining the first two points. After the third mouse press, draw the entir..

  Create an if statement that is unconditionally true

Write short Java statements to complete each of the following tasks: Test whether variable x is less than 5. If it is, print "x is less than 5".

  Develop a console program for java on microsoft notepad

Develop a console program for JAVA on Microsoft notepad that simulates a section of a restaurant menu. Each item will have a different price and your program should define at least ten items.

  Write a java program that will play connect four

Write a java program that will play connect four - Must be a simple program no applets, jframes.

  Program that reads a number in inches converts it to meter

CMP 330 Data Structures & Algorithm Analysis - Write a Java program to convert temperature from Fahrenheit to Celsius degree

  Write code to store fictitious names in that array

An office building has two floors (0 to 1), each of which has four offices (0 to 3). Each office occupied by one person. Declare an array to store the names of occupants for each office. Write code to store fictitious names in that array

  Document the current application describing major classes

Add to the Project Management tool the different planned activities needed to implement the changes to the solution and document the current application describing the major classes used by the application.

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

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