Invert Binary Tree Time : O(n) Space : O(1) 123456789101112131415161718192021#include <vector>using namespace std;class BinaryTree {public: int value; BinaryTree *left; BinaryTree *right; BinaryTree(int value); void insert(vector<int> values, int i = 0); void invertedInsert(vector<int> values, int i = 0);};void invertBinaryTree(BinaryTree *tree) { if(!tree) return; swap(tree->left, tree->right); invertBinaryTree(tree->left); invertBinaryTree(tree->right);}