Coder Social home page Coder Social logo

arvoredebuscabinaria's Introduction

Hi there, I'm Samuel Ferino 👋

  • 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

arvoredebuscabinaria's People

Contributors

samuellucas97 avatar

Watchers

 avatar

arvoredebuscabinaria's Issues

Método insert

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.