how to shorten the numbers in an matrix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sudhanshu dev
    New Member
    • Sep 2010
    • 2

    how to shorten the numbers in an matrix

    hi......
    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???????
  • ashitpro
    Recognized Expert Contributor
    • Aug 2007
    • 542

    #2
    Do you mean "sort" ?

    If yes, Let us know what you have done so far, then tell us the problem, then we can solve

    Comment

    • sudhanshu dev
      New Member
      • Sep 2010
      • 2

      #3
      yes i mean sort

      plz now give me solution

      Comment

      • Nepomuk
        Recognized Expert Specialist
        • Aug 2007
        • 3111

        #4
        Hi!

        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.

        Greetings,
        Nepomuk

        Comment

        Working...