8/7/22, 1:32 AM
CS 3303-01 - AY2022-T5: Discussion Forum-Unit 4
CS 3303-01 Data Structures - AY2022-T5
Dashboard / My courses / CS 3303-01 - AY2022-T5 / 7 July - 13 July / _Discussion Forum Unit 4 /_Discussion Forum-Unit 4
Search forums
Discussion Forum Unit 4
Discussion Forum-Unit 4
# Settings
Display replies in nested form
The cut-off date for posting to this forum is reached so you can no longer post to it.
Discussion Forum-Unit 4
Discussion Assignment
In your own words, provide a definition of a binary tree and discuss its9 implementation. Include in your discussion the following terminology: Root, Node, Sub-Tree, Height, Depth, and Leaf.
31 words
Permalink
Re: Discussion Forum-Unit 4 by Ilia Ragozin - Friday, 8 July 2022, 1:23 PM
Binary tree.
In computer science, a binary tree is a data structure, that carries data in objects called Nodes, that are connected to each other logically or through some particular mechanics, like holding pointers. The property of a tree that is "binary" implies thal the node can not have more than two other nodes connected to it and the definition of "tree" implies that every node can have not more than one connection pointing to it.
If the node does not have any other node pointing to it, it is called a Root, and the Root must be the first node to start with for every operation with a tree. That means whatever binary tree we are using we always must know how to access the Root.
The fact that the Node, including the Root, can have two pointers (or other logical ways to point) to two different nodes divide
and all the nodes below it. With the two pointers, it is logical to call two subtrees a left and a right one.
the node is the length of the path from the root to that node, and the farthest node would define a tree depth. The Height of
the tree is defined by the longest path from the root to one of the nodes (plus one), following the pointers from each node. TI Width of the tree is defined as the largest number of nodes at the same level (the same length path from the root).
https://my.uopeople.edu/mod/forum/discuss.php?d=808744
1/46
8/7/22, 1:32 AM
CS 3303-01 - AY2022-T5: Discussion Forum-Unit 4
ROOT
NODE
Width
SUBTREE
Heigth
If we consider the textbook, Shaffer (2011), gives rather a description, than a definition of a binary tree, saying that it is a dat:
structure that consists of a "finite set of elements called nodes", and has a root node with subtrees (p. 153). This is concise
with the description we gave above.
Implementations.
There is a number of ways to implement a binary tree, but the two most common are:
1. Pointer-based implementation. This implementation assumes to use of a class for a node, the class would contain two members that store pointers to the other two nodes,or a Null value if this is a terminal node for a subtree (Shaffe