Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T>
- void localAdd (const std::shared_ptr<CNode<T>> & ptr, const T &Val){
- if (ptr->GetData () > Val){
- if (ptr->getLC() == nullptr){
- ptr->setLC(std::shared_ptr<CNode <T> > (new CNode<T> (Val)));
- return;
- }
- else localAdd (ptr->getLC(), Val);
- }else{
- if(ptr->getRC() == nullptr){
- ptr->setRC(std::shared_ptr<CNode <T> > (new CNode<T> (Val)));
- return;
- }
- else localAdd (ptr->getRC(), Val);
- }
- }
Add Comment
Please, Sign In to add comment