Input (from stdin): A text consisting of two lines of words in the following format: + line 1: the first line of words, separated by a white space. + line 2: the second line of words separated by a white space. + note that the last line does not contain \n' Requirement: + use a binary search tree to store the words on the first line, each in a node. + the tree follows the order that the word at a node alwavs appears before the word at its right
Input (from stdin): A text consisting of two lines of words in the following format: + line 1: the first line of words, separated by a white space. + line 2: the second line of words separated by a white space. + note that the last line does not contain \n' Requirement: + use a binary search tree to store the words on the first line, each in a node. + the tree follows the order that the word at a node alwavs appears before the word at its right
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...
Related questions
Question
![Problem Description: Write a C program to do the following
Input (from stdin): A text consisting of two lines of words in the following format:
+ line 1: the first line of words, separated by a white space.
+ line 2: the second line of words separated by a white space.
+ note that the last line does not contain In'
Requirement:
+ use a binary search tree to store the words on the first line, each in a node.
+ the tree follows the order that the word at a node always appears before the word at its right
child node and after the word at its left child node, according to the dictionary (alphabetical)
order. You can use function strcmp(.) to compare strings.
+ after the tree is built, delete all the nodes storing the words on the second line. The lower
case and upper case of a character are considered the same (e.g., "hi" and "Hi" and "HI" are
considered identical).
Output (to stdout): two lines of text, all converted to lower case
+ line 1: the original words in the alphabet order, separated by single white space
+ line 2: the remaining words (after deletions), separated by single white space, in the order
they appear original on line 1 of the input text
Hint: you should create a struct for each node of the tree with the following attributes:
+ the word that is stored
+ the position of the word in the original text input's line 1
+ the pointers for the left and right children of the node
Examples:
Input1
hello world 123
world
Outputl
123 hello world](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F1bc6a0e5-2ee6-4288-975e-2cc10c81a0cb%2F0ab11491-dabf-420a-93c5-5fa2543222b8%2Fcpwi4yk_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Problem Description: Write a C program to do the following
Input (from stdin): A text consisting of two lines of words in the following format:
+ line 1: the first line of words, separated by a white space.
+ line 2: the second line of words separated by a white space.
+ note that the last line does not contain In'
Requirement:
+ use a binary search tree to store the words on the first line, each in a node.
+ the tree follows the order that the word at a node always appears before the word at its right
child node and after the word at its left child node, according to the dictionary (alphabetical)
order. You can use function strcmp(.) to compare strings.
+ after the tree is built, delete all the nodes storing the words on the second line. The lower
case and upper case of a character are considered the same (e.g., "hi" and "Hi" and "HI" are
considered identical).
Output (to stdout): two lines of text, all converted to lower case
+ line 1: the original words in the alphabet order, separated by single white space
+ line 2: the remaining words (after deletions), separated by single white space, in the order
they appear original on line 1 of the input text
Hint: you should create a struct for each node of the tree with the following attributes:
+ the word that is stored
+ the position of the word in the original text input's line 1
+ the pointers for the left and right children of the node
Examples:
Input1
hello world 123
world
Outputl
123 hello world
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY