H!
I have to write a program for sorting two dimensional array(e.g. Matrix) without converting it into a single dimensional array or using pointer concept. So, can u please give me any idea for writing this program?

Recommended Answers

All 6 Replies

Nobody knows what order relation for matrix are you using.
And you? ;)

Nobody knows what order relation for matrix are you using.
And you? ;)

Hye, that's user's choice!
Order of the matrix will be entered by the user according to his/her choice as the the matrix he/her wants to sort

Output will be as below:

Enter the order of the matrix you want to sort: 3 3
Enter the elements of the matrix for sorting: 2 7 5 9 3 8 1 4 0
Original matrix entered by the user:
2 7 5
9 3 8
1 4 0

Matrix after sorting its elements:
0 1 2
3 4 5
7 8 9

Look up "Bubble sort", slow, but should work for what you described.

cutedipti, order (or ordering) relation is not the same thing as order of matrix in mathematics ;) Only square matrix has an order, arbitrary matrix have dimensions.
Now you define (by example) desired ordering relation.
If the user enters matrix dimensions, what's your method to create MxN matrix?

You guyz talk to much..She just want the codes..So!!...

You guyz talk to much..She just want the codes..So!!...

Probably but I'm here to give fishing-rods, not a fried fish ;)

commented: :) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.