forked from codepath/compsci_guides
-
Notifications
You must be signed in to change notification settings - Fork 0
Node Class
Jessica Sang edited this page Sep 14, 2024
·
1 revision
Unit 5 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
- How do we ensure that each node is initialized correctly?
- Each node must be instantiated with its respective value, confirming that the constructor correctly sets up the node with this value.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Utilize the provided Node class to create two separate nodes, each initialized with specific values, and store them in designated variables.
1) Instantiate a node with the value 'a' and store it in the variable `node_one`.
2) Instantiate another node with the value 'b' and store it in the variable `node_two`.
- Incorrectly setting the value of a node.
- Not using the correct syntax for creating an instance of a class.
node_one = Node('a')
node_two = Node('b')