This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<bits/stdc++.h> | |
using namespace std; | |
class node{ | |
public: int data; | |
node* left; | |
node* right; | |
node(int data) | |
{ | |
this->data = data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<bits/stdc++.h> | |
#define V 10 | |
#define INT_MAX 99999999 | |
using namespace std; | |
int mindistance(int dist[],bool sptset[]) | |
{ | |
int min = INT_MAX, min_index; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
public class PostorderTree { | |
public void postOrderRecursive(Node root) { | |
if (root != null) { | |
postOrderRecursive(root.left); | |
postOrderRecursive(root.right); | |
System.out.print(root.data + " "); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
class Node | |
{ | |
int data; | |
Node left; | |
Node right; | |
public Node(int data){ | |
this.data = data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Stack; | |
class Node | |
{ | |
int data; | |
Node left; | |
Node right; | |
public Node(int data){ | |
this.data = data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node{ | |
int data; | |
Node left; | |
Node right; | |
public Node(int data){ | |
this.data = data; | |
this.left = null; | |
this.right =null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert a Binary Tree into its Mirror Tree. | |
//code goes here! | |
#include <iostream> | |
#include <bits/stdc++.h> | |
using namespace std; | |
//Node Structure | |
struct Node | |
{ | |
int data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
#include <stack> | |
using namespace std; | |
// Node Structure | |
struct Node | |
{ | |
int data; | |
struct Node* left; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Node | |
{ | |
int data; | |
Node left, right; | |
public Node(int item) | |
{ | |
data = item; | |
left = right = null; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
#include <bits/stdc++.h> | |
using namespace std; | |
// Node structure | |
struct Node | |
{ | |
int data; | |
Node *left, *right; |