Question

fix my code please. program should output the original array and sorted array then time taken for sorting. there's no error in my code but it keeps presenting 0.0 or some weird values as output. just edit my code please. c++

Original Text file: 0.0 8.0 .0 .0 8.0 0.0 0.0 0.0 0.0 0.03 20 ᎧᎧ ᎧᎧ Ꭷ, -1443689659148581994496.0 _0.0 0.0 0.0 -14436446231523

#include <iostream>
#include <string>       //string
#include <fstream>       //file buffer
#include <iomanip>       //setprecision

using namespace std;

class BubbleSort
{

private:
   float array[1000];

public:
   void read()
   {
       string str;
       string s;
       int n = 0;

       ifstream file("descending_mostly_sorted.txt");   //read from a txt file

       getline(file, s, '{');
       cout << s << endl << endl << endl;

       //check if file is opened
       if(file.is_open())
       {
           //read numbers from file to the array
           while((!file.eof()) && (n < 1000))
           {  
               getline(file, str, ',');

               float fvar = stof(str);       //string to float
               array[n] = fvar;
               n++;
           }
           file.close();   //close the file
       }
   }

   void bubbleSort()
   {
       //declare variables
       int i, j;
       float temp;
       for(i = 1; i < 1000; i++)
       {
           for(j = 0; j < 1000 - 1; j++)
           {
               if(array[j] > array[j + 1])
               {
                   temp = array[j];       //temp the array[j] and array[j+1]
                   array[j] = array[j + 1];
                   array[j + 1] = temp;  
               }
           }
       }
   }

   void print()
   {
       for(int i = 0; i < 1000; i++)
       {
           cout << fixed << setprecision(1) << array[i] << " ";
           if((i + 1) % 10 == 0)       //change line after 10 values
           {
               cout << endl;
           }
       }
   }
};

//main function to execute functions
int main()
{
   int n = 0;
   long timeElapsed;       //store time
   clock_t start, end;    //start and end time

   BubbleSort bs;

   cout << "\n\nOriginal Text file: \n" << endl;

   bs.read();       //read function
   bs.print();       //print the data

   start = clock();       //count start time
   bs.bubbleSort();       //bubble sort
   end = clock();           //count end time

   timeElapsed = end - start;   //get time taken

   cout << "\n\nSorted Array: \n" << endl;
   bs.print();           //print sorted array
   cout << "\nTime taken for Bubble Sort: "   //print time taken
        << timeElapsed << " milliseconds.\n\n\n";
}

================== "descending_mostly_sorted.txt" (use this text file)=====================

Mostly Sorted Descending
1000 values

{1001000.0, 10000.0, 9990.0, 9980.0, 9970.0, 9960.0, 9950.0, 9940.0, 9930.0, 9920.0, 9910.0, 9900.0, 9890.0, 9880.0, 9870.0, 9860.0, 9850.0, 9840.0, 9830.0, 9820.0, 9810.0, 9800.0, 9790.0, 9780.0, 9770.0, 976000.0, 9750.0, 9740.0, 9730.0, 9720.0, 9710.0, 9700.0, 9690.0, 9680.0, 9670.0, 9660.0, 9650.0, 9640.0, 9630.0, 9620.0, 9610.0, 9600.0, 9590.0, 9580.0, 9570.0, 9560.0, 9550.0, 9540.0, 9530.0, 9520.0, 951000.0, 9500.0, 9490.0, 9480.0, 9470.0, 9460.0, 9450.0, 9440.0, 9430.0, 9420.0, 9410.0, 9400.0, 9390.0, 9380.0, 9370.0, 9360.0, 9350.0, 9340.0, 9330.0, 9320.0, 9310.0, 9300.0, 9290.0, 9280.0, 9270.0, 926000.0, 9250.0, 9240.0, 9230.0, 9220.0, 9210.0, 9200.0, 9190.0, 9180.0, 9170.0, 9160.0, 9150.0, 9140.0, 9130.0, 9120.0, 9110.0, 9100.0, 9090.0, 9080.0, 9070.0, 9060.0, 9050.0, 9040.0, 9030.0, 9020.0, 901000.0, 9000.0, 8990.0, 8980.0, 8970.0, 8960.0, 8950.0, 8940.0, 8930.0, 8920.0, 8910.0, 8900.0, 8890.0, 8880.0, 8870.0, 8860.0, 8850.0, 8840.0, 8830.0, 8820.0, 8810.0, 8800.0, 8790.0, 8780.0, 8770.0, 876000.0, 8750.0, 8740.0, 8730.0, 8720.0, 8710.0, 8700.0, 8690.0, 8680.0, 8670.0, 8660.0, 8650.0, 8640.0, 8630.0, 8620.0, 8610.0, 8600.0, 8590.0, 8580.0, 8570.0, 8560.0, 8550.0, 8540.0, 8530.0, 8520.0, 851000.0, 8500.0, 8490.0, 8480.0, 8470.0, 8460.0, 8450.0, 8440.0, 8430.0, 8420.0, 8410.0, 8400.0, 8390.0, 8380.0, 8370.0, 8360.0, 8350.0, 8340.0, 8330.0, 8320.0, 8310.0, 8300.0, 8290.0, 8280.0, 8270.0, 826000.0, 8250.0, 8240.0, 8230.0, 8220.0, 8210.0, 8200.0, 8190.0, 8180.0, 8170.0, 8160.0, 8150.0, 8140.0, 8130.0, 8120.0, 8110.0, 8100.0, 8090.0, 8080.0, 8070.0, 8060.0, 8050.0, 8040.0, 8030.0, 8020.0, 801000.0, 8000.0, 7990.0, 7980.0, 7970.0, 7960.0, 7950.0, 7940.0, 7930.0, 7920.0, 7910.0, 7900.0, 7890.0, 7880.0, 7870.0, 7860.0, 7850.0, 7840.0, 7830.0, 7820.0, 7810.0, 7800.0, 7790.0, 7780.0, 7770.0, 776000.0, 7750.0, 7740.0, 7730.0, 7720.0, 7710.0, 7700.0, 7690.0, 7680.0, 7670.0, 7660.0, 7650.0, 7640.0, 7630.0, 7620.0, 7610.0, 7600.0, 7590.0, 7580.0, 7570.0, 7560.0, 7550.0, 7540.0, 7530.0, 7520.0, 751000.0, 7500.0, 7490.0, 7480.0, 7470.0, 7460.0, 7450.0, 7440.0, 7430.0, 7420.0, 7410.0, 7400.0, 7390.0, 7380.0, 7370.0, 7360.0, 7350.0, 7340.0, 7330.0, 7320.0, 7310.0, 7300.0, 7290.0, 7280.0, 7270.0, 726000.0, 7250.0, 7240.0, 7230.0, 7220.0, 7210.0, 7200.0, 7190.0, 7180.0, 7170.0, 7160.0, 7150.0, 7140.0, 7130.0, 7120.0, 7110.0, 7100.0, 7090.0, 7080.0, 7070.0, 7060.0, 7050.0, 7040.0, 7030.0, 7020.0, 701000.0, 7000.0, 6990.0, 6980.0, 6970.0, 6960.0, 6950.0, 6940.0, 6930.0, 6920.0, 6910.0, 6900.0, 6890.0, 6880.0, 6870.0, 6860.0, 6850.0, 6840.0, 6830.0, 6820.0, 6810.0, 6800.0, 6790.0, 6780.0, 6770.0, 676000.0, 6750.0, 6740.0, 6730.0, 6720.0, 6710.0, 6700.0, 6690.0, 6680.0, 6670.0, 6660.0, 6650.0, 6640.0, 6630.0, 6620.0, 6610.0, 6600.0, 6590.0, 6580.0, 6570.0, 6560.0, 6550.0, 6540.0, 6530.0, 6520.0, 651000.0, 6500.0, 6490.0, 6480.0, 6470.0, 6460.0, 6450.0, 6440.0, 6430.0, 6420.0, 6410.0, 6400.0, 6390.0, 6380.0, 6370.0, 6360.0, 6350.0, 6340.0, 6330.0, 6320.0, 6310.0, 6300.0, 6290.0, 6280.0, 6270.0, 626000.0, 6250.0, 6240.0, 6230.0, 6220.0, 6210.0, 6200.0, 6190.0, 6180.0, 6170.0, 6160.0, 6150.0, 6140.0, 6130.0, 6120.0, 6110.0, 6100.0, 6090.0, 6080.0, 6070.0, 6060.0, 6050.0, 6040.0, 6030.0, 6020.0, 601000.0, 6000.0, 5990.0, 5980.0, 5970.0, 5960.0, 5950.0, 5940.0, 5930.0, 5920.0, 5910.0, 5900.0, 5890.0, 5880.0, 5870.0, 5860.0, 5850.0, 5840.0, 5830.0, 5820.0, 5810.0, 5800.0, 5790.0, 5780.0, 5770.0, 576000.0, 5750.0, 5740.0, 5730.0, 5720.0, 5710.0, 5700.0, 5690.0, 5680.0, 5670.0, 5660.0, 5650.0, 5640.0, 5630.0, 5620.0, 5610.0, 5600.0, 5590.0, 5580.0, 5570.0, 5560.0, 5550.0, 5540.0, 5530.0, 5520.0, 551000.0, 5500.0, 5490.0, 5480.0, 5470.0, 5460.0, 5450.0, 5440.0, 5430.0, 5420.0, 5410.0, 5400.0, 5390.0, 5380.0, 5370.0, 5360.0, 5350.0, 5340.0, 5330.0, 5320.0, 5310.0, 5300.0, 5290.0, 5280.0, 5270.0, 526000.0, 5250.0, 5240.0, 5230.0, 5220.0, 5210.0, 5200.0, 5190.0, 5180.0, 5170.0, 5160.0, 5150.0, 5140.0, 5130.0, 5120.0, 5110.0, 5100.0, 5090.0, 5080.0, 5070.0, 5060.0, 5050.0, 5040.0, 5030.0, 5020.0, 501000.0, 5000.0, 4990.0, 4980.0, 4970.0, 4960.0, 4950.0, 4940.0, 4930.0, 4920.0, 4910.0, 4900.0, 4890.0, 4880.0, 4870.0, 4860.0, 4850.0, 4840.0, 4830.0, 4820.0, 4810.0, 4800.0, 4790.0, 4780.0, 4770.0, 476000.0, 4750.0, 4740.0, 4730.0, 4720.0, 4710.0, 4700.0, 4690.0, 4680.0, 4670.0, 4660.0, 4650.0, 4640.0, 4630.0, 4620.0, 4610.0, 4600.0, 4590.0, 4580.0, 4570.0, 4560.0, 4550.0, 4540.0, 4530.0, 4520.0, 451000.0, 4500.0, 4490.0, 4480.0, 4470.0, 4460.0, 4450.0, 4440.0, 4430.0, 4420.0, 4410.0, 4400.0, 4390.0, 4380.0, 4370.0, 4360.0, 4350.0, 4340.0, 4330.0, 4320.0, 4310.0, 4300.0, 4290.0, 4280.0, 4270.0, 426000.0, 4250.0, 4240.0, 4230.0, 4220.0, 4210.0, 4200.0, 4190.0, 4180.0, 4170.0, 4160.0, 4150.0, 4140.0, 4130.0, 4120.0, 4110.0, 4100.0, 4090.0, 4080.0, 4070.0, 4060.0, 4050.0, 4040.0, 4030.0, 4020.0, 401000.0, 4000.0, 3990.0, 3980.0, 3970.0, 3960.0, 3950.0, 3940.0, 3930.0, 3920.0, 3910.0, 3900.0, 3890.0, 3880.0, 3870.0, 3860.0, 3850.0, 3840.0, 3830.0, 3820.0, 3810.0, 3800.0, 3790.0, 3780.0, 3770.0, 376000.0, 3750.0, 3740.0, 3730.0, 3720.0, 3710.0, 3700.0, 3690.0, 3680.0, 3670.0, 3660.0, 3650.0, 3640.0, 3630.0, 3620.0, 3610.0, 3600.0, 3590.0, 3580.0, 3570.0, 3560.0, 3550.0, 3540.0, 3530.0, 3520.0, 351000.0, 3500.0, 3490.0, 3480.0, 3470.0, 3460.0, 3450.0, 3440.0, 3430.0, 3420.0, 3410.0, 3400.0, 3390.0, 3380.0, 3370.0, 3360.0, 3350.0, 3340.0, 3330.0, 3320.0, 3310.0, 3300.0, 3290.0, 3280.0, 3270.0, 326000.0, 3250.0, 3240.0, 3230.0, 3220.0, 3210.0, 3200.0, 3190.0, 3180.0, 3170.0, 3160.0, 3150.0, 3140.0, 3130.0, 3120.0, 3110.0, 3100.0, 3090.0, 3080.0, 3070.0, 3060.0, 3050.0, 3040.0, 3030.0, 3020.0, 301000.0, 3000.0, 2990.0, 2980.0, 2970.0, 2960.0, 2950.0, 2940.0, 2930.0, 2920.0, 2910.0, 2900.0, 2890.0, 2880.0, 2870.0, 2860.0, 2850.0, 2840.0, 2830.0, 2820.0, 2810.0, 2800.0, 2790.0, 2780.0, 2770.0, 276000.0, 2750.0, 2740.0, 2730.0, 2720.0, 2710.0, 2700.0, 2690.0, 2680.0, 2670.0, 2660.0, 2650.0, 2640.0, 2630.0, 2620.0, 2610.0, 2600.0, 2590.0, 2580.0, 2570.0, 2560.0, 2550.0, 2540.0, 2530.0, 2520.0, 251000.0, 2500.0, 2490.0, 2480.0, 2470.0, 2460.0, 2450.0, 2440.0, 2430.0, 2420.0, 2410.0, 2400.0, 2390.0, 2380.0, 2370.0, 2360.0, 2350.0, 2340.0, 2330.0, 2320.0, 2310.0, 2300.0, 2290.0, 2280.0, 2270.0, 226000.0, 2250.0, 2240.0, 2230.0, 2220.0, 2210.0, 2200.0, 2190.0, 2180.0, 2170.0, 2160.0, 2150.0, 2140.0, 2130.0, 2120.0, 2110.0, 2100.0, 2090.0, 2080.0, 2070.0, 2060.0, 2050.0, 2040.0, 2030.0, 2020.0, 201000.0, 2000.0, 1990.0, 1980.0, 1970.0, 1960.0, 1950.0, 1940.0, 1930.0, 1920.0, 1910.0, 1900.0, 1890.0, 1880.0, 1870.0, 1860.0, 1850.0, 1840.0, 1830.0, 1820.0, 1810.0, 1800.0, 1790.0, 1780.0, 1770.0, 176000.0, 1750.0, 1740.0, 1730.0, 1720.0, 1710.0, 1700.0, 1690.0, 1680.0, 1670.0, 1660.0, 1650.0, 1640.0, 1630.0, 1620.0, 1610.0, 1600.0, 1590.0, 1580.0, 1570.0, 1560.0, 1550.0, 1540.0, 1530.0, 1520.0, 151000.0, 1500.0, 1490.0, 1480.0, 1470.0, 1460.0, 1450.0, 1440.0, 1430.0, 1420.0, 1410.0, 1400.0, 1390.0, 1380.0, 1370.0, 1360.0, 1350.0, 1340.0, 1330.0, 1320.0, 1310.0, 1300.0, 1290.0, 1280.0, 1270.0, 126000.0, 1250.0, 1240.0, 1230.0, 1220.0, 1210.0, 1200.0, 1190.0, 1180.0, 1170.0, 1160.0, 1150.0, 1140.0, 1130.0, 1120.0, 1110.0, 1100.0, 1090.0, 1080.0, 1070.0, 1060.0, 1050.0, 1040.0, 1030.0, 1020.0, 101000.0, 1000.0, 990.0, 980.0, 970.0, 960.0, 950.0, 940.0, 930.0, 920.0, 910.0, 900.0, 890.0, 880.0, 870.0, 860.0, 850.0, 840.0, 830.0, 820.0, 810.0, 800.0, 790.0, 780.0, 770.0, 76000.0, 750.0, 740.0, 730.0, 720.0, 710.0, 700.0, 690.0, 680.0, 670.0, 660.0, 650.0, 640.0, 630.0, 620.0, 610.0, 600.0, 590.0, 580.0, 570.0, 560.0, 550.0, 540.0, 530.0, 520.0, 51000.0, 500.0, 490.0, 480.0, 470.0, 460.0, 450.0, 440.0, 430.0, 420.0, 410.0, 400.0, 390.0, 380.0, 370.0, 360.0, 350.0, 340.0, 330.0, 320.0, 310.0, 300.0, 290.0, 280.0, 270.0, 26000.0, 250.0, 240.0, 230.0, 220.0, 210.0, 200.0, 190.0, 180.0, 170.0, 160.0, 150.0, 140.0, 130.0, 120.0, 110.0, 100.0, 90.0, 80.0, 70.0, 60.0, 50.0, 40.0, 30.0, 20.0}

0 0
Add a comment Improve this question Transcribed image text
Answer #1


In my system the following code workde just fine. Try running the following code. If it does not work, try switching to C++14. My C++ version is 14. SO, it is suggested.

CODE:

#include <iostream>
#include <string> //string
#include <fstream> //file buffer
#include <iomanip> //setprecision
using namespace std;
class BubbleSort
{
private:
float array[1000];
public:
void read()
{
string str;
string s;
int n = 0;
ifstream file("descending_mostly_sorted.txt"); //read from a txt file
getline(file, s, '{');
cout << s << endl << endl << endl;
//check if file is opened
if(file.is_open())
{
//read numbers from file to the array
while((!file.eof()) && (n < 1000))
{
getline(file, str, ',');
float fvar = stof(str); //string to float
array[n] = fvar;
n++;
}
file.close(); //close the file
}
}
void bubbleSort()
{
//declare variables
int i, j;
float temp;
for(i = 1; i < 1000; i++)
{
for(j = 0; j < 1000 - 1; j++)
{
if(array[j] > array[j + 1])
{
temp = array[j]; //temp the array[j] and array[j+1]
array[j] = array[j + 1];
array[j + 1] = temp;
}
}
}
}
void print()
{
for(int i = 0; i < 1000; i++)
{
cout << fixed << setprecision(1) << array[i] << " ";
if((i + 1) % 10 == 0) //change line after 10 values
{
cout << endl;
}
}
}
};

//main function to execute functions
int main()
{
int n = 0;
long timeElapsed; //store time
clock_t start, end; //start and end time
BubbleSort bs;
cout << "\n\nOriginal Text file: \n" << endl;
bs.read(); //read function
bs.print(); //print the data
start = clock(); //count start time
bs.bubbleSort(); //bubble sort
end = clock(); //count end time
timeElapsed = end - start; //get time taken
cout << "\n\nSorted Array: \n" << endl;
bs.print(); //print sorted array
cout << "\nTime taken for Bubble Sort: " //print time taken
<< timeElapsed << " milliseconds.\n\n\n";
}

3 #include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; class BubbleSort //stringfile.close(); //close the file void bubbleSort() //declare variables int i, j; float temp; for(i = 1; i < 1000; i++) for(j =for(int i = 0; i < 1000; i++) cout << fixed « setprecision(1) << array[i] << ; if((i + 1) % 10 == 0) //change line after 1

INPUT: In file " descending_mostly_sorted.txt":

Mostly Sorted Descending
1000 values
{1001000.0, 10000.0, 9990.0, 9980.0, 9970.0, 9960.0, 9950.0, 9940.0, 9930.0, 9920.0, 9910.0, 9900.0, 9890.0, 9880.0, 9870.0, 9860.0, 9850.0, 9840.0, 9830.0, 9820.0, 9810.0, 9800.0, 9790.0, 9780.0, 9770.0, 976000.0, 9750.0, 9740.0, 9730.0, 9720.0, 9710.0, 9700.0, 9690.0, 9680.0, 9670.0, 9660.0, 9650.0, 9640.0, 9630.0, 9620.0, 9610.0, 9600.0, 9590.0, 9580.0, 9570.0, 9560.0, 9550.0, 9540.0, 9530.0, 9520.0, 951000.0, 9500.0, 9490.0, 9480.0, 9470.0, 9460.0, 9450.0, 9440.0, 9430.0, 9420.0, 9410.0, 9400.0, 9390.0, 9380.0, 9370.0, 9360.0, 9350.0, 9340.0, 9330.0, 9320.0, 9310.0, 9300.0, 9290.0, 9280.0, 9270.0, 926000.0, 9250.0, 9240.0, 9230.0, 9220.0, 9210.0, 9200.0, 9190.0, 9180.0, 9170.0, 9160.0, 9150.0, 9140.0, 9130.0, 9120.0, 9110.0, 9100.0, 9090.0, 9080.0, 9070.0, 9060.0, 9050.0, 9040.0, 9030.0, 9020.0, 901000.0, 9000.0, 8990.0, 8980.0, 8970.0, 8960.0, 8950.0, 8940.0, 8930.0, 8920.0, 8910.0, 8900.0, 8890.0, 8880.0, 8870.0, 8860.0, 8850.0, 8840.0, 8830.0, 8820.0, 8810.0, 8800.0, 8790.0, 8780.0, 8770.0, 876000.0, 8750.0, 8740.0, 8730.0, 8720.0, 8710.0, 8700.0, 8690.0, 8680.0, 8670.0, 8660.0, 8650.0, 8640.0, 8630.0, 8620.0, 8610.0, 8600.0, 8590.0, 8580.0, 8570.0, 8560.0, 8550.0, 8540.0, 8530.0, 8520.0, 851000.0, 8500.0, 8490.0, 8480.0, 8470.0, 8460.0, 8450.0, 8440.0, 8430.0, 8420.0, 8410.0, 8400.0, 8390.0, 8380.0, 8370.0, 8360.0, 8350.0, 8340.0, 8330.0, 8320.0, 8310.0, 8300.0, 8290.0, 8280.0, 8270.0, 826000.0, 8250.0, 8240.0, 8230.0, 8220.0, 8210.0, 8200.0, 8190.0, 8180.0, 8170.0, 8160.0, 8150.0, 8140.0, 8130.0, 8120.0, 8110.0, 8100.0, 8090.0, 8080.0, 8070.0, 8060.0, 8050.0, 8040.0, 8030.0, 8020.0, 801000.0, 8000.0, 7990.0, 7980.0, 7970.0, 7960.0, 7950.0, 7940.0, 7930.0, 7920.0, 7910.0, 7900.0, 7890.0, 7880.0, 7870.0, 7860.0, 7850.0, 7840.0, 7830.0, 7820.0, 7810.0, 7800.0, 7790.0, 7780.0, 7770.0, 776000.0, 7750.0, 7740.0, 7730.0, 7720.0, 7710.0, 7700.0, 7690.0, 7680.0, 7670.0, 7660.0, 7650.0, 7640.0, 7630.0, 7620.0, 7610.0, 7600.0, 7590.0, 7580.0, 7570.0, 7560.0, 7550.0, 7540.0, 7530.0, 7520.0, 751000.0, 7500.0, 7490.0, 7480.0, 7470.0, 7460.0, 7450.0, 7440.0, 7430.0, 7420.0, 7410.0, 7400.0, 7390.0, 7380.0, 7370.0, 7360.0, 7350.0, 7340.0, 7330.0, 7320.0, 7310.0, 7300.0, 7290.0, 7280.0, 7270.0, 726000.0, 7250.0, 7240.0, 7230.0, 7220.0, 7210.0, 7200.0, 7190.0, 7180.0, 7170.0, 7160.0, 7150.0, 7140.0, 7130.0, 7120.0, 7110.0, 7100.0, 7090.0, 7080.0, 7070.0, 7060.0, 7050.0, 7040.0, 7030.0, 7020.0, 701000.0, 7000.0, 6990.0, 6980.0, 6970.0, 6960.0, 6950.0, 6940.0, 6930.0, 6920.0, 6910.0, 6900.0, 6890.0, 6880.0, 6870.0, 6860.0, 6850.0, 6840.0, 6830.0, 6820.0, 6810.0, 6800.0, 6790.0, 6780.0, 6770.0, 676000.0, 6750.0, 6740.0, 6730.0, 6720.0, 6710.0, 6700.0, 6690.0, 6680.0, 6670.0, 6660.0, 6650.0, 6640.0, 6630.0, 6620.0, 6610.0, 6600.0, 6590.0, 6580.0, 6570.0, 6560.0, 6550.0, 6540.0, 6530.0, 6520.0, 651000.0, 6500.0, 6490.0, 6480.0, 6470.0, 6460.0, 6450.0, 6440.0, 6430.0, 6420.0, 6410.0, 6400.0, 6390.0, 6380.0, 6370.0, 6360.0, 6350.0, 6340.0, 6330.0, 6320.0, 6310.0, 6300.0, 6290.0, 6280.0, 6270.0, 626000.0, 6250.0, 6240.0, 6230.0, 6220.0, 6210.0, 6200.0, 6190.0, 6180.0, 6170.0, 6160.0, 6150.0, 6140.0, 6130.0, 6120.0, 6110.0, 6100.0, 6090.0, 6080.0, 6070.0, 6060.0, 6050.0, 6040.0, 6030.0, 6020.0, 601000.0, 6000.0, 5990.0, 5980.0, 5970.0, 5960.0, 5950.0, 5940.0, 5930.0, 5920.0, 5910.0, 5900.0, 5890.0, 5880.0, 5870.0, 5860.0, 5850.0, 5840.0, 5830.0, 5820.0, 5810.0, 5800.0, 5790.0, 5780.0, 5770.0, 576000.0, 5750.0, 5740.0, 5730.0, 5720.0, 5710.0, 5700.0, 5690.0, 5680.0, 5670.0, 5660.0, 5650.0, 5640.0, 5630.0, 5620.0, 5610.0, 5600.0, 5590.0, 5580.0, 5570.0, 5560.0, 5550.0, 5540.0, 5530.0, 5520.0, 551000.0, 5500.0, 5490.0, 5480.0, 5470.0, 5460.0, 5450.0, 5440.0, 5430.0, 5420.0, 5410.0, 5400.0, 5390.0, 5380.0, 5370.0, 5360.0, 5350.0, 5340.0, 5330.0, 5320.0, 5310.0, 5300.0, 5290.0, 5280.0, 5270.0, 526000.0, 5250.0, 5240.0, 5230.0, 5220.0, 5210.0, 5200.0, 5190.0, 5180.0, 5170.0, 5160.0, 5150.0, 5140.0, 5130.0, 5120.0, 5110.0, 5100.0, 5090.0, 5080.0, 5070.0, 5060.0, 5050.0, 5040.0, 5030.0, 5020.0, 501000.0, 5000.0, 4990.0, 4980.0, 4970.0, 4960.0, 4950.0, 4940.0, 4930.0, 4920.0, 4910.0, 4900.0, 4890.0, 4880.0, 4870.0, 4860.0, 4850.0, 4840.0, 4830.0, 4820.0, 4810.0, 4800.0, 4790.0, 4780.0, 4770.0, 476000.0, 4750.0, 4740.0, 4730.0, 4720.0, 4710.0, 4700.0, 4690.0, 4680.0, 4670.0, 4660.0, 4650.0, 4640.0, 4630.0, 4620.0, 4610.0, 4600.0, 4590.0, 4580.0, 4570.0, 4560.0, 4550.0, 4540.0, 4530.0, 4520.0, 451000.0, 4500.0, 4490.0, 4480.0, 4470.0, 4460.0, 4450.0, 4440.0, 4430.0, 4420.0, 4410.0, 4400.0, 4390.0, 4380.0, 4370.0, 4360.0, 4350.0, 4340.0, 4330.0, 4320.0, 4310.0, 4300.0, 4290.0, 4280.0, 4270.0, 426000.0, 4250.0, 4240.0, 4230.0, 4220.0, 4210.0, 4200.0, 4190.0, 4180.0, 4170.0, 4160.0, 4150.0, 4140.0, 4130.0, 4120.0, 4110.0, 4100.0, 4090.0, 4080.0, 4070.0, 4060.0, 4050.0, 4040.0, 4030.0, 4020.0, 401000.0, 4000.0, 3990.0, 3980.0, 3970.0, 3960.0, 3950.0, 3940.0, 3930.0, 3920.0, 3910.0, 3900.0, 3890.0, 3880.0, 3870.0, 3860.0, 3850.0, 3840.0, 3830.0, 3820.0, 3810.0, 3800.0, 3790.0, 3780.0, 3770.0, 376000.0, 3750.0, 3740.0, 3730.0, 3720.0, 3710.0, 3700.0, 3690.0, 3680.0, 3670.0, 3660.0, 3650.0, 3640.0, 3630.0, 3620.0, 3610.0, 3600.0, 3590.0, 3580.0, 3570.0, 3560.0, 3550.0, 3540.0, 3530.0, 3520.0, 351000.0, 3500.0, 3490.0, 3480.0, 3470.0, 3460.0, 3450.0, 3440.0, 3430.0, 3420.0, 3410.0, 3400.0, 3390.0, 3380.0, 3370.0, 3360.0, 3350.0, 3340.0, 3330.0, 3320.0, 3310.0, 3300.0, 3290.0, 3280.0, 3270.0, 326000.0, 3250.0, 3240.0, 3230.0, 3220.0, 3210.0, 3200.0, 3190.0, 3180.0, 3170.0, 3160.0, 3150.0, 3140.0, 3130.0, 3120.0, 3110.0, 3100.0, 3090.0, 3080.0, 3070.0, 3060.0, 3050.0, 3040.0, 3030.0, 3020.0, 301000.0, 3000.0, 2990.0, 2980.0, 2970.0, 2960.0, 2950.0, 2940.0, 2930.0, 2920.0, 2910.0, 2900.0, 2890.0, 2880.0, 2870.0, 2860.0, 2850.0, 2840.0, 2830.0, 2820.0, 2810.0, 2800.0, 2790.0, 2780.0, 2770.0, 276000.0, 2750.0, 2740.0, 2730.0, 2720.0, 2710.0, 2700.0, 2690.0, 2680.0, 2670.0, 2660.0, 2650.0, 2640.0, 2630.0, 2620.0, 2610.0, 2600.0, 2590.0, 2580.0, 2570.0, 2560.0, 2550.0, 2540.0, 2530.0, 2520.0, 251000.0, 2500.0, 2490.0, 2480.0, 2470.0, 2460.0, 2450.0, 2440.0, 2430.0, 2420.0, 2410.0, 2400.0, 2390.0, 2380.0, 2370.0, 2360.0, 2350.0, 2340.0, 2330.0, 2320.0, 2310.0, 2300.0, 2290.0, 2280.0, 2270.0, 226000.0, 2250.0, 2240.0, 2230.0, 2220.0, 2210.0, 2200.0, 2190.0, 2180.0, 2170.0, 2160.0, 2150.0, 2140.0, 2130.0, 2120.0, 2110.0, 2100.0, 2090.0, 2080.0, 2070.0, 2060.0, 2050.0, 2040.0, 2030.0, 2020.0, 201000.0, 2000.0, 1990.0, 1980.0, 1970.0, 1960.0, 1950.0, 1940.0, 1930.0, 1920.0, 1910.0, 1900.0, 1890.0, 1880.0, 1870.0, 1860.0, 1850.0, 1840.0, 1830.0, 1820.0, 1810.0, 1800.0, 1790.0, 1780.0, 1770.0, 176000.0, 1750.0, 1740.0, 1730.0, 1720.0, 1710.0, 1700.0, 1690.0, 1680.0, 1670.0, 1660.0, 1650.0, 1640.0, 1630.0, 1620.0, 1610.0, 1600.0, 1590.0, 1580.0, 1570.0, 1560.0, 1550.0, 1540.0, 1530.0, 1520.0, 151000.0, 1500.0, 1490.0, 1480.0, 1470.0, 1460.0, 1450.0, 1440.0, 1430.0, 1420.0, 1410.0, 1400.0, 1390.0, 1380.0, 1370.0, 1360.0, 1350.0, 1340.0, 1330.0, 1320.0, 1310.0, 1300.0, 1290.0, 1280.0, 1270.0, 126000.0, 1250.0, 1240.0, 1230.0, 1220.0, 1210.0, 1200.0, 1190.0, 1180.0, 1170.0, 1160.0, 1150.0, 1140.0, 1130.0, 1120.0, 1110.0, 1100.0, 1090.0, 1080.0, 1070.0, 1060.0, 1050.0, 1040.0, 1030.0, 1020.0, 101000.0, 1000.0, 990.0, 980.0, 970.0, 960.0, 950.0, 940.0, 930.0, 920.0, 910.0, 900.0, 890.0, 880.0, 870.0, 860.0, 850.0, 840.0, 830.0, 820.0, 810.0, 800.0, 790.0, 780.0, 770.0, 76000.0, 750.0, 740.0, 730.0, 720.0, 710.0, 700.0, 690.0, 680.0, 670.0, 660.0, 650.0, 640.0, 630.0, 620.0, 610.0, 600.0, 590.0, 580.0, 570.0, 560.0, 550.0, 540.0, 530.0, 520.0, 51000.0, 500.0, 490.0, 480.0, 470.0, 460.0, 450.0, 440.0, 430.0, 420.0, 410.0, 400.0, 390.0, 380.0, 370.0, 360.0, 350.0, 340.0, 330.0, 320.0, 310.0, 300.0, 290.0, 280.0, 270.0, 26000.0, 250.0, 240.0, 230.0, 220.0, 210.0, 200.0, 190.0, 180.0, 170.0, 160.0, 150.0, 140.0, 130.0, 120.0, 110.0, 100.0, 90.0, 80.0, 70.0, 60.0, 50.0, 40.0, 30.0, 20.0}

1 Mostly Sorted Descending 1000 values 3 {1001000.0, 10000.0, 9990.0, 9980.0, 9970.0, 9960.0, 9950.0, 9940.0, 9930.0, 9920.0,

OUTPUT:


Original Text file:

Mostly Sorted Descending
1000 values



1001000.0 10000.0 9990.0 9980.0 9970.0 9960.0 9950.0 9940.0 9930.0 9920.0
9910.0 9900.0 9890.0 9880.0 9870.0 9860.0 9850.0 9840.0 9830.0 9820.0
9810.0 9800.0 9790.0 9780.0 9770.0 976000.0 9750.0 9740.0 9730.0 9720.0
9710.0 9700.0 9690.0 9680.0 9670.0 9660.0 9650.0 9640.0 9630.0 9620.0
9610.0 9600.0 9590.0 9580.0 9570.0 9560.0 9550.0 9540.0 9530.0 9520.0
951000.0 9500.0 9490.0 9480.0 9470.0 9460.0 9450.0 9440.0 9430.0 9420.0
9410.0 9400.0 9390.0 9380.0 9370.0 9360.0 9350.0 9340.0 9330.0 9320.0
9310.0 9300.0 9290.0 9280.0 9270.0 926000.0 9250.0 9240.0 9230.0 9220.0
9210.0 9200.0 9190.0 9180.0 9170.0 9160.0 9150.0 9140.0 9130.0 9120.0
9110.0 9100.0 9090.0 9080.0 9070.0 9060.0 9050.0 9040.0 9030.0 9020.0
901000.0 9000.0 8990.0 8980.0 8970.0 8960.0 8950.0 8940.0 8930.0 8920.0
8910.0 8900.0 8890.0 8880.0 8870.0 8860.0 8850.0 8840.0 8830.0 8820.0
8810.0 8800.0 8790.0 8780.0 8770.0 876000.0 8750.0 8740.0 8730.0 8720.0
8710.0 8700.0 8690.0 8680.0 8670.0 8660.0 8650.0 8640.0 8630.0 8620.0
8610.0 8600.0 8590.0 8580.0 8570.0 8560.0 8550.0 8540.0 8530.0 8520.0
851000.0 8500.0 8490.0 8480.0 8470.0 8460.0 8450.0 8440.0 8430.0 8420.0
8410.0 8400.0 8390.0 8380.0 8370.0 8360.0 8350.0 8340.0 8330.0 8320.0
8310.0 8300.0 8290.0 8280.0 8270.0 826000.0 8250.0 8240.0 8230.0 8220.0
8210.0 8200.0 8190.0 8180.0 8170.0 8160.0 8150.0 8140.0 8130.0 8120.0
8110.0 8100.0 8090.0 8080.0 8070.0 8060.0 8050.0 8040.0 8030.0 8020.0
801000.0 8000.0 7990.0 7980.0 7970.0 7960.0 7950.0 7940.0 7930.0 7920.0
7910.0 7900.0 7890.0 7880.0 7870.0 7860.0 7850.0 7840.0 7830.0 7820.0
7810.0 7800.0 7790.0 7780.0 7770.0 776000.0 7750.0 7740.0 7730.0 7720.0
7710.0 7700.0 7690.0 7680.0 7670.0 7660.0 7650.0 7640.0 7630.0 7620.0
7610.0 7600.0 7590.0 7580.0 7570.0 7560.0 7550.0 7540.0 7530.0 7520.0
751000.0 7500.0 7490.0 7480.0 7470.0 7460.0 7450.0 7440.0 7430.0 7420.0
7410.0 7400.0 7390.0 7380.0 7370.0 7360.0 7350.0 7340.0 7330.0 7320.0
7310.0 7300.0 7290.0 7280.0 7270.0 726000.0 7250.0 7240.0 7230.0 7220.0
7210.0 7200.0 7190.0 7180.0 7170.0 7160.0 7150.0 7140.0 7130.0 7120.0
7110.0 7100.0 7090.0 7080.0 7070.0 7060.0 7050.0 7040.0 7030.0 7020.0
701000.0 7000.0 6990.0 6980.0 6970.0 6960.0 6950.0 6940.0 6930.0 6920.0
6910.0 6900.0 6890.0 6880.0 6870.0 6860.0 6850.0 6840.0 6830.0 6820.0
6810.0 6800.0 6790.0 6780.0 6770.0 676000.0 6750.0 6740.0 6730.0 6720.0
6710.0 6700.0 6690.0 6680.0 6670.0 6660.0 6650.0 6640.0 6630.0 6620.0
6610.0 6600.0 6590.0 6580.0 6570.0 6560.0 6550.0 6540.0 6530.0 6520.0
651000.0 6500.0 6490.0 6480.0 6470.0 6460.0 6450.0 6440.0 6430.0 6420.0
6410.0 6400.0 6390.0 6380.0 6370.0 6360.0 6350.0 6340.0 6330.0 6320.0
6310.0 6300.0 6290.0 6280.0 6270.0 626000.0 6250.0 6240.0 6230.0 6220.0
6210.0 6200.0 6190.0 6180.0 6170.0 6160.0 6150.0 6140.0 6130.0 6120.0
6110.0 6100.0 6090.0 6080.0 6070.0 6060.0 6050.0 6040.0 6030.0 6020.0
601000.0 6000.0 5990.0 5980.0 5970.0 5960.0 5950.0 5940.0 5930.0 5920.0
5910.0 5900.0 5890.0 5880.0 5870.0 5860.0 5850.0 5840.0 5830.0 5820.0
5810.0 5800.0 5790.0 5780.0 5770.0 576000.0 5750.0 5740.0 5730.0 5720.0
5710.0 5700.0 5690.0 5680.0 5670.0 5660.0 5650.0 5640.0 5630.0 5620.0
5610.0 5600.0 5590.0 5580.0 5570.0 5560.0 5550.0 5540.0 5530.0 5520.0
551000.0 5500.0 5490.0 5480.0 5470.0 5460.0 5450.0 5440.0 5430.0 5420.0
5410.0 5400.0 5390.0 5380.0 5370.0 5360.0 5350.0 5340.0 5330.0 5320.0
5310.0 5300.0 5290.0 5280.0 5270.0 526000.0 5250.0 5240.0 5230.0 5220.0
5210.0 5200.0 5190.0 5180.0 5170.0 5160.0 5150.0 5140.0 5130.0 5120.0
5110.0 5100.0 5090.0 5080.0 5070.0 5060.0 5050.0 5040.0 5030.0 5020.0
501000.0 5000.0 4990.0 4980.0 4970.0 4960.0 4950.0 4940.0 4930.0 4920.0
4910.0 4900.0 4890.0 4880.0 4870.0 4860.0 4850.0 4840.0 4830.0 4820.0
4810.0 4800.0 4790.0 4780.0 4770.0 476000.0 4750.0 4740.0 4730.0 4720.0
4710.0 4700.0 4690.0 4680.0 4670.0 4660.0 4650.0 4640.0 4630.0 4620.0
4610.0 4600.0 4590.0 4580.0 4570.0 4560.0 4550.0 4540.0 4530.0 4520.0
451000.0 4500.0 4490.0 4480.0 4470.0 4460.0 4450.0 4440.0 4430.0 4420.0
4410.0 4400.0 4390.0 4380.0 4370.0 4360.0 4350.0 4340.0 4330.0 4320.0
4310.0 4300.0 4290.0 4280.0 4270.0 426000.0 4250.0 4240.0 4230.0 4220.0
4210.0 4200.0 4190.0 4180.0 4170.0 4160.0 4150.0 4140.0 4130.0 4120.0
4110.0 4100.0 4090.0 4080.0 4070.0 4060.0 4050.0 4040.0 4030.0 4020.0
401000.0 4000.0 3990.0 3980.0 3970.0 3960.0 3950.0 3940.0 3930.0 3920.0
3910.0 3900.0 3890.0 3880.0 3870.0 3860.0 3850.0 3840.0 3830.0 3820.0
3810.0 3800.0 3790.0 3780.0 3770.0 376000.0 3750.0 3740.0 3730.0 3720.0
3710.0 3700.0 3690.0 3680.0 3670.0 3660.0 3650.0 3640.0 3630.0 3620.0
3610.0 3600.0 3590.0 3580.0 3570.0 3560.0 3550.0 3540.0 3530.0 3520.0
351000.0 3500.0 3490.0 3480.0 3470.0 3460.0 3450.0 3440.0 3430.0 3420.0
3410.0 3400.0 3390.0 3380.0 3370.0 3360.0 3350.0 3340.0 3330.0 3320.0
3310.0 3300.0 3290.0 3280.0 3270.0 326000.0 3250.0 3240.0 3230.0 3220.0
3210.0 3200.0 3190.0 3180.0 3170.0 3160.0 3150.0 3140.0 3130.0 3120.0
3110.0 3100.0 3090.0 3080.0 3070.0 3060.0 3050.0 3040.0 3030.0 3020.0
301000.0 3000.0 2990.0 2980.0 2970.0 2960.0 2950.0 2940.0 2930.0 2920.0
2910.0 2900.0 2890.0 2880.0 2870.0 2860.0 2850.0 2840.0 2830.0 2820.0
2810.0 2800.0 2790.0 2780.0 2770.0 276000.0 2750.0 2740.0 2730.0 2720.0
2710.0 2700.0 2690.0 2680.0 2670.0 2660.0 2650.0 2640.0 2630.0 2620.0
2610.0 2600.0 2590.0 2580.0 2570.0 2560.0 2550.0 2540.0 2530.0 2520.0
251000.0 2500.0 2490.0 2480.0 2470.0 2460.0 2450.0 2440.0 2430.0 2420.0
2410.0 2400.0 2390.0 2380.0 2370.0 2360.0 2350.0 2340.0 2330.0 2320.0
2310.0 2300.0 2290.0 2280.0 2270.0 226000.0 2250.0 2240.0 2230.0 2220.0
2210.0 2200.0 2190.0 2180.0 2170.0 2160.0 2150.0 2140.0 2130.0 2120.0
2110.0 2100.0 2090.0 2080.0 2070.0 2060.0 2050.0 2040.0 2030.0 2020.0
201000.0 2000.0 1990.0 1980.0 1970.0 1960.0 1950.0 1940.0 1930.0 1920.0
1910.0 1900.0 1890.0 1880.0 1870.0 1860.0 1850.0 1840.0 1830.0 1820.0
1810.0 1800.0 1790.0 1780.0 1770.0 176000.0 1750.0 1740.0 1730.0 1720.0
1710.0 1700.0 1690.0 1680.0 1670.0 1660.0 1650.0 1640.0 1630.0 1620.0
1610.0 1600.0 1590.0 1580.0 1570.0 1560.0 1550.0 1540.0 1530.0 1520.0
151000.0 1500.0 1490.0 1480.0 1470.0 1460.0 1450.0 1440.0 1430.0 1420.0
1410.0 1400.0 1390.0 1380.0 1370.0 1360.0 1350.0 1340.0 1330.0 1320.0
1310.0 1300.0 1290.0 1280.0 1270.0 126000.0 1250.0 1240.0 1230.0 1220.0
1210.0 1200.0 1190.0 1180.0 1170.0 1160.0 1150.0 1140.0 1130.0 1120.0
1110.0 1100.0 1090.0 1080.0 1070.0 1060.0 1050.0 1040.0 1030.0 1020.0
101000.0 1000.0 990.0 980.0 970.0 960.0 950.0 940.0 930.0 920.0
910.0 900.0 890.0 880.0 870.0 860.0 850.0 840.0 830.0 820.0
810.0 800.0 790.0 780.0 770.0 76000.0 750.0 740.0 730.0 720.0
710.0 700.0 690.0 680.0 670.0 660.0 650.0 640.0 630.0 620.0
610.0 600.0 590.0 580.0 570.0 560.0 550.0 540.0 530.0 520.0
51000.0 500.0 490.0 480.0 470.0 460.0 450.0 440.0 430.0 420.0
410.0 400.0 390.0 380.0 370.0 360.0 350.0 340.0 330.0 320.0
310.0 300.0 290.0 280.0 270.0 26000.0 250.0 240.0 230.0 220.0
210.0 200.0 190.0 180.0 170.0 160.0 150.0 140.0 130.0 120.0
110.0 100.0 90.0 80.0 70.0 60.0 50.0 40.0 30.0 20.0


Sorted Array:

20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0 110.0
120.0 130.0 140.0 150.0 160.0 170.0 180.0 190.0 200.0 210.0
220.0 230.0 240.0 250.0 270.0 280.0 290.0 300.0 310.0 320.0
330.0 340.0 350.0 360.0 370.0 380.0 390.0 400.0 410.0 420.0
430.0 440.0 450.0 460.0 470.0 480.0 490.0 500.0 520.0 530.0
540.0 550.0 560.0 570.0 580.0 590.0 600.0 610.0 620.0 630.0
640.0 650.0 660.0 670.0 680.0 690.0 700.0 710.0 720.0 730.0
740.0 750.0 770.0 780.0 790.0 800.0 810.0 820.0 830.0 840.0
850.0 860.0 870.0 880.0 890.0 900.0 910.0 920.0 930.0 940.0
950.0 960.0 970.0 980.0 990.0 1000.0 1020.0 1030.0 1040.0 1050.0
1060.0 1070.0 1080.0 1090.0 1100.0 1110.0 1120.0 1130.0 1140.0 1150.0
1160.0 1170.0 1180.0 1190.0 1200.0 1210.0 1220.0 1230.0 1240.0 1250.0
1270.0 1280.0 1290.0 1300.0 1310.0 1320.0 1330.0 1340.0 1350.0 1360.0
1370.0 1380.0 1390.0 1400.0 1410.0 1420.0 1430.0 1440.0 1450.0 1460.0
1470.0 1480.0 1490.0 1500.0 1520.0 1530.0 1540.0 1550.0 1560.0 1570.0
1580.0 1590.0 1600.0 1610.0 1620.0 1630.0 1640.0 1650.0 1660.0 1670.0
1680.0 1690.0 1700.0 1710.0 1720.0 1730.0 1740.0 1750.0 1770.0 1780.0
1790.0 1800.0 1810.0 1820.0 1830.0 1840.0 1850.0 1860.0 1870.0 1880.0
1890.0 1900.0 1910.0 1920.0 1930.0 1940.0 1950.0 1960.0 1970.0 1980.0
1990.0 2000.0 2020.0 2030.0 2040.0 2050.0 2060.0 2070.0 2080.0 2090.0
2100.0 2110.0 2120.0 2130.0 2140.0 2150.0 2160.0 2170.0 2180.0 2190.0
2200.0 2210.0 2220.0 2230.0 2240.0 2250.0 2270.0 2280.0 2290.0 2300.0
2310.0 2320.0 2330.0 2340.0 2350.0 2360.0 2370.0 2380.0 2390.0 2400.0
2410.0 2420.0 2430.0 2440.0 2450.0 2460.0 2470.0 2480.0 2490.0 2500.0
2520.0 2530.0 2540.0 2550.0 2560.0 2570.0 2580.0 2590.0 2600.0 2610.0
2620.0 2630.0 2640.0 2650.0 2660.0 2670.0 2680.0 2690.0 2700.0 2710.0
2720.0 2730.0 2740.0 2750.0 2770.0 2780.0 2790.0 2800.0 2810.0 2820.0
2830.0 2840.0 2850.0 2860.0 2870.0 2880.0 2890.0 2900.0 2910.0 2920.0
2930.0 2940.0 2950.0 2960.0 2970.0 2980.0 2990.0 3000.0 3020.0 3030.0
3040.0 3050.0 3060.0 3070.0 3080.0 3090.0 3100.0 3110.0 3120.0 3130.0
3140.0 3150.0 3160.0 3170.0 3180.0 3190.0 3200.0 3210.0 3220.0 3230.0
3240.0 3250.0 3270.0 3280.0 3290.0 3300.0 3310.0 3320.0 3330.0 3340.0
3350.0 3360.0 3370.0 3380.0 3390.0 3400.0 3410.0 3420.0 3430.0 3440.0
3450.0 3460.0 3470.0 3480.0 3490.0 3500.0 3520.0 3530.0 3540.0 3550.0
3560.0 3570.0 3580.0 3590.0 3600.0 3610.0 3620.0 3630.0 3640.0 3650.0
3660.0 3670.0 3680.0 3690.0 3700.0 3710.0 3720.0 3730.0 3740.0 3750.0
3770.0 3780.0 3790.0 3800.0 3810.0 3820.0 3830.0 3840.0 3850.0 3860.0
3870.0 3880.0 3890.0 3900.0 3910.0 3920.0 3930.0 3940.0 3950.0 3960.0
3970.0 3980.0 3990.0 4000.0 4020.0 4030.0 4040.0 4050.0 4060.0 4070.0
4080.0 4090.0 4100.0 4110.0 4120.0 4130.0 4140.0 4150.0 4160.0 4170.0
4180.0 4190.0 4200.0 4210.0 4220.0 4230.0 4240.0 4250.0 4270.0 4280.0
4290.0 4300.0 4310.0 4320.0 4330.0 4340.0 4350.0 4360.0 4370.0 4380.0
4390.0 4400.0 4410.0 4420.0 4430.0 4440.0 4450.0 4460.0 4470.0 4480.0
4490.0 4500.0 4520.0 4530.0 4540.0 4550.0 4560.0 4570.0 4580.0 4590.0
4600.0 4610.0 4620.0 4630.0 4640.0 4650.0 4660.0 4670.0 4680.0 4690.0
4700.0 4710.0 4720.0 4730.0 4740.0 4750.0 4770.0 4780.0 4790.0 4800.0
4810.0 4820.0 4830.0 4840.0 4850.0 4860.0 4870.0 4880.0 4890.0 4900.0
4910.0 4920.0 4930.0 4940.0 4950.0 4960.0 4970.0 4980.0 4990.0 5000.0
5020.0 5030.0 5040.0 5050.0 5060.0 5070.0 5080.0 5090.0 5100.0 5110.0
5120.0 5130.0 5140.0 5150.0 5160.0 5170.0 5180.0 5190.0 5200.0 5210.0
5220.0 5230.0 5240.0 5250.0 5270.0 5280.0 5290.0 5300.0 5310.0 5320.0
5330.0 5340.0 5350.0 5360.0 5370.0 5380.0 5390.0 5400.0 5410.0 5420.0
5430.0 5440.0 5450.0 5460.0 5470.0 5480.0 5490.0 5500.0 5520.0 5530.0
5540.0 5550.0 5560.0 5570.0 5580.0 5590.0 5600.0 5610.0 5620.0 5630.0
5640.0 5650.0 5660.0 5670.0 5680.0 5690.0 5700.0 5710.0 5720.0 5730.0
5740.0 5750.0 5770.0 5780.0 5790.0 5800.0 5810.0 5820.0 5830.0 5840.0
5850.0 5860.0 5870.0 5880.0 5890.0 5900.0 5910.0 5920.0 5930.0 5940.0
5950.0 5960.0 5970.0 5980.0 5990.0 6000.0 6020.0 6030.0 6040.0 6050.0
6060.0 6070.0 6080.0 6090.0 6100.0 6110.0 6120.0 6130.0 6140.0 6150.0
6160.0 6170.0 6180.0 6190.0 6200.0 6210.0 6220.0 6230.0 6240.0 6250.0
6270.0 6280.0 6290.0 6300.0 6310.0 6320.0 6330.0 6340.0 6350.0 6360.0
6370.0 6380.0 6390.0 6400.0 6410.0 6420.0 6430.0 6440.0 6450.0 6460.0
6470.0 6480.0 6490.0 6500.0 6520.0 6530.0 6540.0 6550.0 6560.0 6570.0
6580.0 6590.0 6600.0 6610.0 6620.0 6630.0 6640.0 6650.0 6660.0 6670.0
6680.0 6690.0 6700.0 6710.0 6720.0 6730.0 6740.0 6750.0 6770.0 6780.0
6790.0 6800.0 6810.0 6820.0 6830.0 6840.0 6850.0 6860.0 6870.0 6880.0
6890.0 6900.0 6910.0 6920.0 6930.0 6940.0 6950.0 6960.0 6970.0 6980.0
6990.0 7000.0 7020.0 7030.0 7040.0 7050.0 7060.0 7070.0 7080.0 7090.0
7100.0 7110.0 7120.0 7130.0 7140.0 7150.0 7160.0 7170.0 7180.0 7190.0
7200.0 7210.0 7220.0 7230.0 7240.0 7250.0 7270.0 7280.0 7290.0 7300.0
7310.0 7320.0 7330.0 7340.0 7350.0 7360.0 7370.0 7380.0 7390.0 7400.0
7410.0 7420.0 7430.0 7440.0 7450.0 7460.0 7470.0 7480.0 7490.0 7500.0
7520.0 7530.0 7540.0 7550.0 7560.0 7570.0 7580.0 7590.0 7600.0 7610.0
7620.0 7630.0 7640.0 7650.0 7660.0 7670.0 7680.0 7690.0 7700.0 7710.0
7720.0 7730.0 7740.0 7750.0 7770.0 7780.0 7790.0 7800.0 7810.0 7820.0
7830.0 7840.0 7850.0 7860.0 7870.0 7880.0 7890.0 7900.0 7910.0 7920.0
7930.0 7940.0 7950.0 7960.0 7970.0 7980.0 7990.0 8000.0 8020.0 8030.0
8040.0 8050.0 8060.0 8070.0 8080.0 8090.0 8100.0 8110.0 8120.0 8130.0
8140.0 8150.0 8160.0 8170.0 8180.0 8190.0 8200.0 8210.0 8220.0 8230.0
8240.0 8250.0 8270.0 8280.0 8290.0 8300.0 8310.0 8320.0 8330.0 8340.0
8350.0 8360.0 8370.0 8380.0 8390.0 8400.0 8410.0 8420.0 8430.0 8440.0
8450.0 8460.0 8470.0 8480.0 8490.0 8500.0 8520.0 8530.0 8540.0 8550.0
8560.0 8570.0 8580.0 8590.0 8600.0 8610.0 8620.0 8630.0 8640.0 8650.0
8660.0 8670.0 8680.0 8690.0 8700.0 8710.0 8720.0 8730.0 8740.0 8750.0
8770.0 8780.0 8790.0 8800.0 8810.0 8820.0 8830.0 8840.0 8850.0 8860.0
8870.0 8880.0 8890.0 8900.0 8910.0 8920.0 8930.0 8940.0 8950.0 8960.0
8970.0 8980.0 8990.0 9000.0 9020.0 9030.0 9040.0 9050.0 9060.0 9070.0
9080.0 9090.0 9100.0 9110.0 9120.0 9130.0 9140.0 9150.0 9160.0 9170.0
9180.0 9190.0 9200.0 9210.0 9220.0 9230.0 9240.0 9250.0 9270.0 9280.0
9290.0 9300.0 9310.0 9320.0 9330.0 9340.0 9350.0 9360.0 9370.0 9380.0
9390.0 9400.0 9410.0 9420.0 9430.0 9440.0 9450.0 9460.0 9470.0 9480.0
9490.0 9500.0 9520.0 9530.0 9540.0 9550.0 9560.0 9570.0 9580.0 9590.0
9600.0 9610.0 9620.0 9630.0 9640.0 9650.0 9660.0 9670.0 9680.0 9690.0
9700.0 9710.0 9720.0 9730.0 9740.0 9750.0 9770.0 9780.0 9790.0 9800.0
9810.0 9820.0 9830.0 9840.0 9850.0 9860.0 9870.0 9880.0 9890.0 9900.0
9910.0 9920.0 9930.0 9940.0 9950.0 9960.0 9970.0 9980.0 9990.0 10000.0
26000.0 51000.0 76000.0 101000.0 126000.0 151000.0 176000.0 201000.0 226000.0 251000.0
276000.0 301000.0 326000.0 351000.0 376000.0 401000.0 426000.0 451000.0 476000.0 501000.0
526000.0 551000.0 576000.0 601000.0 626000.0 651000.0 676000.0 701000.0 726000.0 751000.0
776000.0 801000.0 826000.0 851000.0 876000.0 901000.0 926000.0 951000.0 976000.0 1001000.0

Time taken for Bubble Sort: 4 milliseconds.

Original Text file: lostly Sorted Descending 1000 values 1001000.0 10000.0 9990.0 9980.0 9970.0 9960.0 9950.0 9940.0 9930.0 9

1215.31255.51195.51183.5/1/3.5/165.51155.51145.51135.5/123.3 7118.0 7188.8 7996.6 7686.6 7878.8 7866.8 7656.6 7848.8 780.7028

301000.0 3000.0 2990.0 2980.0 2970.0 2960.0 2950.0 2940.0 2930.0 2920.0 2910.0 2900.0 2890.0 2880.0 2870.0 2860.0 2850.0 2840

Sorted Array: 20.0 30.0 40.0 50.0 60.0 78.0 80.0 90.0 100.0 110.0 120.0 130.0 140.0 150.0 160.0 170.0 180.0 190.0 200.0 210.0

Deeeeeeeeeee Leeze=3,B=Aegist, 3778.6 3788.6 3796.6 3888.6 3818.8 3828.6 3838.8 3848.8 3858.8 3860.0 3878.8 3888.8 3898.8 39a

6790.0 6800.0 6810.0 6820.0 6830.0 6840.0 6850.0 6860.0 6870.0 6880.0 6890.0 6900.0 6910.0 6920.0 6930.0 6940.0 6950.0 6960.0

Ask any questions if you have in comment section below.

Please rate the answer.

Add a comment
Know the answer?
Add Answer to:
fix my code please. program should output the original array and sorted array then time taken...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • My following program has an array which holds 1000 random integers between 1-1000. Now I need...

    My following program has an array which holds 1000 random integers between 1-1000. Now I need help to create an array that holds 10,000 random integer between 1-1000 in my following program. The main goal of this program is time analysis by using bubble sort and binary search algorithms. Please do the following task; 1. Replace the 1000 random integers with 10,000 random integers After change please answer the following question 2. what will be happen, if an array holds...

  • can you please split this program into .h and .cpp file #include <iostream> #include<string> #include<fstream> #define...

    can you please split this program into .h and .cpp file #include <iostream> #include<string> #include<fstream> #define SIZE 100 using namespace std; //declare struct struct word_block {    std::string word;    int count; }; int getIndex(word_block arr[], int n, string s); int main(int argc, char **argv) {    string filename="input.txt";    //declare array of struct word_block    word_block arr[SIZE];    int count = 0;    if (argc < 2)    {        cout << "Usage: " << argv[0] << "...

  • I need help fixing my code: In C++ *************** 1) I want to sum the digits...

    I need help fixing my code: In C++ *************** 1) I want to sum the digits of an n*n matrix 2) find the average I have completed the rest ****Do not use C++ standard library. You must use pointers and pointer arithmetic to represent the matrix and to navigate through it. MY CODE: (I have indicated at which point I need help) #include <iostream> using namespace std; void swap(int *xp, int *yp) { int temp = *xp; *xp = *yp;...

  • fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string>...

    fully comments for my program, thank you will thumb up #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; struct book { int ISBN; string Author; string Title; string publisher; int Quantity; double price; }; void choice1(book books[], int& size, int MAX_SIZE) { ifstream inFile; inFile.open("inventory.txt"); if (inFile.fail()) cout <<"file could not open"<<endl; string str;    while(inFile && size < MAX_SIZE) { getline(inFile, str); books[size].ISBN = atoi(str.c_str()); getline(inFile, books[size].Title);    getline(inFile, books[size].Author); getline(inFile, books[size].publisher);          getline(inFile,...

  • c++ please read all question edit the program to test different random sizes of the array and give me the time in a file will be like random size of the array and next to it the time it took for each...

    c++ please read all question edit the program to test different random sizes of the array and give me the time in a file will be like random size of the array and next to it the time it took for each size Im trying to do time analysis for Quick sort but i keep getting time = 0 also i want edit the program to test different random sizes of the array and give me the time in a...

  • Using C++, fix the following code so that (1) Change the student array storage part so...

    Using C++, fix the following code so that (1) Change the student array storage part so that the data is loaded from a file "students.txt". Use an appropriate data    termination flag. (2) Sort the student array in ascending order of GPA using insertion sort. Print the sorted array (3) Sort the student array in ascending order of ID using insertion sort. Print the sorted array (4) Illustrate Binary search for a particular ID that would be found and one...

  • C++ how can I fix these errors this is my code main.cpp #include "SpecialArray.h" #include <...

    C++ how can I fix these errors this is my code main.cpp #include "SpecialArray.h" #include <iostream> #include <fstream> #include <string> using namespace std; int measureElementsPerLine(ifstream& inFile) {    // Add your code here.    string line;    getline(inFile, line);    int sp = 0;    for (int i = 0; i < line.size(); i++)    {        if (line[i] == ' ')            sp++;    }    sp++;    return sp; } int measureLines(ifstream& inFile) {    // Add your code here.    string line;    int n = 0;    while (!inFile.eof())    {        getline(inFile,...

  • Can anyone help me with my C++ assignment on structs, arrays and bubblesort? I can't seem...

    Can anyone help me with my C++ assignment on structs, arrays and bubblesort? I can't seem to get my code to work. The output should have the AVEPPG from highest to lowest (sorted by bubbesort). The output of my code is messed up. Please help me, thanks. Here's the input.txt: Mary 15 10.5 Joseph 32 6.2 Jack 72 8.1 Vince 83 4.2 Elizabeth 41 7.5 The output should be: NAME             UNIFORM#    AVEPPG Mary                   15     10.50 Jack                   72      8.10 Elizabeth              41      7.50 Joseph                 32      6.20 Vince                  83      4.20 ​ My Code: #include <iostream>...

  • Hello, I need help with my code. The code needs to display random number from 1...

    Hello, I need help with my code. The code needs to display random number from 1 to 50 every time the program runs but the program displays the same random numbers every time. Thanks #include #include using namespace std; void dynAlloc(int size, int *&arr); void displayArray(int *arr, int n); void insertionSort(int *arr, int n, int *temp); void linear_search(int *arr, int n, int key); void binary_search(int *arr, int n, int key); int main() {   const int n = 50; int *arr,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT