SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 210 Weeks Ago, 6 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 15 Oct 2017 My Price 9.00

Your program should read a text file containing integer values from standard input (System.in in Java, std::cin in C++).

plz correct my code.

 

Your program should read a text file containing integer values from standard input (System.in in Java, std::cin in C++). Values may be stored in the "int" type in either language. The values should be placed in an array (ArrayList in Java, std::vector in C++). After all the values have been read and stored in the array, they should be sorted using Insertion Sort.

You must write code for Insertion Sort; you may not use any library routines for the sort. When writing your code, modeled on the pseudo-code in the book, don't forget that the pseudo-code uses array indices starting at 1, while Java and C++ start array indices at 0, so you'll need to make some adjustments to the algorithm.

After sorting the input values, your program should print all the values to standard output (System.out in Java, std::cout in C++), one per line. No other output should be written to standard output.

Input Format

The input is a text file with one or more signed base 10 integers per line, separated by white space (blanks and tabs). For Java, this format can easily be read using the Scanner class method nextInt. For C++, the << operator used with std::cin will easily read this format. Your program should be able to handle an arbitrary number of input values.

Here's an example of what the input might look like (larger sample inputs will be provided later in the week):

54 29    45012  -2304
124555
-32768
11 9999 0       29
    88

Note that duplicate values are allowed in the input.

Output Format

For the example above, your output should look like this:

-32768
-2304
0
11
29
29
54
88
9999
45012
124555

Answers

(5)
Status NEW Posted 15 Oct 2017 09:10 AM My Price 9.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)