How do you print out words read from a file in alphabetical order using linked list | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do you print out words read from a file in alphabetical order using linked list

7th Dec 2018, 9:10 PM
Lincoln
2 Answers
+ 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
8th Dec 2018, 10:58 PM
non
+ 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/
8th Dec 2018, 9:49 PM
John Wells
John Wells - avatar