Project 3 -Questions: CMSC341 --Fall 2001 -- Project 3 Kyu Bae xxx-xx-5868 section 201 kyu_bae@yahoo.com / kbae1@umbc.edu (1) Briefly describe how you would change your system to allow for multiple files to be loaded so that queries could run against more than one file at a time. After all, a search engine that works for a single web page isn't all that useful. answer: I would change the command file so that "LOAD filename" can load several filenames at once. Like this, "LOAD filename1 filename2 filename3 filename4" Then i will use getline() and use strtok to read in each file name. After i read in one filename i build Binary Search TREE. Then i read in next filename and insert into the very same BSTree. and you continue untill you read in all the filenames. The important thing to remember is that you don't call the destructor to make the tree empty or call makeEmpty() each time you read in filename and insert them into the tree. If you call the destructor or makeEmpty() each time you read in the file and inserting into the tree. Basically you are making a new tree each time you read in the filename. You want to read in all the filenames and insert them into one tree. In my program i called makeEmpty() beginning of "LOAD" function. Before i read in the filename, i call makeEmpty() to clean up the BS tree.. I am emptying the tree each time i load new filename. So one of changes is that before i read in several filenames i call the makeEmpty() to empty the previoud tree. and i do inserting into the tree...no destrucotr or makeEmpty() will be called a while i do those..Next time Load in is called then the old tree will be cleaned.. (2) We required that members used as keys in a binary search tree be declared const. Why? What if all of the variants of find() returned a constant reference as they were originally defined in the book? How would you have to change your code? answer: The members used as keys in a binary search tree was declared const in the textbook. Because all the find(), findMin(), and findMax() return const reference. Which means you cannot find the node and change the data members of your node class. All the variants of find were const so you wanted your data members of data class to be const also. You don't want users to mess with the node of your binary search tree and change the contents of your data members. If all of the variants of find() were returned a const reference as they were originally defined in the book, then i have to change my data members of data class to be const. So they cannot be changed. Since all the variants of find() are returned as const references, i need to find a way to change the contents of data members. This has to be done by Creating a new Node(new object of Data class) and inserting this node instead of found node(instread of changing old node) after deleting the found node(old node). But before you delete and insert new node into tree. you must get the content of old node and add them into the new node. When you add old node into the new node , you add old node content and plus 1(increment the counter by one). Since you cannot change you old node's content, you need to copy old node into the new node after incrementing the count by one. and destroy old node and insert new one. My program did not delete old node. If found the node you are trying to insert, i called the addOneMore() of found node which just increment the count data member by one and didn't insert the newNode. If not found the node you are trying to insert, insert it.