• Home
  • University of the People
  • Data Structures (proctored course) CS 3303
  • Data Structures - Non-Binary Trees

Data Structures - Non-Binary Trees

CS 3303-01 Data Structures - AY2022-T5 Dashboard My courses CS 3303-01 - AY2022-T5 14 July - 20 July Learning Guide Unit 5 Learning Guide Unit 5 Unit 5 Learning Guide Overview Unit 5: Non-Binary Trees Topics: General tree definitions and terminology General Tree Implementations K-ary trees Sequential trees Learning Objectives: Become familiar with the terminology and definitions of general trees including: o Definition and characteristics of a tree, subtree, and forest - Be able to articulate how binary trees differ from non-binary or general trees Understand general tree definitions and terminology Recognize general tree data structures and how to implement them using both array and linked list structures Examine different approaches to general tree traversal Understand be able to implement general trees using a parent pointer approach Become familiar with special tree implementations including K-ary and sequential trees Introduction In unit 4 we were introduced to binary trees. Binary trees are so named because each node or branch of the tree can only have 2 branches. We saw implementations of binary trees with 1 branch, but we realize that there are 2 branches with one of them being null. In this unit we will look at trees that do not have this restriction of 2 branches off over every root The applications of general trees in computer science are extensive. To name just a few consider the following: The file system structure on the hard drive of your computer is structured as a tree. It has a root node which you access as a letter drive (perhaps as c:) under which are directories and within those directories are sub-directories producing the structure of a tree. Networks are implemented using a tree structure. Many of these trees together form a forest of trees. The internet can be thought of as a giant forest of trees. There are specific algorithms designed to traverse these complex trees efficiently that are used for network routing and have been implemented in what is called spanning tree protocol'. This protocol employs concepts from Kruskal and Prim's shortest path spanning tree algorithms. Indexes in database systems are used to allow specific values to be found quickly. These indexes are often organized as special tree structures known as B-trees which are implementations of a general tree What we learn in chapter 6, is that general trees don't have the rigid structure that we saw in binary trees. This can result in general trees which are unbalanced having more nodes and leafs on one side than another. This can make traversal less efficient. Path compression is a technique that can compress these unbalanced trees to shorten the length between the root and leaf. We also are introduced to the concept of a union which is the process of combining two trees into a single tree while at the same time reducing the depth of the tree. In our text, Schaffer points out that this can be accomplished with a union or with a weighted union rule. We also expl