SlideShare a Scribd company logo
N-ary Tree Tutorial and Code Review:
N-ary Tree creation
N-ary Tree node insertion
N-ary Tree node verification
N-ary Tree node freeing
github path for files:
https://github.com/johndspence/n_trees.git
files:
ntree_insert.c, path_exists.c, and ntree_free.c
Files should be compiled on Ubuntu 14.04 LTS, using gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Holberton School
20160816
John Spence
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
Task 0: N Tree Insert
Task 0: N Tree Insert (example)
Task 0: N Tree Insert (Expected Output)
Complete n-tree
4 Scenarios that ntree_insert traversal logic must address
Insert a new node into the n-tree
Insert a new node into the n-tree: codeTask 0: N Tree Insert (Code)
Task 1: Determine if an N Tree path/node exists
Task 1: Determine if an N Tree path/node exists (example)
Task 1: Determine if an N Tree path/node exists (Expected Output)
Determine if a path exists using: path_exists in an n-tree
Determine if a path exists in a n-tree: code
Task 2: Free an N Tree
Free an n-tree
Free an n-tree: code

More Related Content

What's hot (8)

ODP
Embedded recipes 2018 - End-to-end software production for embedded - Guy Lun...
Anne Nicolas
 
PPTX
How to deliver a Python project
mattjdavidson
 
PDF
Introduction to IPython & Notebook
Areski Belaid
 
PDF
10 reasons to be excited about go
Dvir Volk
 
PPTX
From Problem to Solution: Enumerating Windows Firewall-Hook Drivers
Ollie Whitehouse
 
PDF
Philosophy of Open Source - SFO17-TR01
Linaro
 
PPTX
First Responder Course - Session 9 - Volatile Evidence Collection [2004]
Phil Huggins FBCS CITP
 
PDF
Retro Gaming with Raspberry PI
Abhijeet Kasurde
 
Embedded recipes 2018 - End-to-end software production for embedded - Guy Lun...
Anne Nicolas
 
How to deliver a Python project
mattjdavidson
 
Introduction to IPython & Notebook
Areski Belaid
 
10 reasons to be excited about go
Dvir Volk
 
From Problem to Solution: Enumerating Windows Firewall-Hook Drivers
Ollie Whitehouse
 
Philosophy of Open Source - SFO17-TR01
Linaro
 
First Responder Course - Session 9 - Volatile Evidence Collection [2004]
Phil Huggins FBCS CITP
 
Retro Gaming with Raspberry PI
Abhijeet Kasurde
 

Viewers also liked (13)

PDF
ciril annual report
Manish Sharma
 
PPT
kjnliugfdrtgyuhijuyrdexfcghbjkl.
Adella1
 
PDF
Berthebear
guestde1c261
 
PDF
Simamane_Zanda_manR4_8982022usCOLE-5ca
Zanda Simamane
 
PDF
Background Documents
Maximum Balance Foundation LLC
 
PPT
Da imagem sagrada às sexshops virtuais: análise folkcomunicacional da transgr...
Marcelo Sabbatini
 
PDF
Who is still investing in brazil
Capolavori Consulting
 
PPT
20100418_Herman_Ridderinkhof_Getijden
VPRO Beagle
 
PDF
Presentation posters of own design
Juraj Tomcik
 
PDF
Desenvolvimento de jogos na educação
Diogo Padilha
 
PPT
La Práctica de Evaluación como Contexto para Aprender a ser un Aprendiz Compe...
Ariana Linger Gasiglia
 
PPT
1fasemodernismoequar 140802112350-phpapp01
E.E. Mario Martins Pereira
 
PDF
Interculturalidade, educação e jogos digitais potencialidades do princípio da...
Marcelo Sabbatini
 
ciril annual report
Manish Sharma
 
kjnliugfdrtgyuhijuyrdexfcghbjkl.
Adella1
 
Berthebear
guestde1c261
 
Simamane_Zanda_manR4_8982022usCOLE-5ca
Zanda Simamane
 
Background Documents
Maximum Balance Foundation LLC
 
Da imagem sagrada às sexshops virtuais: análise folkcomunicacional da transgr...
Marcelo Sabbatini
 
Who is still investing in brazil
Capolavori Consulting
 
20100418_Herman_Ridderinkhof_Getijden
VPRO Beagle
 
Presentation posters of own design
Juraj Tomcik
 
Desenvolvimento de jogos na educação
Diogo Padilha
 
La Práctica de Evaluación como Contexto para Aprender a ser un Aprendiz Compe...
Ariana Linger Gasiglia
 
1fasemodernismoequar 140802112350-phpapp01
E.E. Mario Martins Pereira
 
Interculturalidade, educação e jogos digitais potencialidades do princípio da...
Marcelo Sabbatini
 
Ad

Similar to N-ary Trees for C Programming Language (20)

PDF
Contributing to Ansible
Abhijeet Kasurde
 
PDF
Elliott Hauser: Py Gotham 08-16-2014 - Teaching Stacks
OrateTeam
 
PDF
Make an Instant Website with Webhooks
Anne Gentle
 
PDF
Open Source Hardware and Libre Silicon
Drew Fustini
 
PDF
Hello, Python
hardwyrd
 
PDF
BarCamb Connotea by Ian Mulvany
Ian Mulvany
 
PDF
Openchain First Monday Agenda 03-04-2019
Shane Coughlan
 
PDF
Free Sorftware Research at Irill (highlights)
Roberto Di Cosmo
 
PDF
Embedded Linux primer
Drew Fustini
 
PDF
venv and pip.pdf
JonathanArp3
 
PDF
The new Odoo community organization and platform
Odoo
 
ODP
Using containers and Continuous Packaging to Build native FOSSology packages
Bruno Cornec
 
PDF
February OpenNTF Webinar: Introduction to Ansible for Newbies
Howard Greenberg
 
PDF
Python arch wiki
fikrul islamy
 
PPTX
LingPy : A Python Library for Historical Linguistics
Dr. Amit Kumar Jha
 
PPTX
Introduce fuego
s60030
 
PDF
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
CODEiD PHP Community
 
PPTX
Fullstack workshop
Assaf Gannon
 
PDF
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Anne Nicolas
 
PDF
2015 11-04 HEADS at EclipseCon: Modelling Things for IoT
UdoHafermann
 
Contributing to Ansible
Abhijeet Kasurde
 
Elliott Hauser: Py Gotham 08-16-2014 - Teaching Stacks
OrateTeam
 
Make an Instant Website with Webhooks
Anne Gentle
 
Open Source Hardware and Libre Silicon
Drew Fustini
 
Hello, Python
hardwyrd
 
BarCamb Connotea by Ian Mulvany
Ian Mulvany
 
Openchain First Monday Agenda 03-04-2019
Shane Coughlan
 
Free Sorftware Research at Irill (highlights)
Roberto Di Cosmo
 
Embedded Linux primer
Drew Fustini
 
venv and pip.pdf
JonathanArp3
 
The new Odoo community organization and platform
Odoo
 
Using containers and Continuous Packaging to Build native FOSSology packages
Bruno Cornec
 
February OpenNTF Webinar: Introduction to Ansible for Newbies
Howard Greenberg
 
Python arch wiki
fikrul islamy
 
LingPy : A Python Library for Historical Linguistics
Dr. Amit Kumar Jha
 
Introduce fuego
s60030
 
Symfony4: A new way to develop applications | Antonio Peric | CODEiD
CODEiD PHP Community
 
Fullstack workshop
Assaf Gannon
 
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Anne Nicolas
 
2015 11-04 HEADS at EclipseCon: Modelling Things for IoT
UdoHafermann
 
Ad

Recently uploaded (20)

PDF
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
PDF
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENT
samueljackson3773
 
PPT
FINAL plumbing code for board exam passer
MattKristopherDiaz
 
PDF
Bayesian Learning - Naive Bayes Algorithm
Sharmila Chidaravalli
 
PPTX
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
PDF
Plant Control_EST_85520-01_en_AllChanges_20220127.pdf
DarshanaChathuranga4
 
PDF
Clustering Algorithms - Kmeans,Min ALgorithm
Sharmila Chidaravalli
 
PPTX
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
PPTX
ASBC application presentation template (ENG)_v3 (1).pptx
HassanMohammed730118
 
PDF
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
 
PPTX
Computer network Computer network Computer network Computer network
Shrikant317689
 
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
PDF
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
 
PPTX
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
PDF
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
 
PPT
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
PPTX
Work at Height training for workers .pptx
cecos12
 
PDF
Tesia Dobrydnia - An Avid Hiker And Backpacker
Tesia Dobrydnia
 
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
 
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENT
samueljackson3773
 
FINAL plumbing code for board exam passer
MattKristopherDiaz
 
Bayesian Learning - Naive Bayes Algorithm
Sharmila Chidaravalli
 
CST413 KTU S7 CSE Machine Learning Introduction Parameter Estimation MLE MAP ...
resming1
 
Plant Control_EST_85520-01_en_AllChanges_20220127.pdf
DarshanaChathuranga4
 
Clustering Algorithms - Kmeans,Min ALgorithm
Sharmila Chidaravalli
 
Explore USA’s Best Structural And Non Structural Steel Detailing
Silicon Engineering Consultants LLC
 
ASBC application presentation template (ENG)_v3 (1).pptx
HassanMohammed730118
 
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
 
Computer network Computer network Computer network Computer network
Shrikant317689
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
 
Kel.3_A_Review_on_Internet_of_Things_for_Defense_v3.pptx
Endang Saefullah
 
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
 
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Work at Height training for workers .pptx
cecos12
 
Tesia Dobrydnia - An Avid Hiker And Backpacker
Tesia Dobrydnia
 

N-ary Trees for C Programming Language

  • 1. N-ary Tree Tutorial and Code Review: N-ary Tree creation N-ary Tree node insertion N-ary Tree node verification N-ary Tree node freeing github path for files: https://github.com/johndspence/n_trees.git files: ntree_insert.c, path_exists.c, and ntree_free.c Files should be compiled on Ubuntu 14.04 LTS, using gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4 Holberton School 20160816 John Spence
  • 2. 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
  • 3. Task 0: N Tree Insert
  • 4. Task 0: N Tree Insert (example)
  • 5. Task 0: N Tree Insert (Expected Output)
  • 7. 4 Scenarios that ntree_insert traversal logic must address
  • 8. Insert a new node into the n-tree
  • 9. Insert a new node into the n-tree: codeTask 0: N Tree Insert (Code)
  • 10. Task 1: Determine if an N Tree path/node exists
  • 11. Task 1: Determine if an N Tree path/node exists (example)
  • 12. Task 1: Determine if an N Tree path/node exists (Expected Output)
  • 13. Determine if a path exists using: path_exists in an n-tree
  • 14. Determine if a path exists in a n-tree: code
  • 15. Task 2: Free an N Tree