ArticleslgStudy

computer science

Node (computer science)

Node (computer science) is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Node (computer science) rather than just read about it. In short: A node is a basic unit of a data structure, such as a linked list or tree data structure. Nodes contain data and also may link to other nodes.

Node (computer science) — main illustration
Node (computer science) — illustration

Key takeaways

  • Node (computer science) belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Node (computer science) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Node (computer science) from memory before moving on to harder problems.

Reference excerpt

A node is a basic unit of a data structure, such as a linked list or tree data structure. Nodes contain data and also may link to other nodes. Links between nodes are often implemented by pointers.

Nodes and trees

Nodes are often arranged into tree structures. A node represents the information contained in a single data structure. These nodes may contain a value or condition, or possibly serve as another independent data structure. Nodes are represented by a single parent node. The highest point on a tree structure is called a root node, which does not have a parent node, but serves as the parent or 'grandparent' of all of the nodes below it in the tree. The height of a node is determined by the total number of edges on the path from that node to the furthest leaf node, and the height of the tree is equal to the height of the root node. Node depth is determined by the distance between that particular node and the root node. The root node is said to have a depth of zero. Data can be discovered along these network paths. An IP address uses this kind of system of nodes to define its location in a network.

Definitions Child: A child node is a node extending from another node. For example, a computer with internet access could be considered a child node of a node representing the internet. The inverse relationship is that of a parent node. If node C is a child of node A, then A is the parent node of C. Degree: the degree of a node is the number of children of the node. Depth: the depth of node A is the length of the path from A to the root node. The root node is said to have depth 0. Edge: the connection between nodes. Forest: a set of trees. Height: the height of node A is the length of the longest path through children to a leaf node. Internal node: a node with at least one child. Leaf node: a node with no children. Root node: a node distinguished from the rest of the tree nodes. Usually, it is depicted as the highest node of the tree. Sibling nodes: these are nodes connected to the same parent node.

Markup languages Another common use of node trees is in web development. In programming, XML is used to communicate information between computer programmers and computers alike. For this reason XML is used to create common communication protocols used in office productivity software, and serves as the base for the development of modern web markup languages like XHTML. Though similar in how it is approached by a programmer, HTML and CSS is typically the language used to develop website text and design. While XML, HTML and XHTML provide the language and expression, the DOM serves as a translator.

Node type Different types of nodes in a tree are represented by specific interfaces. In other words, the node type is defined by how it communicates with other nodes. Each node has a node type property, which specifies the type of node, such as sibling or leaf. For example, if the node type property is the constant properties for a node, this property specifies the type of the node. So if a node type property is the constant node ELEMENT_NODE, one can know that this node object is an object Element. This object uses the Element interface to define all the methods and properties of that particular node. Different W3C World Wide Web Consortium node types and descriptions:

Document represents the entire document (the root-node of the DOM tree) DocumentFragment represents a "lightweight" Document object, which can hold a portion of a document DocumentType provides an interface to the entities defined for the document ProcessingInstruction represents a processing instruction EntityReference represents an entity reference Element represents an element Attr represents an attribute Text represents textual content in an element or attribute CDATASection represents a CDATA section in a document (text that will NOT be parsed by a parser) Comment represents a comment Entity represents an entity Notation represents a notation declared in the DTD

Node object A node object is represented by a single node in a tree. It can be an element node, attribute node, text node, or any type that is described in section "node type". All objects can inherit properties and methods for dealing with parent and child nodes, but not all of the objects have parent or child nodes. For example, with text nodes that cannot have child nodes, trying to add child nodes results in a DOM error. Objects in the DOM tree may be addressed and manipulated by using methods on the objects. The public interface of a DOM is specified in its application programming interface (API). The history of the Document Object Model is intertwined with the history of the "browser wars" of the late 1990s between Netscape Navigator and Microsoft Internet Explorer, as well as with that of JavaScript and JScript, the first scripting languages to be widely implemented in the layout engines of web browsers.

See also Vertex (graph theory)

References

External links Data Trees as a Means of Presenting Complex Data Analysis by Sally Knipe STL-like C++ tree class Archived 2020-11-26 at the Wayback Machine Description of tree data structures from ideainfo.8m.com WormWeb.org: Interactive Visualization of the C. elegans Cell Tree - Visualize the entire cell lineage tree of the nematode C. elegans (javascript)

Illustrations

Node (computer science): In graph theory, the image provides a simplified view of a network, where each of the numbers represents a different node.
In graph theory, the image provides a simplified view of a network, where each of the numbers represents a different node.
Node (computer science): A simple binary tree of size 9 and height 3, with a root node whose value is 2. The above tree is unbalanced and not sorted.
A simple binary tree of size 9 and height 3, with a root node whose value is 2. The above tree is unbalanced and not sorted.

Worked examples

Example 1 — a first encounter with Node (computer science)

Start with the simplest possible case. Write down what Node (computer science) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Node (computer science) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Node (computer science) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Node (computer science)

In research
Node (computer science) appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Node (computer science) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Node (computer science) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Graph data structures, Linked lists, so understanding it makes those chapters shorter.
In everyday life
Look for Node (computer science) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Node (computer science) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Node (computer science) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Node (computer science) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Node (computer science) in simple terms?

A node is a basic unit of a data structure, such as a linked list or tree data structure. Nodes contain data and also may link to other nodes.

Why does Node (computer science) matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Node (computer science)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Node (computer science).

Tags

  • Graph data structures
  • Linked lists

Keep exploring