Design and implement a sorting algorithm

Assignment Help JAVA Programming
Reference no: EM1380172

Your task is to design and implement a sorting algorithm

Algorithm that can sort nonnegative integers that fall within some limit, L

You will have a large array of numbers, of size N
e.g. N=10,000, L=20:
you have 10,000 numbers to sort, but the numbers are only from 0...20 range

You should design an algorithm that works in 0(N+L) time, that is, running time grows as a linear function of the array size, as long as L is not changed

It may be helpful to use one of the Majority Algorithms for inspiration in your thinking about the algorithm

Take integers from standard input (System.in):

Line 1 - single integer specifying number N<=100000 of elements in array 10
Line 2 - single integer specifying the number 1 L<=100, limit on the value of the integers to 7 be sorted 10
Lines 3 to N+2 - integers to be sorted, each 7 in range 0 to L 1

output sorted array to standard output (System.out), with each integer on a separate line

 

Reference no: EM1380172

Questions Cloud

Java program to make choice for a coffee cup size : Create an application that prompts the user to make a choice for a Coffee cup size, S for Small, T for Tall, G for Grande and V for Venti the rates of cup sizes will be stored in a parallel double array as $2, $2.50, $3.25, and $4.50 respectively.
Preparing a java program : Prepare a program that asks the user how many automobiles are to be explained, and for each automobile it inputs the user's selection of make and color.
Creating villian : Announce a new Villian called sharpay who has a wit of 24, a stealth of sixteen, and who has currently claimed three victims: Chad, Troy, and Gabriella.
Creating a class for services : Make a class for services offered by a hair styling salon. Information fields with a String to hold the service description, a double to hold the price, and an integer to hold average number of minutes it takes to perform the service.
Design and implement a sorting algorithm : Your task is to design and implement a sorting algorithm and running time grows as a linear function of the array
Important java questions : Add a method addText to the Question class, and provide a different implementation of Choice Question that calls add Text rather than storing an array list of selections.
Benefits of dynamic over static arrays : Discuss the benefits of dynamic over-static arrays. Under what conditions will you choose dynamic arrays?
Creating class diagram : Think about a computer system used to manage loans for a library. Libraries loan books, CDs, videos and magazines to registered members.
Creating flowchart to compute and print the total sale : A coorporation's salesman are selling toothpaste and tooth powder. The corporation having fifty salesman gives 10% commission on the sale of toothpaste and 20 percent commission on tooth powder.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Finding java code error

Indicate in the given code segment if an error occurs. If so, point to whether it is syntax, runtime or logic and how you would fix it.

  Write java program using array list object

Write a java program (using eclipse) using ArrayList object to allow the professor to enter student's name, his or her's four test scores.

  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.

  Prepare a java simulation program

Given a hash function h, prepare a java simulation program to determine each of the subsequent quantities after 0.8*tablesize random keys have been generated. The keys should be random integers.

  Methods

Assignment describe the basic working of methods. How to write a method in java and how to call a method.

  Write various bindings to determine semantics

Write the various bindings that are required to determine the semantics when statement is executed. For each binding, indicate binding time used for language. Describe your answer.

  Java method that contains code to be executed

Write a short Java method that contains code for which it is probably impossible for that code to ever be executed, but your favorite Java compiler does not detect this fact.

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  The frantic pipe layer game

Design the Frantic Pipe Layer game

  Function using javascript syntax to compute gross pay

Write a function using JavaScript syntax to compute a person's gross pay for a week. The function must receive the number of hours worked and the rate of pay per hour.

  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".

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

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