Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have the cursor implementation of linked lists in c language and i need to make an array of linked lists using cursor implementation as i need this array to implement radix sort for strings

What I have tried:

typedef int PtrToNode; // simulates the idea of a pointer
typedef PtrToNode List; //simulates struct List
typedef PtrToNode Position; //simulates node*

typedef struct{
 char Element[50];
 Position Next; //simulates node * next
}Node;

///1. Create an array of pointer of node type
Node* buckets[27];


///function of radix sort that should have the array of linked lists
void Radix_Sort( char names[5][5],int max){
int i,j;

///1.initialize buckets
for(i=0;i<27;i++){
        buckets[i]=NULL;
}

///.2

    
 }   



}
Posted
Updated 6-Apr-18 23:00pm
Comments
OriginalGriff 6-Apr-18 11:53am    
And?
What have you tried?
Where are you stuck?
What help do you need?
Member 13766236 6-Apr-18 12:06pm    
I am stucked in how to make and initialize this array of cursor
Rick York 6-Apr-18 12:48pm    
You keep using the word "cursor" - what does any of this have to do with a cursor?

Anyway, look at the column titled "Related Questions" on the right. Someone asked practically the same question about their homework several years ago. You might find the discussion helpful.

1 solution

You must understand the concept of linked lists and cursors and use pointers. The cursor is only the pointer to the actual element. See also head and tail.

In the article How to create Linked list using C/C++ all is described, so read and understand the whole article.
C++
typedef struct Node{
 char text[50];
 Node* next; //used as a pointer to next node * next
};

Node *node1 = new Node;//allocate memory 
strcpy(node1->text, "This is node 1");
//
Node *node2 = new Node;
strcpy(node1->text, "This is node 2");
node2->next = node1;//link them
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900