How can i find Total access time in tree help me ^_^ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i find Total access time in tree help me ^_^

I have a txt file like below. The order is “number,word,frequency”. “1,home,23 2,car,56 3,toy,123 4,New York,3 5,human,78 Etc.....” A)How can i seperate them by commas then build a BST with the key “word” ? (I DID THIS PART) b)Suppose that the number of accesses to word in your tree is directly the frequency of the word given in the table. Calculate Total Access Time in the tree you build in (a). PLS HELP ME I should write this in C but im not good at data structures i cant do it and i have limited time :(

2nd Dec 2020, 8:30 PM
Jongin
Jongin - avatar
1 Answer
+ 1
For seperating words take a look at the `strtok` function. For converting strings to integers you can use `strtol`. Your tree will probably look something like typedef struct tree { char* key; int value; struct tree* left; struct tree* right; } tree; That should get you started.
3rd Dec 2020, 1:49 AM
Schindlabua
Schindlabua - avatar