Giter Site home page Giter Site logo

datastructures's People

Contributors

rgmantovani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

datastructures's Issues

Erro - Caso teste em Árvore Binária

Boa tarde,

Encontrei um erro no arquivo de saída 2 da atividade, pois a mesma pontua que a palavra “Brasil ou brasil” aparece na página 5 porem a mesma não se encontra no arquivo de entrada 2. Seguem abaixo as imagens que correspondem ao erro.

Atenciosamente Guilherme Moreira.

image
image

Fix remove for DoubleLinkedList

int removeElement(List *list, int x) {
    int ret = -99;

    if(isEmpty(list) || x < list->start->x) {
      // Lista vazia ou elemento menor que o primeiro (não contido na lista)
        printf("Erro ao remover -> Lista vazia\n");
        return ret;
    }

    if(x == list->start->x) { // Tira o primeiro elemento
        ListNodePtr aux = list->start;
        ret = aux->x;
        list->start = list->start->next;
        list->start->previous = NULL;
        free(aux);
        list->count--;
        return ret;
    }

    ListNodePtr aux = list->start;
    while(aux->next != NULL && x > aux->next->x)
        aux = aux->next;

    if(aux->next == NULL || x > aux->next->x) {
      // Proximo é nulo ou elemento maior que o ultimo (não contido na lista)
        printf("Erro ao remover -> Elemento nao encontrado na lista\n");
        return ret;
    } else {
        ListNodePtr toRemove = aux->next;
        ret = toRemove->x;

        if(aux->next->next != NULL) // Ultimo nó -> Checar se está certo
            aux->next->next->previous = aux;

        aux->next = aux->next->next;
        free(toRemove);
        list->count--;
        return ret;
    }
}

Lists lecture - first insertion

In slides, when presenting about the first insertion, discuss also the case where the new element is lower than the first one.

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.