{"id":76207,"date":"2024-07-28T16:51:55","date_gmt":"2024-07-28T20:51:55","guid":{"rendered":"https:\/\/bangla.sitestree.com\/?p=76207"},"modified":"2024-07-28T17:02:53","modified_gmt":"2024-07-28T21:02:53","slug":"binary-tree-traversal-using-in-order-in-c","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76207","title":{"rendered":"Binary Tree Traversal using In Order: In C"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\/\/ traverse the tree in in-order basis\n\/\/ print the treee content in in-order basis\nvoid inOrder(NodePtr node) {\n\tif (node != NULL) {\n\t\tinOrder(node->left);\n\t\tprintf(\"%s \", node->data.word);\n\t\tinOrder(node->right);\n\t}\n}<\/code><\/pre>\n\n\n\n<p><\/p>\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-76207","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":76207,"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":76205,"url":"http:\/\/bangla.sitestree.com\/?p=76205","url_meta":{"origin":76207,"position":1},"title":"Binary Tree Traversal in Post Order: In C","author":"Sayed","date":"July 28, 2024","format":false,"excerpt":"\/\/ traverse the tree in post-order basis \/\/ print the treee content in post-order basis void postOrder(NodePtr node) { if (node != NULL) { postOrder(node->left); postOrder(node->right); printf(\"%s \", node->data.word); } }","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":76207,"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":76201,"url":"http:\/\/bangla.sitestree.com\/?p=76201","url_meta":{"origin":76207,"position":3},"title":"Steps to Create a Binary Search Tree","author":"Sayed","date":"July 28, 2024","format":false,"excerpt":"If binary tree is empty, create a node, and assign data, point to itOtherwise : point to root node Compare the new - data - to - insert with the current node dataWe maintain a pointer say current to point to the node under visit If data matched : nothing\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":76203,"url":"http:\/\/bangla.sitestree.com\/?p=76203","url_meta":{"origin":76207,"position":4},"title":"Pre Order Traversal of a Binary Tree in C","author":"Sayed","date":"July 28, 2024","format":false,"excerpt":"\/\/ pre order traversalvoid preOrder(NodePtr node) {if (node != NULL) { printf(\"%s \", node->data.word); preOrder(node->left); preOrder(node->right);}}","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":76207,"position":5},"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":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76207","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=76207"}],"version-history":[{"count":3,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76207\/revisions"}],"predecessor-version":[{"id":76214,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76207\/revisions\/76214"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76207"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}