By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,943 Members | 1,921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,943 IT Pros & Developers. It's quick & easy.

how to shorten the numbers in an matrix

P: 2
how to short d numbers in an matrix to print the no.s like this

1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
and then hw to searh an element in it.
plz give me fast reply???????
Sep 8 '10 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 542
Do you mean "sort" ?

If yes, Let us know what you have done so far, then tell us the problem, then we can solve
Sep 8 '10 #2

P: 2
yes i mean sort

plz now give me solution
Sep 8 '10 #3

Expert 2.5K+
P: 3,112

We don't just hand out solutions here, but we can help you find one yourself.

There are many different sorting algorithms, the easiest probably being bubble sort and one of the faster ones is Merge sort. Pseudocode for both can be found on the wikipedia articles I linked to. Now, for that amount of items, the difference will only be marginal, so it doesn't really matter, which one you choose.

Putting them into a matrix afterwards shouldn't be too hard.

Sep 8 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.