04-11-2014

I need to write a C program that performs bucket sorting, with given data structure

typedef struct node *node_ptr;

struct node{

int a;

int b;

int n;

node_ptr next;

};

and array of buckets

node_ptr buckets[10000];

node_ptr buckets_rear[10000]; (needed to add efficiently at rear)

Given the 10 input as following:

(Input format: a, b, n)

0 2 5

0 3 5

0 4 2

0 6 5

1 3 4

1 4 5

2 4 12

2 5 9

3 6 6

5 6 12

The program will do bucket sort based on n

I'm clueless on this. Help me please ?

If someone can code it up, I'll award 10 points, thanks in advance !

Sorted result should be:

0 4 2

1 3 4

0 2 5

0 3 5

0 6 5

1 4 5

3 6 6

2 5 9

2 4 12

5 6 12

typedef struct node *node_ptr;

struct node{

int a;

int b;

int n;

node_ptr next;

};

and array of buckets

node_ptr buckets[10000];

node_ptr buckets_rear[10000]; (needed to add efficiently at rear)

Given the 10 input as following:

(Input format: a, b, n)

0 2 5

0 3 5

0 4 2

0 6 5

1 3 4

1 4 5

2 4 12

2 5 9

3 6 6

5 6 12

The program will do bucket sort based on n

I'm clueless on this. Help me please ?

If someone can code it up, I'll award 10 points, thanks in advance !

Sorted result should be:

0 4 2

1 3 4

0 2 5

0 3 5

0 6 5

1 4 5

3 6 6

2 5 9

2 4 12

5 6 12