{"id":76185,"date":"2024-07-20T20:16:57","date_gmt":"2024-07-21T00:16:57","guid":{"rendered":"https:\/\/bangla.sitestree.com\/?p=76185"},"modified":"2024-07-28T17:02:53","modified_gmt":"2024-07-28T21:02:53","slug":"a-binary-tree-declaration","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76185","title":{"rendered":"A Binary Tree Declaration"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;stdlib.h>\n\n\/\/ Declare a structure that holds data in a node\ntypedef struct {\n\tint num;\n} NodeData;\n\ntypedef struct treeNode {\n\tNodeData data;\n\tstruct treeNode* left, * right;\n} TreeNode, *TreeNodePtr;\n\ntypedef struct {\n\tTreeNodePtr root;\n} BinaryTree;\n\n\/\/ main method\nint main()\n{\n\t\/\/ NULL Pointing binary tree \n\tBinaryTree bt1;\n\tbt1.root = NULL;\n\n\t\/\/Binary tree with one Root Node\n\tTreeNodePtr p = (TreeNodePtr) malloc(sizeof(TreeNode));\n\tp->data.num = 5000;\n\tp->left = NULL;\n\tp->right = NULL;\n\tbt1.root = p;\n\n\t\/\/pointers in C\n\t\/\/https:\/\/www.geeksforgeeks.org\/null-pointer-in-c\/\n\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1966,1883,182],"tags":[],"class_list":["post-76185","post","type-post","status-publish","format-standard","hentry","category-data-structure-and-algorithms","category---data-structure","category---blog","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76187,"url":"http:\/\/bangla.sitestree.com\/?p=76187","url_meta":{"origin":76185,"position":0},"title":"C Code Build a Binary Tree.","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"#include <iostream> #include <string.h> #include <stdlib.h> #pragma warning(disable : 4996) #define MaxWordSize 100 \/\/ Declare a structure that holds data in a node typedef struct { char word[MaxWordSize + 1]; } NodeData; typedef struct treeNode { NodeData data; struct treeNode* left, * right; } TreeNode, *TreeNodePtr; typedef struct { TreeNodePtr\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76181,"url":"http:\/\/bangla.sitestree.com\/?p=76181","url_meta":{"origin":76185,"position":1},"title":"Struct and Tree Node","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"\/\/ Ref: typedef and struct \/\/ https:\/\/www.w3resource.com\/c-programming-exercises\/c-snippets\/difference-between-typedef-struct-and-struct-definitions-with-example.php#google_vignette \/\/ https:\/\/www.tutorialspoint.com\/cprogramming\/c_pointers.htm \/\/ https:\/\/www.geeksforgeeks.org\/typedef-in-c\/ #pragma warning(disable : 4996) #include <iostream> #include <string.h> \/\/ Declare a structure that holds data in a node typedef struct { int num; } NodeData; \/\/ define what a node will look like typedef struct treenode { NodeData data;\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76183,"url":"http:\/\/bangla.sitestree.com\/?p=76183","url_meta":{"origin":76185,"position":2},"title":"Struct and Tree Node Examples","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"#include <iostream> #include <string.h> #pragma warning(disable : 4996) #define MaxWordSize 100 \/\/ Declare a structure that holds data in a node typedef struct { int num; } NodeDataInt; \/\/ Declare a structure that holds data in a node typedef struct { char word[MaxWordSize + 1]; int freq; } NodeDataChar; \/\/\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76179,"url":"http:\/\/bangla.sitestree.com\/?p=76179","url_meta":{"origin":76185,"position":3},"title":"Struct\/Record Examples in C Programming Language","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"#pragma warning(disable : 4996) #include <iostream> #include <string.h> \/\/struct struct student { char name[50]; int age; float height; }; struct student s1 = { \" Nina Chase\", 12, 1.55 }; struct student s2 = { \" Shyann Morris\", 12, 1.65 }; \/\/typedef struct typedef struct { char name[50]; int age;\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76173,"url":"http:\/\/bangla.sitestree.com\/?p=76173","url_meta":{"origin":76185,"position":4},"title":"Nodes: Vertices and Edges. Nodes for them","author":"Sayed","date":"July 20, 2024","format":false,"excerpt":"define MaxWordSize 100 #define MaxWordSize 100 \/\/edge of a graph typedef struct gEdge{ \/\/ child is the location of the child vertex int child, weight; struct gEdge *nextEdge; } GEdge, *GEdgePtr; typedef struct{ char id[MaxWordSize]; int parent, cost, discover, finish, inDegree; GEdgePtr firstEdge; } GVertex; \/\/main method int main() {\u2026","rel":"","context":"In &quot;Data Structure and Algorithms&quot;","block_context":{"text":"Data Structure and Algorithms","link":"http:\/\/bangla.sitestree.com\/?cat=1966"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27190,"url":"http:\/\/bangla.sitestree.com\/?p=27190","url_meta":{"origin":76185,"position":5},"title":"JTree Examples #Programming Code Examples #Java\/J2EE\/J2ME #Advanced Swing","author":"Author-Check- Article-or-Video","date":"May 13, 2021","format":false,"excerpt":"SimpleTree.java Basic tree built out of DefaultMutableTreeNodes. A DefualtMutableTreeNode is a starting point for a root node, in which children nodes can be added. import java.awt.*; import javax.swing.*; import javax.swing.tree.*; \/** Example tree built out of DefaultMutableTreeNodes. * *\/ public class SimpleTree extends JFrame { public static void main(String[] args)\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76185"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76185\/revisions"}],"predecessor-version":[{"id":76186,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76185\/revisions\/76186"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76185"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}