Make a program in c that gets the names of sections of a book and information about the hierarchy among them and assembles the “index” of this book. A book actually contains parts, chapters, sections,...


Make a program in c that gets the names of sections of a book and information about the hierarchy among them and assembles the “index” of this book. A book actually contains parts, chapters, sections, topics, etc. However, to make it easier, here we generically call each of them a section. When writing the book, the author can write the sections in random order L and insert data at any time. You can also change your mind and delete sections and you can transfer a section from one place to another. To handle this, your program must maintain a tree that stores the hierarchy of sections and perform operations on this tree as per the author's requests: - Book's title. It is the “root” position in the hierarchy. - Insert new section. It can be requested as a subsection of another one or following an existing one. - Remove a section. Its entire subtree must be removed and the memory space freed (free). - Transfer from one position to another in the hierarchy. Obviously all subsections must be transferred together. - List the index. Show the tree in tabular and numbered format at the same time. The author, distracted, may refer to sections that he has not yet inserted into the tree. J In this case the program should output an error message and proceed performing the processing of the following actions. tip: The writer will never transfer a section below a descendant. tip: There will never be two sections with the same name at the same time. The implementation of the tree must be done with parent and sibling chaining. Nodes cannot contain extra information. There must be specific functions for each “instruction” described above. You can create other functions if you wish. In this Lab it is not necessary to use TAD restrictions. Therefore, any function can work directly on the nodes of the tree. In this Lab it is allowed to use global variables.
Sep 17, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here