Question
C++ Hello, My problem is quite long/in-depth There are 5 files, each has two rows and 5000 columns. The first row is a ranking from
C++
Hello,
My problem is quite long/in-depth
There are 5 files, each has two rows and 5000 columns. The first row is a ranking from randomly scattered1-5000.
file1
4905 | 3892 |
1294 | 2389 |
203 | 123 |
3023 | 4782 |
2513 | 1632 |
file2
2132 | 2733 |
1242 | 4672 |
1324 | 1233 |
4324 | 2342 |
3421 | 1232 |
file3
3213 | 3421 |
213 | 23 |
3211 | 125 |
2423 | 232 |
233 | 32133 |
file4
421 | 4341 |
3421 | 3234 |
2421 | 4213 |
241 | 1342 |
4221 | 2332 |
file5
2142 | 192 |
429 | 2647 |
1920 | 262 |
192 | 2784 |
293 | 2902 |
Now, along with those random ranks is a random page # associated with that rank.
You need to create a combined rank array same dimensions
CombinedRank
27994 | 2442 |
23452 | 5000 |
12194 | 24 |
38943 | 1245 |
40932 | 1637 |
You then need to use a QUICKSORT algorithm to rank the combined ranking of each page number in ascending order. ****** CANNOT USE QSORT() ******
You then QUICKSORT all 5 files
CombinedRank Sorted
12194 | 1637 |
23452 | 1245 |
27994 | 2442 |
38943 | 5000 |
40932 | 24 |
Finally, find the inversions of the page number between combined rank and each of the 5 files.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started