0
How do you print out words read from a file in alphabetical order using linked list
2 Antworten
+ 5
I'd just read the whole lot into nodes and then shuffle them. Here's an example code I did with, ironically, an alphabetical sort included. It was intended to show the use of a struct containing a pointer of that struct-type in C (a little OO-ish for C actually). Still, might be of use as it does what your question asks.
https://code.sololearn.com/c0aLC4piZ8L4/?ref=app
+ 2
Each word you read should be placed into the correct alphabetic order in the link list as you read it. This talks about how to do it.
https://www.geeksforgeeks.org/insert-node-middle-linked-list/