Download - N-ary Trees for C Programming Language
![Page 1: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/1.jpg)
N-ary Tree Tutorial and Code Review:N-ary Tree creationN-ary Tree node insertion N-ary Tree node verificationN-ary Tree node freeing
github path for files:https://github.com/johndspence/n_trees.gitfiles:ntree_insert.c, path_exists.c, and ntree_free.cFiles should be compiled on Ubuntu 14.04 LTS, using gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Holberton School20160816John Spence
![Page 2: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/2.jpg)
Overview• This presentation demonstrates how to create an N-ary Tree/insert
a new node, validate if a node exists, and finally “free” the N-ary Tree. “N tree” and “N-ary tree” are used interchangeably in this presentation.
• The code was written in C, for ubuntu 14.04.
• Source files are here: https://github.com/johndspence/n_trees.git
• This presentation was given in the context of a code review for the Holberton School in San Francisco.
• The tasks themselves were written by Alex Gautier: https://github.com/Mattrack
![Page 3: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/3.jpg)
Task 0: N Tree Insert
![Page 4: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/4.jpg)
Task 0: N Tree Insert (example)
![Page 5: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/5.jpg)
Task 0: N Tree Insert (Expected Output)
![Page 6: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/6.jpg)
Complete n-tree
![Page 7: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/7.jpg)
4 Scenarios that ntree_insert traversal logic must address
![Page 8: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/8.jpg)
Insert a new node into the n-tree
![Page 9: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/9.jpg)
Insert a new node into the n-tree: codeTask 0: N Tree Insert (Code)
![Page 10: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/10.jpg)
Task 1: Determine if an N Tree path/node exists
![Page 11: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/11.jpg)
Task 1: Determine if an N Tree path/node exists (example)
![Page 12: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/12.jpg)
Task 1: Determine if an N Tree path/node exists (Expected Output)
![Page 13: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/13.jpg)
Determine if a path exists using: path_exists in an n-tree
![Page 14: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/14.jpg)
Determine if a path exists in a n-tree: code
![Page 15: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/15.jpg)
Task 2: Free an N Tree
![Page 16: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/16.jpg)
Free an n-tree
![Page 17: N-ary Trees for C Programming Language](https://reader033.vdocument.in/reader033/viewer/2022061414/58ae0d871a28aba3178b5745/html5/thumbnails/17.jpg)
Free an n-tree: code