Answered You can buy a ready-made answer or pick a professional tutor to order an original one.
I want help in the following C++ programming task
I want help in the following C++ programming task.
ITU allots roll numbers to all of its students. A roll number is of the following format
p p D D y y y y y
where the pair p p will hold the program you are enrolled in i.e. BS or MS. The pair D D tells what department you are, valid values are {EE, CS, PS, MA}. The 5 digits that follow are the numeric roll number of the student.
Eg. BSCS15015 or BSEE15015 (Note that the numeric roll number is the same. However the sorted order in which they come will be decided by which ppDD you decide to place before the other!)
Your task is to sort the list of roll numbers. In order to sort a list use a function that implements stable counting sort. Notice that a digit can take only ten values 0–9.
Counting sort works on numeric values only and the roll number is a string of ASCII characters. (Hint ASCII digits can be changed to decimal numbers).
Write a main() function to do the following:
1. Read the number n of student records to be read.
2. Read n roll numbers as strings store them in an array of student records.
3. Call counting sort based on p p D D quartet. Since there is no particular order in which you may arrange these … your algorithm must define the order between these quartets. For example you may decide to order BSCS before BSEE followed by MSCS and then MSEE entries (decide a similar order between PA and MA department programs). At the end of this step your array will be sorted with respect to the first quartet of each roll number and the five numeric digits of each entry will be in no particular order.
After this step your array could look like this:
BSCS15011 BSEE15021 BSEE15001 BSPA14002 BSPA13044 BSMA 14091 and so on.
4. Call counting sort on all segments of this array separately. For example issue a different counting sort call for all indexes in the resulting array from step 3 that have the quartet BSCS and a different counting sort call for BSEE entries. Likewise make separate calls for all entries and in these call sort the roll numbers with respect to the last 5 digits.
5. Print the array after every invocation of counting sort.
Bonus: Use only two arrays of size n. Stable counting sort requires the output to go to an array different from the input array.
You do not need to copy back the output array after every invocation of counting sort. You should instead switch the roles (input and output) of your two arrays. For storing the counts in each counting sort, you need arrays of constant sizes (10 or 18).
For part 4 you require a counting sort function that will send the original array from step 3 to a counting sort call along with a start index and an end index which demarcates the boundary of values to be sorted by call to counting sort (remember step 4 will issue multiple calls to counting sort over different portions of the array) .
- @
- 22 orders completed
- ANSWER
-
Tutor has posted answer for $18.00. See answer's preview
*** final **** ******* "Account System **********