Michel Robart in Went to learn JavaScript in 2023
Lorem ipsum dolor sit amet consectetur adipisicing elit
Michel Robart in Went to learn JavaScript in 2023
Lorem ipsum dolor sit amet consectetur adipisicing elit
Michel Robart in Went to learn JavaScript in 2023
Lorem ipsum dolor sit amet consectetur adipisicing elit
Lorem ipsum dolor sit amet consectetur adipisicing https://i.ibb.co/2ZNqzVY/twitter.png
Lorem ipsum dolor sit amet consectetur adipisicing https://i.ibb.co/2ZNqzVY/twitter.png
Lorem ipsum dolor sit amet consectetur adipisicing https://i.ibb.co/2ZNqzVY/twitter.png
Jihad-Blogs is a responsive, beautiful, creative & unique Next.js full-stack project best suited for blogs & personal portfolio showcases. It’s easy to use & setup, SEO friendly and has top notch standard compliant code.
Stay up to do date with my posts, subscribe to newsletter:
বাস্তব জীবনে কীভাবে কাজে লাগাবো এবং কোডিং এর মাধ্যমে কীভাবে বাস্তবায়ন করব সেইটাই এইবার আমারা দেখব।
-------->
এইবার বোঝা যাক যে, ট্রি ডেটা স্ট্রাকচার কীভাবে বাস্তব জীবনে কাজে লাগাতে পারি। ট্রি ডেটা স্ট্রাকচার ফোলডার এর স্ট্রাকচার তৈরী করতে আমরা কাজে লাগাতে পারি আবার নেটওর্য়াক টপোলজিতে ও আমরা এই
ডেটা স্ট্রাকচার ব্যাবহার করতে পারি।
-------->
আমারা এখন দেখবো যে ট্রী ডেটা স্ট্রাকচার কীভাবে সি++ এ বাস্তবায়ন করানো যায়#include <bits/stdc++.h>
using namespace std;
// একটা ক্লাস যেটা আমাদের একটা নোড এই নোডে আমরা ডেটা গুলো রেখেছি ।
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
//এইটা আমাদের পূর্ববর্তী নোড
void preValueOfTree(Node * root){
if(root==NULL) return ;
cout << root->val << " ";
preValueOfTree(root->left) ;
preValueOfTree(root->right) ;
}
//এইটা আমাদের পরবর্তী নোড
void postValueOfTree(Node * root){
if(root==NULL) return ;
postValueOfTree(root->left) ;
postValueOfTree(root->right) ;
cout << root->val << " ";
}
//এইটা আমাদের মধ্যবর্তী নোড
void inOrderValueOfTree(Node * root){
if(root==NULL) return ;
inOrderValueOfTree(root->left) ;
cout << root->val << " ";
inOrderValueOfTree(root->right) ;
}
int main()
{
// এই অংশে আমরা আমাদের নোডের মান গুলোকে দিয়েছি ।
Node *a = new Node(10);
Node *b = new Node(20);
Node *c = new Node(30);
Node *d = new Node(40);
Node *e = new Node(50);
Node *f = new Node(60);
Node *g = new Node(70);
//নোডের সংযোগ করানো হয়েছে
a->left = b;
a->right = c;
b->left = d;
c->right = e;
e->left = f;
e->right = g;
//ফাংশনে আমরা নোডের মান গুলোকে দিয়েছি
preValueOfTree(a) ;
cout <<endl;
postValueOfTree(a) ;
cout <<endl;
inOrderValueOfTree(a) ;
return 0;
} ।