#1
 Diwakar_12 Member Join Date: Dec 2008 Posts: 37
Sorting Two Dimensional Arrays

I have a sort matrix 1 to the new array. Currently, I am using the following method to sort,

Code:
``` # include <stdio.h>
# include <math.h>
100 # define
void Login (int ia [m] [m], int & n);
sx1 void (int ia [m] [m], int n);
HV void (int & x, int & y)
(
int tam;
tam = x;
x = y;
y = tam;
)
void Login (int ia [m] [m], int & n)
(
int i, j;
for (i = 0; i <n, i + +)
for (j = 0 j <n, j + +)
(
printf ( "\ n ia [% d] [% d] =", i +1, j +1);
scanf ( "% d", & ia [i] [j]);
)
)
sx1 void (int ia [m] [m], int n)
(
int i, j, k, r, ib ;
for (i = 0; i <n, i + +)
(
k = 0;
for (j = 0; i <n; j + +)
(
ib [k] = ia [i] [j];
k + +;
)
for (j = 0, j <= k-1, j + +)
for (j = r +1, r <= k, r + +)
if (ib [j] ib [r])
HV (IB [j], ib [r]);
for (j = 0, j <= k, j + +)
printf ( "% d", ib [j]);
printf ( "\ n");
)

)
void main ()
(
int ia  , n;
scanf ( "% d", & n);
sx1 (ia, n);
)```
#2
 Zecho Member Join Date: May 2008 Posts: 2,293
Re: Sorting Two Dimensional Arrays

In fact you can view each line as 1-dimensional array 1, so the change is your place on the 1-dimensional array, where it should create a new array read:
Code:
``` / / Sorted increasing data on 1 row
for (int i = 0, i <row, i + +)
for (int j = 0 j <column-1, j + +)```
#3
 opaper Member Join Date: May 2008 Posts: 2,383
Re: Sorting Two Dimensional Arrays

Why is "it not working"? It should work the same way but you just have two sets of indices instead of one.

 Tags:

 Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Similar Threads for: "Sorting Two Dimensional Arrays" Thread Thread Starter Forum Replies Last Post How can I use parallel_for to pass two dimensional arrays Tamonash Software Development 7 08-10-2010 12:04 AM Dynamic memory allocation for two-dimensional arrays Ucchal Technology & Internet 1 23-09-2010 06:23 PM Two Dimensional Arrays in JavaScript Bettina Software Development 5 15-12-2009 02:01 PM Two dimensional array to a function Chrisch Software Development 3 27-11-2009 12:47 PM Three dimensional COMPUTER-MOUSE ! jesse Portable Devices 0 26-07-2008 12:30 PM

All times are GMT +5.5. The time now is 10:12 AM.