-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectGuide.txt
More file actions
45 lines (38 loc) · 2.34 KB
/
Copy pathProjectGuide.txt
File metadata and controls
45 lines (38 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
We would like to implement a system that keeps track
of folders and the files they contain. A folder has a
name, a size (in bytes), and a collection of files. A folder
may contain multiple folders and multiple files. A file
has a name and a size. Whenever a file is added to or
deleted, the size of the parent folder changes. Similarly,
whenever a folder (containing files) is deleted, the size
of the parent folder changes. However, adding a new (empty) folder doesn’t change the size of its
parent folder.
• Requirements: Use mainly self-balancing binary search trees to keep track of the data in the
project. You are welcome to use these classes: AVL_Tree, red_black_tree
• You don’t have to write a menu-based program. You can simply test your functions manually in
the main function.
• Implement functions that support the following:
o void add_folder(string path, string folder_name)
The function adds a folder. The folder is added inside a parent folder. The function
searches for the parent folder using the given path. The path is a hierarchy of folders
where the last folder in the hierarchy is the parent of the to-be-added folder. Here is an
example of a path:
documents/programming/data_structures. The root folder is documents, and it
contains folder programming, which contains the data_structures folder.
The parent of the root folder is NULL.
o void delete_folder(string path, string folder_name)
This function deletes a folder with a given name. It searches for parent folder of the
given folder using the given path.
Notice: deleting a folder that contains files changes the size of the parent folder.
o void add_file(string path, string file_name, int size)
This function adds a file with a given name. It searches for parent folder of the file using
the given path.
Notice: adding a file changes the size of the parent folder.
o File get_file(string path, string file_name)
This function finds a file with a given name. It searches for the file using the given path.
o list<File> get_files(string path, string file_name)
This function finds all files which have names that start with the given parameter
(file_name). It searches for the files using the given path.
o void delete_file(string path, string file_name)
The function deletes the file with the given name. The location of the file is specified in
the path. Deleting the file changes the size of its parent folder.