Reference no: EM13923168
Overview:
In this assignment you will combine the code you have written for Binary Search Trees (BSTs) and Red Black 'Rees (RBTs) in previous labs to produce a tree ADT which can be either a simple BST or a self-balancing RBT. You must write a main .c which will create a tree, fill it with words read from stdin, and then print them out in alphabetical order.
Specific details
• All instances of bst/rbt should be replaced with tree in your tree .c file.
• Add an enumerated type to tree .h so that tree_new() can be called like this tree t = tree_new(RBT);
• By default your program should create a tree which is a simple BST. If given -r as a command-line option it should create a tree which is an RBT instead.
• Words should be read using the getword() function from the lab book. It should not be possible to add duplicate words to your tree.
• By default your program should print out all of the words contained in your tree (one word per line) by passing a print_key() function to your tree_inorder () function.
• If given -p as a command-line option words should be printed using a pre-order traversal instead of an in-order one.
• Don't implement a tree_remove() function since removing nodes from an RBT can be a bit tricky. Get rid of your old bst_remove 0 code since using it would break an RBT.
• Add a tree_depth 0 function which should return the length of the path between the root node and the most distant leaf node (excluding the nils at the end of an RBT). If given -d as a command-line option the tree depth should be printed to stderr.
• You may have noticed that the RBT you implemented in labs doesn't ensure that the root is always black. This doesn't affect the structure of the tree at all, but we would like you to remedy this situation.
• We have provided a couple of functions for you to add to your tree .c which you can find in the file /home/cshome/coursework/242/Asgn3/out put -dot . txt
These functions will produce a representation of your tree in the DOT graph description language. This DOT representation can be converted to a pdf (as described in tree_output_dot 0's comment) to help you visualise what your tree looks like.
• If -o output-filename is given as a command-line option then you should call tree_output_dot 0 with output-filename and your tree as arguments (after your tree has been filled).
• If -h is given as a command-line option then a usage message should be printed and your program should exit.
• All memory allocated should be deallocated before your program finishes.
Individual personality profiles
: After filling out apersonality test, students were given individual personality profiles. Mostsaid that their profiles were fairly good descriptions of themselves, and theywere amazed to discover that they had all received the same profile. Thisil..
|
Is it possible for organisations to follow emergent strategy
: Examine the criticisms of prescriptive strategies in Section 2.1. Is it possible for organisations to follow both prescriptive and emergent strategies or do they need to choose?
|
Present an entity-relationship model?
: The company has several branch offices. Each branch is identified by a branch_number. The name, address (street, city, ZIP), and revenue_target of each branch office are maintained.
|
Leading cause of death in the united states
: According to the National Heart Lung and Blood Institute, "COPD is the 3rd leading cause of death in the United States.
|
Produce a tree adt
: Combine the code you have written for Binary Search Trees (BSTs) and Red Black 'Rees (RBTs) in previous labs to produce a tree ADT which can be either a simple BST or a self-balancing RBT.
|
Determine degree of turbulence in hollywood film industry
: Determine the degree of turbulence in the Hollywood film industry. Give reasons for your views. Develop and compare the key factors for success in the following three industries.
|
Describing a situation affects moral awareness
: The type of language used when describing a situation affects moral awareness
|
Warranties-an interesting liability on a clients books
: Product Warranties Provide an original and substantive response to the questions posed in your Journal in a minimum of 200 words. Product warranties are an interesting liability on a client's books.
|
Advantages and disadvantages for each selection method
: Use the table provided or create one of your own using the program of your choice-MS Word, MS Excel, etc.-to define each selection method. Explain the nature of the method and its importance. Then list all the advantages and disadvantages for each..
|