generated from uclaacm/teach-la-ts-react-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* exercise-6 multiline setup * fix multiline selector * further add dropdown options * minor fix --------- Co-authored-by: Chengheng Li <li471115381@gmail.com>
- Loading branch information
1 parent
b3323ad
commit dc4520a
Showing
5 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { FC } from 'react'; | ||
import '../styles/Exercise6.scss'; | ||
import RunCode from '../components/RunCode'; | ||
|
||
const question = [ | ||
{ | ||
options: [ | ||
'head = new Node();\nhead->next = new Node();\nhead->next = head;\ntail = head->next;', | ||
'head = new Node();\nhead->next = new Node();\nhead->next = head;\ntail = head->next;', | ||
'*head = new Node();\n*(head->next) = new Node();\n*(head->next->prev) = *head;\ntail = *head->next;', | ||
'head = new Node();\nhead-> next = new Node();\ntail = head->next;\nhead->next->prev = head;', | ||
], | ||
answer: | ||
'head = new Node();\nhead-> next = new Node();\ntail = head->next;\nhead->next->prev = head;', | ||
correctText: | ||
'Correct! Let’s go through this line by line. The first line creates a new node and assigns head to point to it. The second line creates a second node and assigns the head node’s next pointer to point to it. The third line assigns tail to point at the second node, since it copies the head node’s next pointer. The fourth line actually simplifies to tail->prev = *head, since from the third line we know tail = head->next, it assigns the previous pointer of the tail node to point back to the head node.', | ||
wrongText: 'Not quite', | ||
}, | ||
]; | ||
|
||
const Exercise6: FC = () => { | ||
return ( | ||
<div className="exercise6-div"> | ||
<RunCode | ||
questions={question} | ||
displayText={ | ||
'Which code segment correctly starts the linked list?\n Node* head; // head Node, assume Node class is defined\nNode* tail; // tail Node' | ||
} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Exercise6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.exercise6-div { | ||
white-space: pre-wrap; | ||
word-break: break-all; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters