Nodes
Learn about nodes, the building-block data structure.
StartKey Concepts
Review core concepts you need to learn to master this subject
Node: An individual part of a larger data structure
Orphaned nodes
Null node link
Python Node implementation
Node: An individual part of a larger data structure
Node: An individual part of a larger data structure
Nodes are a basic data structure which contain data and one or more links to other nodes. Nodes can be used to represent a tree structure or a linked list. In such structures where nodes are used, it is possible to traverse from one node to another node.
Nodes: Python
Lesson 1 of 1
- 1Now that you have an understanding of what nodes are, let’s see one way they can be implemented using Python. We will use a basic node that contains data and one link to another node. The node’s …
- 2We need methods to access the data and link within the node. For this, we will use two getters, .get_value() and .get_link_node(). These should each return their corresponding value on the self ob…
- 3We are only allowing the value of the node to be set upon creation. However, we want to allow updating the link of the node. For this, we will use a setter to modify the self.link_node attribute. …
- 4We have a few zany characters to keep track of and Python nodes may do just the trick. Let’s get started…
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory