You are on page 1of 16

Programacion 4

Syllabus
• Heap Trees
• Maximum and Minimum Heaps
• Heapify - Heapsort
• Binary Tree
• Binomial Heap
• Usages
• B-Trees
• B-Tree
• 2-3 Tree
• B+ Tree
• Usages
• Parallel Programming and Concurrency
Bibliography
• Aho, A., Hopcroft, J. Ullman, J (1988). Data Structures and
Algorithms. Addison-Wesley.
• Cormen, T. (2009). Introduction to Algorithms. MIT Press.
• Knuth, D. (1973). The Art Of Computer Programming Vol. 3: Sorting
and Searching. Addison-Wesley.
• GeeksforGeeks | A computer science portal for geeks
• 241: Notes (cpp.edu)
• Intro to Algorithms: Table of Contents (ustc.edu.cn)
Practices
• Create a personal repository on Gitlab named Programacion4
• The repository will be used for ALL personal practices
• Add user marcelo.garnica.salesiana as Maintainer
• Create a Folder for each practice with the following format
• {practice_number}-{practice_title}
• e.g 01-BinaryTree
• All commits will be made on the main branch
Binary Tree
Input:   { 40, 4, 34, 45, 14, 55, 48, 13, 15, 49, 47 }
Properties
Search
Binary Search
Practice 01 – Binary Search Tree
• Implement a Binary Search Tree that supports any kind of Data
(Integer, String, Person (Birthday, CI))
• Initial Functions
• Print
• Add
• Search
• Delete
• Create unit tests for each data type and function
• Add a method that prints the Big O notation of each of the other
methods
Types of Binary Trees
• Full
• Complete
• Perfect
• Degenerate or Pathological
• Balanced
Full Binary Tree
• A Binary Tree in which every node has 0 or 2 children
Complete Binary Tree
• has all levels completely filled with nodes except the last level and in
the last level, all the nodes are as left side as possible.
Perfect Binary Tree
• Binary Tree in which all internal nodes have 2 children and all the leaf
nodes are at the same depth or same level
Balanced Binary Tree
• Binary tree in which height of the left and the right sub-trees of every
node may differ by at most 1.
Degenerate or Pathological Binary Tree
• Binary Tree where every parent node has only one child node.
Practice 01 – Binary Search Tree
• Implement a method to verify each Binary Tree type
• isFull
• isComplete
• isPerfect
• isBalanced
• isDegenerate
• Methods to confirm this affirmations
• Full Binary Tree, Number of Leaf nodes = Number of Internal nodes + 1
• Perfect Binary Tree, Total number of nodes with height H is 2^H — 1.
• Degenerate Binary Tree, Height is equal to Total number of nodes in the tree.

You might also like