Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <exception>
- #include <cmath>
- #include <unordered_set>
- #include <vector>
- #include <unordered_map>
- #include <algorithm>
- using namespace std;
- struct node{
- int* parent;
- int* l;
- int* r;
- node* self;
- node() : parent(nullptr), l(nullptr), r(nullptr), self(this) {}
- node(int *p, int *L, int *R) : parent(p), l(L), r(R), self(this) {}
- };
- struct tree{
- vector <int> a = {1, 2, 3, 4, 5};
- node main_root;
- node create_subtree(int Li, int Ri) {
- /*Ri == Li + 2 - ok
- Ri == Li + 1
- Ri == Li*/
- node root();
- if (Li == Ri) {
- }
- root.self = &arr[len / 2];
- node left_root = create_subtree(0, len / 2 - 1);
- node right_root = create_subtree(len / 2 + 1, len - 1);
- root.l = left_root.self;
- root.r = right_root.self;
- return root;
- }
- void create(vector <int> arr) {
- a = arr;
- int len = a.size();
- create_subtree(0, len);
- return;
- }
- void output() {
- return;
- }
- void find_first(int* v) {
- return;
- }
- void find_nex(int* v) {
- return;
- }
- void insert_after(int* v) { //а insert_defore надо?
- return;
- }
- };
- int main() {
- tree T;
- vector <int> a = {1, 2, 3, 4, 5};
- T()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement