adding the identation rules
This commit is contained in:
@@ -74,7 +74,7 @@ The line is enclosed with a pair of curly braces. And every line has these same
|
||||
|
||||
Each field is a key-value pair.
|
||||
|
||||
Please note that all existing comments which are direct responses to the original video, are considered as sibilings. And they do not have a parent. The *parent_comment_id* field of these comments is empty. The following is such an example:
|
||||
Please note that all comments which are direct responses to the original video, are considered as siblings. And they do not have a parent. The *parent_comment_id* field of these comments is empty. The following is such an example:
|
||||
|
||||
```console
|
||||
{"video_id": "zz42pQ-2ytI", "author": "@user-ek5tl4nu7p", "comment_id": "UgwELiGkULP-8OvPOAZ4AaABAg", "like_count": 826, "reply_count": 33, "is_reply": false, "parent_comment_id": "", "published_date": "7 hours ago (edited)", "crawled_date": "2023-10-29T23:00:47.300265", "is_video_owner": false, "comment": "I am a Man City fan, but I have to ask the Man United players, how could they leave Haaland so wide open on the second goal."}
|
||||
@@ -188,7 +188,7 @@ All expected output files are provided. Among all the five operations mentioned
|
||||
|
||||
When displaying the comments, we need to consider the displaying order of the comments. The rules are:
|
||||
|
||||
1. existing comments: comments which are included in **the json file** are existing comments. And when displaying existing comments, a parent comment should be displayed (i.e., printed to the output file) before its children comments are displayed (i.e., printed to the output file). Two children comments which have the same parent should stay in the order as they are in **the json file**. For example, both A and B are existing commens, if comment A appears in line 1 of **the json file**, and comment B appears in line 4 of **the json file**, then comment A should be displayed (i.e., printed to the output file) before comment B is displayed (i.e., printed to the output file). Also, two comments which are both a response to the original video, should stay in the same order as they appear in **the json file**.
|
||||
1. existing comments: comments which are included in **the json file** are existing comments. And when displaying existing comments, a parent comment should be displayed (i.e., printed to the output file) before its children comments are displayed (i.e., printed to the output file). Two children comments which have the same parent should stay in the order as they are in **the json file**. For example, both A and B are existing commens, if comment A appears in line 1 of **the json file**, and comment B appears in line 4 of **the json file**, then comment A should be displayed (i.e., printed to the output file) before comment B is displayed (i.e., printed to the output file). Also, two comments which are both responses to the original video, should stay in the same order as they appear in **the json file**.
|
||||
2. newly added comments: for newly added comments, a parent comment should be displayed (i.e., printed to the output file) before its children comments are displayed (i.e., printed to the output file). Two children comments who have the same parent should stay in the same order as they are in **the second input file**.
|
||||
3. if a newly added comment is a reply to an existing comment, then it should be displayed right below that existing comment.
|
||||
4. if a newly added comment is a response to the original video, then this newly added comment should be displayed at the very bottom; in other words, it should be displayed after all existing comments are displayed.
|
||||
@@ -196,6 +196,12 @@ When displaying the comments, we need to consider the displaying order of the co
|
||||
|
||||
To summerize the rules, in this homework, no sorting is needed.
|
||||
|
||||
### Indentation
|
||||
|
||||
Just like youtube, we use indentations to display the tree structure of the comments. More specifically, a child comment should be indented by four space characters relative to its parent comment. Sibling comments should have the same identation.
|
||||
|
||||

|
||||
|
||||
## Program Requirements & Submission Details
|
||||
|
||||
In this assignment, you are required to maintain the comments in tree nodes, each comment should be stored in one tree node. You are NOT allowed to use any data structures we have not learned so far, but feel free to use any data structures we have already learned, such as std::string, std::vector, std::list, std::map, std::set, std::pair. **You must use recursion in your program in at least one of your functions.**
|
||||
|
||||
Reference in New Issue
Block a user