The aim is to save the words in a given text file (.txt) in the tree structure given below and speed up the search. After parsing each word in the text file, both the word itself and the line number of the words in the text will be recorded in the tree. Below is an example of what to do. It will be accepted that the following sentence is in the first line of the text. This is the first sentence of the text and you can write whatever you want in the (.txt) file, my dear experts. “There are cups in a bin with binary bits on them kept in a cupboard" Create the above tree structure. The nodes of the tree are indicated by circles. Each node contains a character and a reference to a link list. Whether there is an element in the link list depends on whether that node is the last letter of a word in the text. More explanations are available below. Each word in the text is located on a path in the tree. The word is sometimes found at the leaf nodes, sometimes it is located before it reaches the leaf. Examples of words on the leaf are "cupboard", "cups" and "binary". Examples of words formed before reaching the leaf are only the words "a" and "bin". An arrow and a box are placed at the nodes where the end of the words is located. The arrow and the following box from these nodes represent a linked list. Each element of the linked list represents the line in which this word occurs in the text. There can be more than one element in a linked list, as words can be found on different lines. For example, if we accept that the word "cupboard" occurs on lines 1, 3 and 12, the linked list linked to the letter "d" above should be as follows:   If you pay attention, it can be seen that the linked list only depends on the last letters of the words in the text. Although it is in the dictionary, some words are not included in the text, so they are not accepted as words in the tree above. For example, although the words "cup", "the" and "wit" are in the English dictionary, they are not included as words in the tree above (because there is no linked list after the letters "p", "e" and "t"). When the tree is examined, it will be seen that the siblings are added as nodes in alphabetical order to speed up the search. After the above tree structure is created, the user should be given the opportunity to search. For example, when the user searches for the word "cup", it should not be found, but should be found with the word "cups" (by browsing the tree structure). If found, the lines that are passed should be reported to the user. This code should have "strtok" function, it will parse words! No "binary search tree" or "binary tree" will be used in this question. Other than "right" and "left", other things will be needed.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Urgent! It's just a question and explained in detail.
I need expert help on this question. I can't solve the question and I keep making mistakes.
C language, tree and list structure will be used.


The aim is to save the words in a given text file (.txt) in the tree structure given below and speed up the search. After parsing each word in the text file, both the word itself and the line number of the words in the text will be recorded in the tree.
Below is an example of what to do.
It will be accepted that the following sentence is in the first line of the text. This is the first sentence of the text and you can write whatever you want in the (.txt) file, my dear experts.


“There are cups in a bin with binary bits on them kept in a cupboard"

Create the above tree structure.

The nodes of the tree are indicated by circles. Each node contains a character and a reference to a link list. Whether there is an element in the link list depends on whether that node is the last letter of a word in the text. More explanations are available below.

Each word in the text is located on a path in the tree. The word is sometimes found at the leaf nodes, sometimes it is located before it reaches the leaf.
Examples of words on the leaf are "cupboard", "cups" and "binary".
Examples of words formed before reaching the leaf are only the words "a" and "bin".

An arrow and a box are placed at the nodes where the end of the words is located. The arrow and the following box from these nodes represent a linked list. Each element of the linked list represents the line in which this word occurs in the text. There can be more than one element in a linked list, as words can be found on different lines. For example, if we accept that the word "cupboard" occurs on lines 1, 3 and 12, the linked list linked to the letter "d" above should be as follows:

 

If you pay attention, it can be seen that the linked list only depends on the last letters of the words in the text.

Although it is in the dictionary, some words are not included in the text, so they are not accepted as words in the tree above. For example, although the words "cup", "the" and "wit" are in the English dictionary, they are not included as words in the tree above (because there is no linked list after the letters "p", "e" and "t").

When the tree is examined, it will be seen that the siblings are added as nodes in alphabetical order to speed up the search.
After the above tree structure is created, the user should be given the opportunity to search. For example, when the user searches for the word "cup", it should not be found, but should be found with the word "cups" (by browsing the tree structure). If found, the lines that are passed should be reported to the user.

This code should have "strtok" function, it will parse words!

No "binary search tree" or "binary tree" will be used in this question. Other than "right" and "left", other things will be needed.

 

W
e
u
n
n
e
a
e
e
p
b
y
t
Transcribed Image Text:W e u n n e a e e p b y t
d
1
3
12
Transcribed Image Text:d 1 3 12
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY