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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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