Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview Sky Electric Company, Islamabad has hired you as a software engineer. The company has asked you to develop a software solution to manage the
Overview Sky Electric Company, Islamabad has hired you as a software engineer. The company has asked you to develop a software solution to manage the log files generated by their systems. The log files contain the technical details of the issues encountered during operation by the respective systems. You have gathered the following information after interviewing the support staff of the company: 1. There are different categories of log files, e.g. Voltage Log, Power Outage Log, etc. 2. The company wants to be able to: a. View the file directory tree in different ways (Pre Order, In Order, Post Order, Level, Order, and Tree View). b. Search a specific log file using quick search interface C. Merge two directories d. Add a log file/directory e. Delete a log file/directory f. Calculate size of a given log file/directory You have decided to develop a "File System Shell" to keep track of the log files and provide the requested features. The File System Shell Design You are required to generate an n-ary tree from the given directory structure, where "logs" directory becomes the root of the tree (see Appendix 1) such that: Sub directories and files become children and descendants of the root, structured exactly as in the "logs" directory Files should always be the leaf nodes Any number of new files and directories can be added to the tree Existing files and directories can be deleted from the tree Existing directories can be merged together Reporting In order to manage performance of the system, Sky Electric Company wants to view the log files in pre-order, post-order, in-order, level-order, as well as in the tree form. An example the tree form output is shown below: logs power outage logs old-logs.txt June LJune-power-log-10.txt June-power-log-12.txt voltage logs January Jan-vol-log-10.txt Jan-vol-log-15.txt LFebruary Feb-vol-log-10.txt Feb-vol-log-15.txt March Mar-vol-log-10.txt Mar-vol-log-15.txt Quick Search Tree For quick search you are required to construct (and keep updated) a Binary Search Tree to provide a quick search interface. BST of the above example is given below: (Jan-vol-log-10.txt Jan-vol-log-15.txt) (Feb-vol-log-10.txt Feb-vol-log-15.txt) M (Mar-vol-log-10.txt Mar-vol-log-15.txt) In the above BST, it is easy to navigate to a specific file using alphabetical search. It is very similar to finding a key term using the index of a book. The first character of the search string is compared with the character in root of BST, and based on the value, it is decided to get the path of the file from the list of files in the current node, or go to left or right. BST returns the path in m-ary tree of the required file. Bonus: You can get 5% bonus marks if you use AVL tree, which is a height-balanced tree that increases the search performance. Operations Display Tree (Already Discussed in The Directory Tree) Delete File/Folder This should update the quick search tree and actual directory accordingly, Merge Folders Merging copies all the contents of one directory into another. This should update quick Search tree and directory tree. Search File Already Discussed in Quick Search Tree) Appendix 1: logs wystemet powerlogo action septit 2016 Teplote pecto 2015Legs 2014L0GS 2014wertigt plagt ulogu declog.but feblog tot janleg.tut yogit og hot martog. maylog.it novlog tot odlog.be septlagt timesagebog admin Logo timelo admintog. usert ogs current Allage Der WAQASLog.it oct Alloh SWAQASLogit volt. octtogtat septet 2015 Logs jan Tolepti.og.it ToDecloght Overview Sky Electric Company, Islamabad has hired you as a software engineer. The company has asked you to develop a software solution to manage the log files generated by their systems. The log files contain the technical details of the issues encountered during operation by the respective systems. You have gathered the following information after interviewing the support staff of the company: 1. There are different categories of log files, e.g. Voltage Log, Power Outage Log, etc. 2. The company wants to be able to: a. View the file directory tree in different ways (Pre Order, In Order, Post Order, Level, Order, and Tree View). b. Search a specific log file using quick search interface C. Merge two directories d. Add a log file/directory e. Delete a log file/directory f. Calculate size of a given log file/directory You have decided to develop a "File System Shell" to keep track of the log files and provide the requested features. The File System Shell Design You are required to generate an n-ary tree from the given directory structure, where "logs" directory becomes the root of the tree (see Appendix 1) such that: Sub directories and files become children and descendants of the root, structured exactly as in the "logs" directory Files should always be the leaf nodes Any number of new files and directories can be added to the tree Existing files and directories can be deleted from the tree Existing directories can be merged together Reporting In order to manage performance of the system, Sky Electric Company wants to view the log files in pre-order, post-order, in-order, level-order, as well as in the tree form. An example the tree form output is shown below: logs power outage logs old-logs.txt June LJune-power-log-10.txt June-power-log-12.txt voltage logs January Jan-vol-log-10.txt Jan-vol-log-15.txt LFebruary Feb-vol-log-10.txt Feb-vol-log-15.txt March Mar-vol-log-10.txt Mar-vol-log-15.txt Quick Search Tree For quick search you are required to construct (and keep updated) a Binary Search Tree to provide a quick search interface. BST of the above example is given below: (Jan-vol-log-10.txt Jan-vol-log-15.txt) (Feb-vol-log-10.txt Feb-vol-log-15.txt) M (Mar-vol-log-10.txt Mar-vol-log-15.txt) In the above BST, it is easy to navigate to a specific file using alphabetical search. It is very similar to finding a key term using the index of a book. The first character of the search string is compared with the character in root of BST, and based on the value, it is decided to get the path of the file from the list of files in the current node, or go to left or right. BST returns the path in m-ary tree of the required file. Bonus: You can get 5% bonus marks if you use AVL tree, which is a height-balanced tree that increases the search performance. Operations Display Tree (Already Discussed in The Directory Tree) Delete File/Folder This should update the quick search tree and actual directory accordingly, Merge Folders Merging copies all the contents of one directory into another. This should update quick Search tree and directory tree. Search File Already Discussed in Quick Search Tree) Appendix 1: logs wystemet powerlogo action septit 2016 Teplote pecto 2015Legs 2014L0GS 2014wertigt plagt ulogu declog.but feblog tot janleg.tut yogit og hot martog. maylog.it novlog tot odlog.be septlagt timesagebog admin Logo timelo admintog. usert ogs current Allage Der WAQASLog.it oct Alloh SWAQASLogit volt. octtogtat septet 2015 Logs jan Tolepti.og.it ToDecloght
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started