rgmantovani / datastructures Goto Github PK
View Code? Open in Web Editor NEWData structures' lectures for Computer Engineering course, UTFPR - Apucarana
Data structures' lectures for Computer Engineering course, UTFPR - Apucarana
class 3 Stacks - slide 12
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;
}
}
Slide aula 5, pag 37 e afim.
In slides, when presenting about the first insertion, discuss also the case where the new element is lower than the first one.
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.