QuestionQuestion

Write a menu driven C++ program which provides output and does the following use QuickSort to sort the file data as such 421003, 100298, 494002, 000093, 3994, 21093, 3949500, 29100, 6493939, 202814, 0506984, 2, 665778, and then stores it in a data structure.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <cstdlib>
#include <iostream>
using namespace std;

void swap(long & a, long & b);
int partition(long * arr, int left, int right);
void quicksort(long * arr, int left, int right);
void print(long * arr, int size);

int main(int argc, char** argv) {
    long arr [] = {421003, 100298,
       494002, 93, 3994, 21093, 3949500, 29100,
       6493939, 202814, 506984, 2, 665778};
    int selection = 0;

    while (selection < 1 || selection > 1) {
       cout << "Do you want to sort the array: \n";
       cout << "1. Yes\n";
       cout << "2. No\n";
       cin >> selection;
    }

    if (selection == 1) {
       quicksort(arr, 0, 12);
    }

    print(arr, 13);
    return 0;
}...

By purchasing this solution you'll be able to access the following files:
Solution.cpp and SolutionRandom.cpp.

$23.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats