CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Exclamation sort two dimensional arrays

    can you please help me with a code for the fastest algorithm? My array size is [640][480]

  2. #2
    Join Date
    Sep 2002
    Posts
    1,747

    what do you mean "sort"?

    Sorting is an inherently one-dimensional procedure. If you want to "sort" an 2-d struct, you have to decompose it into a linear structure.

    Some common ways of decomposition are:
    Array[0][0], Array[0][1], Array[0][2], ... Array[0][479], Array[1][0], etc.
    or
    Array[0][0], Array[1][0], Array[2][0], ... Array[639][0], Array[0][1], etc.
    or expanding by diagonals
    Array[0][0], Array[0][1], Array[1][0], Array[0][2], Array[1][1], etc...

    There are many other ways. Do you mean you want to sort as it is linearly arranged in memory?

  3. #3
    Join Date
    Sep 2002
    Posts
    1,747

    or...

    Are you asking to sort a collection of arrays? Then I would need to know what form of > or < you intend to invoke. Which map from an array to a real do you intend? Its not a square matrix, so some standard mathematical forms are ruled out. Dictionary ordering?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured