- My interests are DevOps, MLOps, Distributed Systems, and Machine Learning;
If you'd like to know more about me, please visit my website: https://samuellucas97.github.io
Implementação da estrutura de dados Árvore de Busca Binária 🌳🌳.
License: MIT License
If you'd like to know more about me, please visit my website: https://samuellucas97.github.io
Não sei ao certo do motivo do método insert da classe BinarySearchTree está retornando
$ exit status -1
A seguir encontra-se o trecho de código com o método insert:
void insert(T value){
Node<T>* copyRoot = raiz;
Node<T>* nodeSearch = nullptr;
/// BUSCANDO SE O NÓ JÁ EXISTE
while( copyRoot != nullptr)
{
nodeSearch = copyRoot;
if( value < copyRoot->getChave() ){
copyRoot = copyRoot->getEsquerda();
}
else if( value == copyRoot->getChave() ){
break;
}
else{
copyRoot = copyRoot->getDireita();
}
}
/// CRIANDO NOVO NÓ
Node<T>* newNode = new Node<T>(value, copyRoot, nullptr, nullptr);
/// ADICIONANDO O NÓ
if( value < copyRoot->getChave() ){
Node<T>* no = copyRoot->getEsquerda();
no = new Node<T>();
no = newNode;
///copyRoot->setEsquerda(newNode);
}
else{
Node<T>* no = copyRoot->getDireita();
no= new Node<T>();
no = newNode;
///copyRoot->setDireita(newNode);
}
}
Depois de alguns testes descobri que o problema encontra-se no seguinte comando:
copyRoot->getChave()
O que não faz sentido pois na função main já foi testado esse método da classe Node.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.