SlideShare a Scribd company logo
Program pohon Biner (Tree)
Bosca simbolon
1282024
Sistem informasi
#include <stdio.h>
#include <malloc.h>
#define nil NULL
//stuct nod
struct nod
{
struct nod *left;
char data;
struct nod *right;
};
typedef struct nod NOD;
typedef NOD POKOK;
NOD *NodBaru(char item)
{
NOD *n;
n = (NOD*) malloc(sizeof(NOD));
if(n != NULL)
{
n->data = item;
n->left = NULL;
n->right = NULL;
}
return n;
}
void BinaPokok(POKOK **T)
{
*T = NULL;
}
typedef enum { FALSE = 0, TRUE = 1} BOOL;
BOOL PokokKosong(POKOK *T)
{
return((BOOL)(T == NULL));
}
void TambahNod(NOD **p, char item)
{
NOD *n;
n = NodBaru(item);
*p = n;
}
void preorder(POKOK *T)
{
if(!PokokKosong(T))
{
printf("%c ", T->data);
preorder(T->left);
preorder(T->right);
}
}
void inorder(POKOK *T)
{
if(!PokokKosong(T))
{
inorder(T->left);
printf("%c ", T->data);
inorder(T->right);
}
}
void postorder(POKOK *T)
{
if(!PokokKosong(T))
{
postorder(T->left);
postorder(T->right);
printf("%c ", T->data);
}
}
int main()
{
POKOK *pohon;
char buah;
BinaPokok(&pohon);
TambahNod(&pohon, buah = 'B');
TambahNod(&pohon->left, buah = 'O');
TambahNod(&pohon->left->right, buah = 'S');
TambahNod(&pohon->right, buah = 'K');
TambahNod(&pohon->right->right, buah = 'A');
TambahNod(&pohon->right->right->left, buah = 'S');
TambahNod(&pohon->right->right->right, buah = 'I');
TambahNod(&pohon->right->right->right->left, buah = 'M');
TambahNod(&pohon->right->right->right->left->right, buah = 'B');
TambahNod(&pohon->right->right->right->left->right->right, buah = 'O');
TambahNod(&pohon->right->right->right->left->right->right->right, buah = 'L');
TambahNod(&pohon->right->right->right->left->right->right->right->right, buah = 'O');
TambahNod(&pohon->right->right->right->left->right->right->right->right->right, buah = 'N');
printf("Tampilan secara Preorder: ");
preorder(pohon);
printf("nTampilan secara Inorder: ");
inorder(pohon);
printf("nTampilan secara Postorder: ");
postorder(pohon);
printf("nn");
return 0;
}
Screenshoot Running
Preorder : B O S K A S I M B O L O N
O
S
O
B
I
A
K
L
B
M
S
N

More Related Content

What's hot

Brief intro to clojure
Brief intro to clojureBrief intro to clojure
Brief intro to clojure
Roy Rutto
 
Garbage collector in python
Garbage collector in pythonGarbage collector in python
Garbage collector in python
Ibrahim Kasim
 
Container adapters
Container adaptersContainer adapters
Container adapters
mohamed sikander
 
C++ practical
C++ practicalC++ practical
C++ practical
Rahul juneja
 
Fixing Web Data in Production
Fixing Web Data in ProductionFixing Web Data in Production
Fixing Web Data in Production
Aaron Knight
 
Class list data structure
Class list data structureClass list data structure
Class list data structure
Katang Isip
 
Herding types with Scala macros
Herding types with Scala macrosHerding types with Scala macros
Herding types with Scala macros
Marina Sigaeva
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
mohamed sikander
 
Typelevel summit
Typelevel summitTypelevel summit
Typelevel summit
Marina Sigaeva
 
OOXX
OOXXOOXX
Android mix Java and C++
Android mix Java and C++Android mix Java and C++
Android mix Java and C++
Maksym Davydov
 
Computer graphics File for Engineers
Computer graphics File for EngineersComputer graphics File for Engineers
Computer graphics File for Engineers
varun arora
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
Simon Su
 
20160616技術會議
20160616技術會議20160616技術會議
20160616技術會議
Jason Kuan
 
Why learn new programming languages
Why learn new programming languagesWhy learn new programming languages
Why learn new programming languages
Jonas Follesø
 
Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”
Platonov Sergey
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changeshayato
 

What's hot (20)

MongoDB
MongoDBMongoDB
MongoDB
 
Brief intro to clojure
Brief intro to clojureBrief intro to clojure
Brief intro to clojure
 
Garbage collector in python
Garbage collector in pythonGarbage collector in python
Garbage collector in python
 
Container adapters
Container adaptersContainer adapters
Container adapters
 
C++ practical
C++ practicalC++ practical
C++ practical
 
Fixing Web Data in Production
Fixing Web Data in ProductionFixing Web Data in Production
Fixing Web Data in Production
 
Class list data structure
Class list data structureClass list data structure
Class list data structure
 
Herding types with Scala macros
Herding types with Scala macrosHerding types with Scala macros
Herding types with Scala macros
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
C++ programs
C++ programsC++ programs
C++ programs
 
Typelevel summit
Typelevel summitTypelevel summit
Typelevel summit
 
OOXX
OOXXOOXX
OOXX
 
Ds 2 cycle
Ds 2 cycleDs 2 cycle
Ds 2 cycle
 
Android mix Java and C++
Android mix Java and C++Android mix Java and C++
Android mix Java and C++
 
Computer graphics File for Engineers
Computer graphics File for EngineersComputer graphics File for Engineers
Computer graphics File for Engineers
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
20160616技術會議
20160616技術會議20160616技術會議
20160616技術會議
 
Why learn new programming languages
Why learn new programming languagesWhy learn new programming languages
Why learn new programming languages
 
Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”Bartosz Milewski, “Re-discovering Monads in C++”
Bartosz Milewski, “Re-discovering Monads in C++”
 
ECMAScript 6 major changes
ECMAScript 6 major changesECMAScript 6 major changes
ECMAScript 6 major changes
 

Viewers also liked

Rangkuman i
Rangkuman iRangkuman i
Rangkuman i
Dita Widya
 
Eliminasi gauss-jordan
Eliminasi gauss-jordanEliminasi gauss-jordan
Eliminasi gauss-jordan
Renol Doang
 
Eliminasi Gauss
Eliminasi GaussEliminasi Gauss
Eliminasi Gauss
rizki budiman
 
Modul maple untuk metnum 2014
Modul maple untuk metnum 2014Modul maple untuk metnum 2014
Modul maple untuk metnum 2014
Samuel Pinto'o
 
Metode transportasi
Metode transportasiMetode transportasi
Metode transportasisuparman11
 
PENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIAN
PENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIANPENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIAN
PENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIAN
Feronica Romauli
 

Viewers also liked (6)

Rangkuman i
Rangkuman iRangkuman i
Rangkuman i
 
Eliminasi gauss-jordan
Eliminasi gauss-jordanEliminasi gauss-jordan
Eliminasi gauss-jordan
 
Eliminasi Gauss
Eliminasi GaussEliminasi Gauss
Eliminasi Gauss
 
Modul maple untuk metnum 2014
Modul maple untuk metnum 2014Modul maple untuk metnum 2014
Modul maple untuk metnum 2014
 
Metode transportasi
Metode transportasiMetode transportasi
Metode transportasi
 
PENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIAN
PENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIANPENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIAN
PENYELESAIAN MASALAH PENUGASAN DENGAN METODE HUNGARIAN
 

Similar to Tugas struktur data terakhir_pohonBiner

Doublylinklist
DoublylinklistDoublylinklist
Doublylinklistritu1806
 
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdfincludestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
galagirishp
 
1. Add a breadth-first (level-order) traversal function to the binar.pdf
1. Add a breadth-first (level-order) traversal function to the binar.pdf1. Add a breadth-first (level-order) traversal function to the binar.pdf
1. Add a breadth-first (level-order) traversal function to the binar.pdf
arjuncp10
 
10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx
10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx
10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx
todd991
 
ItemNodeh include ltiostreamgt include ltstring.pdf
ItemNodeh    include ltiostreamgt include ltstring.pdfItemNodeh    include ltiostreamgt include ltstring.pdf
ItemNodeh include ltiostreamgt include ltstring.pdf
acmefit
 
i nsert+in+ link list
i nsert+in+ link listi nsert+in+ link list
i nsert+in+ link list
EAJAJAhamed
 
I have a Programming is Binary Tree Search (BTS) for strings with po.pdf
I have a Programming is Binary Tree Search (BTS) for strings with po.pdfI have a Programming is Binary Tree Search (BTS) for strings with po.pdf
I have a Programming is Binary Tree Search (BTS) for strings with po.pdf
ARCHANASTOREKOTA
 
Linked lists
Linked listsLinked lists
To create a node for a binary search tree (BTNode, ) and to create a .pdf
To create a node for a binary search tree (BTNode, ) and to create a .pdfTo create a node for a binary search tree (BTNode, ) and to create a .pdf
To create a node for a binary search tree (BTNode, ) and to create a .pdf
bhim1213
 
Linked list imp of list
Linked list imp of listLinked list imp of list
Linked list imp of list
Elavarasi K
 
Lab-2.2 717822E504.pdf
Lab-2.2 717822E504.pdfLab-2.2 717822E504.pdf
Lab-2.2 717822E504.pdf
21E135MAHIESHWARJ
 
Linked lists
Linked listsLinked lists
Linked lists
George Scott IV
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
fantoosh1
 
Binary Tree in C++ coding in the data structure
Binary Tree in C++ coding in the data structureBinary Tree in C++ coding in the data structure
Binary Tree in C++ coding in the data structure
ZarghamullahShah
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdf
illyasraja7
 
DS Code (CWH).docx
DS Code (CWH).docxDS Code (CWH).docx
DS Code (CWH).docx
KamalSaini561034
 
Implement a function TNode copy_tree(TNode t) that creates a copy .pdf
Implement a function TNode copy_tree(TNode t) that creates a copy .pdfImplement a function TNode copy_tree(TNode t) that creates a copy .pdf
Implement a function TNode copy_tree(TNode t) that creates a copy .pdf
feetshoemart
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
shaktisinhgandhinaga
 

Similar to Tugas struktur data terakhir_pohonBiner (20)

Doublylinklist
DoublylinklistDoublylinklist
Doublylinklist
 
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdfincludestdio.h #includestdlib.h int enqueue(struct node ,.pdf
includestdio.h #includestdlib.h int enqueue(struct node ,.pdf
 
1. Add a breadth-first (level-order) traversal function to the binar.pdf
1. Add a breadth-first (level-order) traversal function to the binar.pdf1. Add a breadth-first (level-order) traversal function to the binar.pdf
1. Add a breadth-first (level-order) traversal function to the binar.pdf
 
10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx
10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx
10 Solution#include-iostream-h- #include-conio-h- #include-process-h-.docx
 
ItemNodeh include ltiostreamgt include ltstring.pdf
ItemNodeh    include ltiostreamgt include ltstring.pdfItemNodeh    include ltiostreamgt include ltstring.pdf
ItemNodeh include ltiostreamgt include ltstring.pdf
 
i nsert+in+ link list
i nsert+in+ link listi nsert+in+ link list
i nsert+in+ link list
 
I have a Programming is Binary Tree Search (BTS) for strings with po.pdf
I have a Programming is Binary Tree Search (BTS) for strings with po.pdfI have a Programming is Binary Tree Search (BTS) for strings with po.pdf
I have a Programming is Binary Tree Search (BTS) for strings with po.pdf
 
Linked lists
Linked listsLinked lists
Linked lists
 
To create a node for a binary search tree (BTNode, ) and to create a .pdf
To create a node for a binary search tree (BTNode, ) and to create a .pdfTo create a node for a binary search tree (BTNode, ) and to create a .pdf
To create a node for a binary search tree (BTNode, ) and to create a .pdf
 
Linked list imp of list
Linked list imp of listLinked list imp of list
Linked list imp of list
 
Lab-2.2 717822E504.pdf
Lab-2.2 717822E504.pdfLab-2.2 717822E504.pdf
Lab-2.2 717822E504.pdf
 
Linked lists
Linked listsLinked lists
Linked lists
 
In C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdfIn C++ I need help with this method that Im trying to write fillLi.pdf
In C++ I need help with this method that Im trying to write fillLi.pdf
 
Binary Tree in C++ coding in the data structure
Binary Tree in C++ coding in the data structureBinary Tree in C++ coding in the data structure
Binary Tree in C++ coding in the data structure
 
Lab-2.4 101.pdf
Lab-2.4 101.pdfLab-2.4 101.pdf
Lab-2.4 101.pdf
 
Given the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdfGiven the following codepackage data1;import java.util.;p.pdf
Given the following codepackage data1;import java.util.;p.pdf
 
DS Code (CWH).docx
DS Code (CWH).docxDS Code (CWH).docx
DS Code (CWH).docx
 
137 Lab-2.2.pdf
137 Lab-2.2.pdf137 Lab-2.2.pdf
137 Lab-2.2.pdf
 
Implement a function TNode copy_tree(TNode t) that creates a copy .pdf
Implement a function TNode copy_tree(TNode t) that creates a copy .pdfImplement a function TNode copy_tree(TNode t) that creates a copy .pdf
Implement a function TNode copy_tree(TNode t) that creates a copy .pdf
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
 

Recently uploaded

Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 

Recently uploaded (20)

Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 

Tugas struktur data terakhir_pohonBiner

  • 1. Program pohon Biner (Tree) Bosca simbolon 1282024 Sistem informasi #include <stdio.h> #include <malloc.h> #define nil NULL //stuct nod struct nod { struct nod *left; char data; struct nod *right; }; typedef struct nod NOD; typedef NOD POKOK; NOD *NodBaru(char item) { NOD *n; n = (NOD*) malloc(sizeof(NOD)); if(n != NULL) { n->data = item; n->left = NULL; n->right = NULL; }
  • 2. return n; } void BinaPokok(POKOK **T) { *T = NULL; } typedef enum { FALSE = 0, TRUE = 1} BOOL; BOOL PokokKosong(POKOK *T) { return((BOOL)(T == NULL)); } void TambahNod(NOD **p, char item) { NOD *n; n = NodBaru(item); *p = n; } void preorder(POKOK *T) { if(!PokokKosong(T)) { printf("%c ", T->data); preorder(T->left); preorder(T->right); } } void inorder(POKOK *T) { if(!PokokKosong(T)) {
  • 3. inorder(T->left); printf("%c ", T->data); inorder(T->right); } } void postorder(POKOK *T) { if(!PokokKosong(T)) { postorder(T->left); postorder(T->right); printf("%c ", T->data); } } int main() { POKOK *pohon; char buah; BinaPokok(&pohon); TambahNod(&pohon, buah = 'B'); TambahNod(&pohon->left, buah = 'O'); TambahNod(&pohon->left->right, buah = 'S'); TambahNod(&pohon->right, buah = 'K'); TambahNod(&pohon->right->right, buah = 'A'); TambahNod(&pohon->right->right->left, buah = 'S'); TambahNod(&pohon->right->right->right, buah = 'I'); TambahNod(&pohon->right->right->right->left, buah = 'M'); TambahNod(&pohon->right->right->right->left->right, buah = 'B'); TambahNod(&pohon->right->right->right->left->right->right, buah = 'O'); TambahNod(&pohon->right->right->right->left->right->right->right, buah = 'L');
  • 4. TambahNod(&pohon->right->right->right->left->right->right->right->right, buah = 'O'); TambahNod(&pohon->right->right->right->left->right->right->right->right->right, buah = 'N'); printf("Tampilan secara Preorder: "); preorder(pohon); printf("nTampilan secara Inorder: "); inorder(pohon); printf("nTampilan secara Postorder: "); postorder(pohon); printf("nn"); return 0; } Screenshoot Running
  • 5. Preorder : B O S K A S I M B O L O N O S O B I A K L B M S N