Facebook
From Big Lemur, 7 Years ago, written in C++.
This paste is a reply to Untitled from Scorching Finch - go back
Embed
Viewing differences between Untitled and Re: Untitled
#include 
#include "stdafx.h"

templatestruct Node;

template
struct Node {
        T key;
        std::shared_ptr left;
        std::shared_ptr right;
        Node(T);
};

template
Node::Node(T item){
        key = item;
        left = nullptr; 
        right = nullptr; 
}

template
struct BST {
        
        std::shared_ptr>root;
        BST();
        
        bool insert(T x); //tutaj wrzucam jakiegoś przykładowo int'a
                                                                        //i teraz nie wiem czy to nie powinno być bool insert(Node) żeby się zgadzało z zadaniem 
                                                
zadaniem 
                        
// i wówczas moim T będzi Node
        bool find(T x);
        bool erase(T x);
        Node& min(void);
        Node& max(void); //tutaj zwracam referencje na Node
};