You are hired by SkyElectric Inc., Islamabad for a sub product operating system used in their smart solar systems. The operating system is deployed in these smart solar systems just for debugging purposes and it maintains only the files classified in different categories. Voltage Log, Power Log is to name a few. Currently in their operating system they don’t have any file management system. The task assign to you from SkyElectric Inc. is to develop a File Directory Tree Shell for their operating system. The support team have some diverse people and they want to code such that they are able to see the file directory tree in Tree View (level order). The team also want a quick search interface to search a specific file/directory (using Binary Search Tree). The team also want to be able to merge directories of the given sub tree or tree, create, or delete file/directory. Operations and Details The Directory Tree You are required to generate an N-ary Tree from the root directory “/” (see log.txt) (attached with the assignment statement and should be placed in source folder) such that: • The root of the tree becomes the “/” directory • The sub directories and files become child nodes of the root
You are hired by SkyElectric Inc., Islamabad for a sub product
Operations and Details
The Directory Tree
You are required to generate an N-ary Tree from the root directory “/” (see log.txt) (attached with the assignment statement and should be placed in source folder) such that:
• The root of the tree becomes the “/” directory
• The sub directories and files become child nodes of the root
• Files should always be the leaf nodes
In order to satisfy the support team, you are required to display the directory tree in Tree form (level order traversal). An Example Tree form and output are as followed
In the above constructed BST, it’s easy to navigate to a specific file/directory. The asci of first character of the search string should be compared to the asci of character in BST and it can be easily decided to go left or right. Once the search string matches the file/directory names the function must return list of direct addresses (duplication allowed) from the directory tree (listNode structure is provided in Roll_no.h file).
Note: “/” is not included in BST. And you can’t create duplicate directory of “/”.
Trees Operations
• File writing
o Level order Output of Tree directory (Figure02)
o In-order, pre-order and post-order of BST.
Note: File writing will be used for testing purposes.
• Insert File/Folder
The support team should be able to insert a specific node in the directory tree, this should update the quick search tree and actual directory accordingly. You have to provide absolute path for insertion.
• Delete File/Folder
The support team should be able to delete a specific node from the directory tree, this should update the quick search tree and actual directory accordingly.
Note: “/” directory can’t be deleted.
• Merge Folders
The support team should be able to merge two directories (two nodes in directory tree and in actual). Merging can be done by copying all the content of first directory into second directory. This should update the quick search tree.
• Search (Already Discussed in Quick Search Tree)
Step by step
Solved in 3 steps with 3 images