Question
C PROGRAMMING assume numbers are ints in range 0-99. input n rows and m columns using standard input a single interger k will be input
C PROGRAMMING
assume numbers are ints in range 0-99.
input n rows and m columns using standard input
a single interger k will be input from command line, assume
You call sort_column (k, mat) to sort the data on the k-th column
Sort_column (int k, int ** mat): the sorting method is called radix sort, lexical sort, or bucket sort. Given that the numbers in each column are between 0 and 99, you create an array of 100 linked lists, and reading mat[i][k], 0
You allocate an array int ** temp, and traverse these lists in order, copying their items in that order to this new array
Finally mat[i] = temp[i] for 0 ? i
Having applied sort_on_column, your program should print the output in the same format as input. Important. Your sort on column must be stable. This means that when two rows have the same value in the k-th column, they should hold their relative order after sorting.
I want to include and use the following:
A file data/8.input contains 5 columns of 100 integers like this: 100 5 45 19 6 51 0 91 41 4 60 1 etcetera In other words it begins with the number of rows and the number of columns, and is followed by the numbers. A file data/8.input contains 5 columns of 100 integers like this: 100 5 45 19 6 51 0 91 41 4 60 1 etcetera In other words it begins with the number of rows and the number of columns, and is followed by the numbers
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