473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

sorting 2d arrays using qsort

hai
this is my 2d array.
int a[][6] = {
{5,2,20,1,30,10},
{23,15,7,9,11,3},
{40,50,34,24,14,4},
{9,10,11,12,13,14},
{31,4,18,8,27,17},
{44,32,13,19,41,19},
{1,2,3,4,5,6},
{80,37,47,18,21,9}
};
after
for(i=0;i<box;i++)
qsort(a[i],dim,sizeof(int),dim*_sort);
int dim_sort(const void *a,const void *b)
{
return ( *(int*)a - *(int*)b);
}
where dim=6, i get the foll o/p:
1 2 5 10 20 30
3 7 9 11 15 23
4 14 24 34 40 50
9 10 11 12 13 14
4 8 17 18 27 31
13 19 19 32 41 44
1 2 3 4 5 6
9 18 21 37 47 80
(works fine!)
now i want to sort each row of elements for above array,
like
1 2 3 4 5 6
1 2 5 10 20 30
....
etc.

what is the qsort routine and function, can anybody help me ?
cheers,
badri

Nov 14 '05 #1
23 6272
> return ( *(int*)a - *(int*)b);
That's a dangerous way to compare two signed integers. You're risking
underflow, which is undefined.
now i want to sort each row of elements for above array

You can't do it with qsort because qsort tries to directly exchange two
items; an operation that arrays don't support. You can, however, create
an array of pointers to int, point them to each array in a, and then
sort that array by writing another comparison function that compares
the first mismatch in the two arrays being compared:

#include <stdio.h>
#include <stdlib.h>

static int arraya[][6] = {
{5,2,20,1,30,10},
{23,15,7,9,11,3},
{40,50,34,24,14,4},
{9,10,11,12,13,14},
{31,4,18,8,27,17},
{44,32,13,19,41,19},
{1,2,3,4,5,6},
{80,37,47,18,21,9}
};

static int *arrayb[8];

int cmp_int(const void *a,const void *b)
{
const int *ia = a;
const int *ib = b;

if (*ia < *ib) return -1;
else if (*ia > *ib) return +1;
else return 0;
}

int cmp_array(const void *a, const void *b)
{
const int **ia = a;
const int **ib = b;
int i, cmp;

for (i = 0; i < 6; i++) {
if ((cmp = cmp_int(&(*ia)[i], &(*ib)[i])) != 0)
return cmp;
}

return 0;
}

int main(void)
{
int i, j;

for (i = 0; i < 8; i++)
qsort(arraya[i], 6, sizeof(int), cmp_int);

for (i = 0; i < 8; i++) {
for (j = 0; j < 6; j++)
printf("%4d", arraya[i][j]);
printf("\n");
}

printf("\n");

for (i = 0; i < 8; i++)
arrayb[i] = arraya[i];

qsort(arrayb, 8, sizeof(int*), cmp_array);

for (i = 0; i < 8; i++) {
for (j = 0; j < 6; j++)
printf("%4d", arrayb[i][j]);
printf("\n");
}

printf("\n");
}

Nov 14 '05 #2
On Sat, 11 Jun 2005 05:35:06 -0700, yatindran wrote:
hai
this is my 2d array.
int a[][6] = {
{5,2,20,1,30,10},
{23,15,7,9,11,3},
{40,50,34,24,14,4},
{9,10,11,12,13,14},
{31,4,18,8,27,17},
{44,32,13,19,41,19},
{1,2,3,4,5,6},
{80,37,47,18,21,9}
};
after
for(i=0;i<box;i++)
qsort(a[i],dim,sizeof(int),dim*_sort);
You could write this as
int dim_sort(const void *a,const void *b)
{
return ( *(int*)a - *(int*)b);
}
Be caseful, subtracting 2 ints can overflow so this isn't well defined
unless you can be sure that the difference between any 2 values in the
array is representable as an int. It would be safer not to make
assumptions like this:

int dim_sort(const void *va, const void *vb)
{
int a = *(const int *)va;
int b = *(const int *)vb;

return (a<b) ? -1 : (a>b);
}
where dim=6, i get the foll o/p:
1 2 5 10 20 30
3 7 9 11 15 23
4 14 24 34 40 50
9 10 11 12 13 14
4 8 17 18 27 31
13 19 19 32 41 44
1 2 3 4 5 6
9 18 21 37 47 80
(works fine!)
OK, you're sorting the contents each row individually which is fine.
now i want to sort each row of elements for above array,
like
1 2 3 4 5 6
1 2 5 10 20 30
...
etc.

what is the qsort routine and function, can anybody help me ?


You just have to remember that the array a is simply an array of elements
where each of those elements is itself an array, so you can write:

qsort(a, sizeof a/sizeof *a, sizeof *a, compare_rows);

Where sizeof a/sizeof *a is the number of rows in a, sizeof *a is the
size in bytes of a row. The comparison function would be something like

static int compare_rows(const void *va, const void *vb)
{
const int *pa = *(const int (*)[6])va;
const int *pb = *(const int (*)[6])vb;
int i;

for (i = 0; i < 6; i++) {
if (pa[i] != pb[i])
return (pa[i] > pb[i]) ? 1 : -1;
}

return 0;
}

Lawrence
Nov 14 '05 #3
On Sat, 11 Jun 2005 07:27:29 -0700, James Daughtry wrote:
return ( *(int*)a - *(int*)b); That's a dangerous way to compare two signed integers. You're risking
underflow, which is undefined.
now i want to sort each row of elements for above array

You can't do it with qsort because qsort tries to directly exchange two
items; an operation that arrays don't support.


C doesn't directly supply an exchange operation for any type, arrays are
no different in this respect. In fact there is nothing in the definition
of qsort() that requires it to use exchanges as such, although many common
sorting algorithms do use them. The more fundamental operation is a copy.
qsort() doesn't know or care about the type of the elements of the array
it is sorting, in particular it doesn't care whether they are are
themselves arrays or not. In C you can copy (and therefore exchange a
pair of) ANY object by treating it as an array of sizeof(object) bytes
(specifically an array of unsigned char). An implementation of qsort() is
likely to use memcpy() or something equivalent for copying which works
fine on arrays. All it needs to do this is a pointer to the object and the
size of the object in bytes. All the necessary information is passed in
qsort()'s arguments.
You can, however, create
an array of pointers to int, point them to each array in a, and then
sort that array by writing another comparison function that compares
the first mismatch in the two arrays being compared:


You can do that, and there may be efficiency advantages to doing so (i.e.
copying a pointer is likely to be quicker than copying a row), but you
don't have to.

Lawrence
Nov 14 '05 #4
> An implementation of qsort() is likely to use memcpy() or something equivalent for
copying which works fine on arrays.

True, but can that be relied on to portably sort a two dimensional
array as you suggested?

Nov 14 '05 #5
On Sat, 11 Jun 2005 12:02:34 -0700, James Daughtry wrote:
An implementation of qsort() is likely to use memcpy() or something equivalent for
copying which works fine on arrays.

True, but can that be relied on to portably sort a two dimensional
array as you suggested?


Yes. There's nothing that makes arrays different to any other type of
object for the purposes of qsort(). Remember again that the implementation
of qsort() knows nothing about the type of the data being sorted - C
doesn't have any form of runtime type information.

More fundamentally there is noting in the standard's specification of
qsort() that precludes it from sorting arrays whose elements are
themselves arrays.

Lawrence

Nov 14 '05 #6
Lawrence Kirby wrote:
On Sat, 11 Jun 2005 12:02:34 -0700, James Daughtry wrote:
An implementation of qsort() is likely to use memcpy() or
something equivalent for copying which works fine on arrays.


True, but can that be relied on to portably sort a two dimensional
array as you suggested?


Yes. There's nothing that makes arrays different to any other type
of object for the purposes of qsort(). Remember again that the
implementation of qsort() knows nothing about the type of the data
being sorted - C doesn't have any form of runtime type information.

More fundamentally there is noting in the standard's specification
of qsort() that precludes it from sorting arrays whose elements
are themselves arrays.


Except you have to decide and codify what makes A1 > A2, or A1 <
A2, or A1 == A2.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

Nov 14 '05 #7
On Sat, 11 Jun 2005 22:21:45 +0000, CBFalconer wrote:
Lawrence Kirby wrote:


....
More fundamentally there is noting in the standard's specification
of qsort() that precludes it from sorting arrays whose elements
are themselves arrays.


Except you have to decide and codify what makes A1 > A2, or A1 <
A2, or A1 == A2.


As you do with any type of array element.

Lawrence

Nov 14 '05 #8
ya*******@gmail.com wrote:

hai
this is my 2d array.
int a[][6] = {
{5,2,20,1,30,10},
{23,15,7,9,11,3},
{40,50,34,24,14,4},
{9,10,11,12,13,14},
{31,4,18,8,27,17},
{44,32,13,19,41,19},
{1,2,3,4,5,6},
{80,37,47,18,21,9}
};
after
for(i=0;i<box;i++)
qsort(a[i],dim,sizeof(int),dim*_sort);
int dim_sort(const void *a,const void *b)
{
return ( *(int*)a - *(int*)b);

}

where dim=6, i get the foll o/p:
1 2 5 10 20 30
3 7 9 11 15 23
4 14 24 34 40 50
9 10 11 12 13 14
4 8 17 18 27 31
13 19 19 32 41 44
1 2 3 4 5 6
9 18 21 37 47 80
(works fine!)
now i want to sort each row of elements for above array,
like
1 2 3 4 5 6
1 2 5 10 20 30
...
etc.

what is the qsort routine and function, can anybody help me ?


/* BEGIN new.c */

#include <stdio.h>
#include <stdlib.h>

int int_comp(const void *a, const void *b);
int a6int_comp(const void *a, const void *b);

int main(void)
{
int a[][6] = {
{5,2,20,1,30,10},
{23,15,7,9,11,3},
{40,50,34,24,14,4},
{9,10,11,12,13,14},
{31,4,18,8,27,17},
{44,32,13,19,41,19},
{1,2,3,4,5,6},
{80,37,47,18,21,9}
};
const size_t dim = sizeof *a / sizeof **a;
const size_t box = sizeof a / sizeof *a;
size_t i, j;

puts("\n/* BEGIN new.c output */\n");
for (i = 0; i != box; ++i) {
for (j = 0; j != dim; ++j) {
printf("%d ", a[i][j]);
}
putchar('\n');
}
putchar('\n');
for (i = 0; i != box; ++i) {
qsort(a[i], dim, sizeof *a[i], int_comp);
}
for (i = 0; i != box; ++i) {
for (j = 0; j != dim; ++j) {
printf("%d ", a[i][j]);
}
putchar('\n');
}
putchar('\n');
qsort(a, box, sizeof *a, a6int_comp);
for (i = 0; i != box; ++i) {
for (j = 0; j != dim; ++j) {
printf("%d ", a[i][j]);
}
putchar('\n');
}
puts("\n/* END new.c output */");
return 0;
}

int int_comp(const void *a, const void *b)
{
return *(int *)b > *(int *)a ? -1 : *(int *)b != *(int *)a;
}

int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

for (n = 0; n != 6; ++n) {
if (b_ptr[n] > a_ptr[n]) {
return -1;
}
if (a_ptr[n] > b_ptr[n]) {
return 1;
}
}
return 0;
}

/* END new.c */
--
pete
Nov 14 '05 #9
Lawrence Kirby wrote:
In C you can copy (and therefore exchange a
pair of) ANY object by treating it as an array of sizeof(object) bytes
(specifically an array of unsigned char).


/* BEGIN new.c */

#include <stdio.h>

void swap(void *s1, void *s2, size_t n);

int main(void)
{
char odd[] = "1 3 5 7 9";
char even[] = "0 2 4 6 8";
double three = 3.0;
double four = 4.0;

swap(&odd, &even, sizeof odd);
printf("odd %s\n", odd);
printf("even %s\n", even);
swap(&three, &four, sizeof three);
printf("three %f\n", three);
printf("four %f\n", four);
return 0;
}

void swap(void *s1, void *s2, size_t n)
{
unsigned char *p1, *p2, *end, temp;

p1 = s1;
p2 = s2;
end = p2 + n;
do {
temp = *p1;
*p1++ = *p2;
*p2++ = temp;
} while (p2 != end);
}

/* END new.c */
--
pete
Nov 14 '05 #10
Lawrence Kirby wrote:
On Sat, 11 Jun 2005 22:21:45 +0000, CBFalconer wrote:
Lawrence Kirby wrote:


...
More fundamentally there is noting in the standard's specification
of qsort() that precludes it from sorting arrays whose elements
are themselves arrays.


Except you have to decide and codify what makes A1 > A2, or A1 <
A2, or A1 == A2.


As you do with any type of array element.


Of course. But most users are used to simply comparing basic
types, or at worst passing things to strcmp. Here they might have
to think about the meaning of things.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #11
pete wrote:
.... snip ...
int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

for (n = 0; n != 6; ++n) {
if (b_ptr[n] > a_ptr[n]) {
return -1;
}
if (a_ptr[n] > b_ptr[n]) {
return 1;
}
}
return 0;
}


In other words you have come to the arbitrary decision that the
highest indexed component of the array is the most significant.
Fine, but you should document it in the comparison routine.
Whether or not this is what the OP wants is unknown.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #12
CBFalconer wrote:

pete wrote:
... snip ...

int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

for (n = 0; n != 6; ++n) {
if (b_ptr[n] > a_ptr[n]) {
return -1;
}
if (a_ptr[n] > b_ptr[n]) {
return 1;
}
}
return 0;
}


In other words you have come to the arbitrary decision that the
highest indexed component of the array is the most significant.


I don't understand what you mean.
Fine, but you should document it in the comparison routine.
Whether or not this is what the OP wants is unknown.


OP gave an example of what he wanted.
You snipped it:
now i want to sort each row of elements for above array,
like
1 2 3 4 5 6
1 2 5 10 20 30
...
etc.


/* BEGIN new.c output */

5 2 20 1 30 10
23 15 7 9 11 3
40 50 34 24 14 4
9 10 11 12 13 14
31 4 18 8 27 17
44 32 13 19 41 19
1 2 3 4 5 6
80 37 47 18 21 9

1 2 5 10 20 30
3 7 9 11 15 23
4 14 24 34 40 50
9 10 11 12 13 14
4 8 17 18 27 31
13 19 19 32 41 44
1 2 3 4 5 6
9 18 21 37 47 80

1 2 3 4 5 6
1 2 5 10 20 30
3 7 9 11 15 23
4 8 17 18 27 31
4 14 24 34 40 50
9 10 11 12 13 14
9 18 21 37 47 80
13 19 19 32 41 44

/* END new.c output */

--
pete
Nov 14 '05 #13
pete wrote:
CBFalconer wrote:
pete wrote:

... snip ...

int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

for (n = 0; n != 6; ++n) {
if (b_ptr[n] > a_ptr[n]) {
return -1;
}
if (a_ptr[n] > b_ptr[n]) {
return 1;
}
}
return 0;
}


In other words you have come to the arbitrary decision that the
highest indexed component of the array is the most significant.


I don't understand what you mean.
Fine, but you should document it in the comparison routine.
Whether or not this is what the OP wants is unknown.


OP gave an example of what he wanted.
You snipped it:
now i want to sort each row of elements for above array,
like
1 2 3 4 5 6
1 2 5 10 20 30
...
etc.


So he did. However, a decision has been made as to the relative
significance of the components. Notice that the opposite decision,
based on the highest order component of the array, would have given
the same result as far as his example actually went. So would an
array sort based on the 3rd (index 2) item of each array.

Which is not a criticism of your comparison function, but simply
pointing out the arbitrariness of the decisions taken. This sort
of thing will always come up when comparing arrays or structs,
while there is instinctive agreement on the meaning of comparison
between numbers or strings. For strings, the standard spells it
out anyway.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #14
CBFalconer wrote:

pete wrote:
CBFalconer wrote:
pete wrote:

... snip ...

int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

for (n = 0; n != 6; ++n) {
if (b_ptr[n] > a_ptr[n]) {
return -1;
}
if (a_ptr[n] > b_ptr[n]) {
return 1;
}
}
return 0;
}

In other words you have come to the arbitrary decision that the
highest indexed component of the array is the most significant.
I don't understand what you mean.
Fine, but you should document it in the comparison routine.
Whether or not this is what the OP wants is unknown.


OP gave an example of what he wanted.
You snipped it:
> now i want to sort each row of elements for above array,
> like
> 1 2 3 4 5 6
> 1 2 5 10 20 30
> ...
> etc.


So he did. However, a decision has been made as to the relative
significance of the components. Notice that the opposite decision,
based on the highest order component of the array, would have given
the same result as far as his example actually went.


I still don't understand.

int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

n = 6;
while (n-- != 0) {
if (b_ptr[n] > a_ptr[n]) {
return 1;
}
if (a_ptr[n] > b_ptr[n]) {
return -1;
}
}
return 0;
}

gives:
9 18 21 37 47 80
4 14 24 34 40 50
13 19 19 32 41 44
4 8 17 18 27 31
1 2 5 10 20 30
3 7 9 11 15 23
9 10 11 12 13 14
1 2 3 4 5 6

int a6int_comp(const void *a, const void *b)
{
size_t n;
const int *a_ptr = a;
const int *b_ptr = b;

n = 6;
while (n-- != 0) {
if (b_ptr[n] > a_ptr[n]) {
return -1;
}
if (a_ptr[n] > b_ptr[n]) {
return 1;
}
}
return 0;
}

gives :
1 2 3 4 5 6
9 10 11 12 13 14
3 7 9 11 15 23
1 2 5 10 20 30
4 8 17 18 27 31
13 19 19 32 41 44
4 14 24 34 40 50
9 18 21 37 47 80
So would an
array sort based on the 3rd (index 2) item of each array.
I think I understand that, but that would be silly.
Which is not a criticism of your comparison function, but simply
pointing out the arbitrariness of the decisions taken. This sort
of thing will always come up when comparing arrays or structs,
while there is instinctive agreement on the meaning of comparison
between numbers or strings. For strings, the standard spells it
out anyway.


What do you mean about strings?

--
pete
Nov 14 '05 #15
pete wrote:
CBFalconer wrote:
.... snip ...
So would an
array sort based on the 3rd (index 2) item of each array.


I think I understand that, but that would be silly.


Why? It depends on the needs. For an example we have some device
out there reporting its position through a gray code encoder. For
each position it reports a magnitude. We collect a herd of these,
and the cycle of positions is one of the arrays in your 2d array.
Its sequence goes 000, 001, 011, 111, 110, 100 (ok, so its not a
proper gray, but only one bit changes at a time avoiding gross
errors). We use these as index values into the array.

Now we want so treat those arrays as attaching greater importance
to the earlier entry. Write the comparison function.

We can complicate it further by saying the magnitudes stored in the
arrays are also gray encoded. This is a quite reasonable thing to
do, in order to avoid major errors due to race conditions between
bits.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #16
CBFalconer wrote:

pete wrote:
CBFalconer wrote:

... snip ...
So would an
array sort based on the 3rd (index 2) item of each array.


I think I understand that, but that would be silly.


Why?


I don't that think OP's specifications are as cryptic
as you seem to think that they are.

--
pete
Nov 14 '05 #17
pete wrote:

CBFalconer wrote:

pete wrote:
CBFalconer wrote:
... snip ...

> So would an
> array sort based on the 3rd (index 2) item of each array.

I think I understand that, but that would be silly.


Why?


I don't


think
that think OP's specifications are as cryptic
as you seem to think that they are.

--
pete
Nov 14 '05 #18
pete wrote:

pete wrote:

CBFalconer wrote:

pete wrote:
> CBFalconer wrote:
>
... snip ...
>
>> So would an
>> array sort based on the 3rd (index 2) item of each array.
>
> I think I understand that, but that would be silly.

Why?


I don't


think
that OP's specifications are as cryptic
as you seem to think that they are.


There were about one or two typos.

--
pete
Nov 14 '05 #19
pete wrote:

CBFalconer wrote:
pete wrote:
CBFalconer wrote:

... snip ...

So would an
array sort based on the 3rd (index 2) item of each array.

I think I understand that, but that would be silly.


Why?


I don't that think OP's specifications are as cryptic
as you seem to think that they are.


Probably not, but I could write a lot of software that would meed
the specs and be totally useless. This sort of thing leads to
lawsuits and other things that enhance the lawyers standard of
living. And all I really said in the first place was "document
what you wrote".

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #20
CBFalconer wrote:

pete wrote:

CBFalconer wrote:
pete wrote:
CBFalconer wrote:

... snip ...

> So would an
> array sort based on the 3rd (index 2) item of each array.

I think I understand that, but that would be silly.

Why?
I don't that think OP's specifications are as cryptic
as you seem to think that they are.


Probably not, but I could write a lot of software that would meed
the specs and be totally useless. This sort of thing leads to
lawsuits and other things that enhance the lawyers standard of
living.


You're becoming Nilgean.
And all I really said in the first place was "document
what you wrote".
No, it was really strange.
If you're going to use quotes, quote what you wrote.
You said
"In other words you have come to the arbitrary decision that the
highest indexed component of the array is the most significant.
Fine, but you should document it in the comparison routine.
Whether or not this is what the OP wants is unknown."

Now we both know that I can't document an arbitrary decision that the
highest indexed component of the array is the most significant,
because there's nothing like that going on anywhere.

Then you went on to say,
"Notice that the opposite decision,
based on the highest order component of the array,
would have given the same result as far as his example actually went."

.... and since there's no way that that method could produce this:
1 2 3 4 5 6
1 2 5 10 20 30
...
etc.
from this:
1 2 5 10 20 30
3 7 9 11 15 23
4 14 24 34 40 50
9 10 11 12 13 14
4 8 17 18 27 31
13 19 19 32 41 44
1 2 3 4 5 6
9 18 21 37 47 80
(works fine!)


.... what that tells me mostly,
is just simply that you are confused
and didn't understand the problem to begin with.

--
pete
Nov 14 '05 #21
On Tue, 14 Jun 2005 00:44:10 GMT, pete <pf*****@mindspring.com> wrote:
CBFalconer wrote:

pete wrote:
>
> I don't that think OP's specifications are as cryptic
> as you seem to think that they are.


Probably not, but I could write a lot of software that would meed
the specs and be totally useless. This sort of thing leads to
lawsuits and other things that enhance the lawyers standard of
living.


You're becoming Nilgean.


Don't use that term too lightly. Nilges would have written a 500+ line
article claiming the poster is guilty of imperialism and how the
poster is actually an unknowing minion (brainwashed by George Lucas)
in a dark scheme of shady neocon agents ;-)

I still try to figure out his claim that favoring C over VB is
actually racist. I just can't see the connection (perhaps it's better
that way :-)

Nov 14 '05 #22
Paul Mesken wrote:

On Tue, 14 Jun 2005 00:44:10 GMT, pete <pf*****@mindspring.com> wrote:
CBFalconer wrote:

pete wrote:
>
> I don't that think OP's specifications are as cryptic
> as you seem to think that they are.

Probably not, but I could write a lot of software that would meed
the specs and be totally useless. This sort of thing leads to
lawsuits and other things that enhance the lawyers standard of
living.


You're becoming Nilgean.


Don't use that term too lightly. Ni


shh, he greps newsfeed. never spell his name.

--
pete
Nov 14 '05 #23
pete wrote:
.... snip ...
You're becoming Nilgean.


Savage. This means war :-)

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #24

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

40
by: Elijah Bailey | last post by:
I want to sort a set of records using STL's sort() function, but dont see an easy way to do it. I have a char *data; which has size mn bytes where m is size of the record and n is the...
3
by: SilverWolf | last post by:
I need some help with sorting and shuffling array of strings. I can't seem to get qsort working, and I don't even know how to start to shuffle the array. Here is what I have for now: #include...
16
by: aruna | last post by:
Given a set of integers, how to write a program in C to sort these set of integers using C, given the following conditions a. Do not use arrays b. Do not use any comparison function like if/then...
4
by: dough | last post by:
I have a hash table with seperate chaining with a bunch of words in it. Here is my declaration: typedef struct word *word; struct word { int count; char *s; word next; };
25
by: Allie | last post by:
How would I go about sorting this structure by title? typedef struct { char author; char title; char code; int hold; int loan; } LIBRARY;
4
by: rushik | last post by:
Hello all, I am using structure in my program, and my aim is to sort this structure based on some optimized sorting algo. structure is struct data { int account;
10
by: seyensubs | last post by:
I have the following implementations of quicksort and insertion sort: def qSort(List): if List == : return return qSort( if x< List]) + List + \ qSort( if x>=List]) def insertSort(List):...
7
by: abracadabra | last post by:
I am reading an old book - Programming Pearls 2nd edition recently. It says, "Even though the general C++ program uses 50 times the memory and CPU time of the specialized C program, it requires...
77
by: arnuld | last post by:
1st I think of creating an array of pointers of size 100 as this is the maximum input I intend to take. I can create a fixed size array but in the end I want my array to expand at run-time to fit...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.