Restriction
1.Only <iostream>, <vector>, <stack>, <list>, and <string> can be used for this homework. For fairness and simplicity, other STL libraries or external librariesare not allowed.
2.Plagiarism is strictly prohibited. If we find any similarities between your code and another student's ,a penalty will be applied.
3.The due date is April 27th at 23:59. Late submissions will be penalized according to the previously announced policy
1. Commit
In the input command, we will give below command, as <total_files> will be an integer
After this commit command, the next input will consist of<total_files>entries representing filechanges. For each file, the format is:
First, there will be <insertion_lines> lines for insertion string to files, and then <deletion_lines> lines for deletion to the files.
Insertion will do the processing for the file first, based on the ascending line number. After insertion,we will delete the given line number for the new changes. <file_name> will only consist lowercase letter, while <line_changes> consist any letter or numbers, including space.
From this command, it will create a new node. The new node will be assigned as the children of the current node, and then the current node will be change to the recent created node
The line number for insertion and deletion are already sorted, so you don't need to sort it again
2. Switch
Switch the current node to <ID>, and <ID> will be integer.
After that you need to print "Swithed to Branch <ID>"
3. Open
We have implemented the print function for this, but you still need to complete the function to be able to implement this that return std::vector<std::string>
Details
1. The input will consist of N queries, each representing one of the commands described above.
2. The parameter of the input is describe below:
3. Try to submit using C++11 or above
4. This is a Partial Judge question, so you don’t need to worry about the input/output format.
5. You are required to implement the following functions:
6. Please refer to video or PPT if you struggle to understand the sample input/output
Git Structure
We have provided you with a GitNode and Commit class. Each GitNode is designed to store its own commit information.
The Commit class uses a Trie data structure: Trie-Wikipedia
Implementing a Trie is required to improve the performance of data searches, especially for the git open command.