Questions tagged as 'lista-encadeada'

1
answer

Problem with algorithm for removing duplicate numbers in double-chained list

Could someone help me with the following code? void removeRepetidos(Lista *l) { Elemento *aux = (*l); Elemento *aux2; Elemento *aux3; while(aux!=NULL) { aux2 = aux->prox; while(aux2 != NULL) {...
asked by 29.10.2018 / 00:37
1
answer

Why is my code in C using queue giving segmentation fault?

Hello, I have to implement a queue that receives the name and cpf information, but only when I try to dequeue something does it give a fault, without the line of the normal dialer, but I can not see the error in it. #include <stdio.h> #in...
asked by 20.10.2018 / 17:04
1
answer

Double linked list and circular, memory errors with valgrind

I have the following structures: typedef struct Node { char info[40]; struct Node *ant; struct Node *prox; }NoCDup; typedef struct LDEC { NoCDup *cabeca; NoCDup *cauda; int tamanho; }ListaCDup; And also the function...
asked by 03.10.2018 / 20:09
1
answer

Create Threaded Dynamic List

I'm learning how to work with linked lists. In one of the video lessons I attended, the teacher suggests the following code: struct celula { int info; struct celula *prox; }; typedef celula Elem; typedef celula *Lista; Lista* inic...
asked by 16.04.2018 / 05:53
3
answers

Can I store values without using static vectors?

I need to create a sparse array of type dynamic cross-list and my cells are of type: typedef struct CELULA{ int linha; int coluna; double valor; }CELULA; However, every time I create a new cell in a function, I do not know how...
asked by 05.11.2017 / 12:40
2
answers

Function help to delete the repeated values contained in a double-chained List in C

I am not able to develop a function inside my code that removes the duplicate values within a double-chained list, could you help me? Here is the code I have done so far, the function I need to fix is retiraValor : #include <stdio....
asked by 04.11.2016 / 08:23
1
answer

Sorting an unordered list does not work

The code works to the extent that I have sort a list already created using a new list, but I can not identify the error. It was when I created the Sort and AddOrdenado functions that started to give error. #include <stdio.h>...
asked by 12.06.2018 / 15:32
1
answer

Insertion at the end of a chained list C

I'd like to know how to go through the list so that I can add a new one at the end of it, in the case at the position in the-> prox of the last one in this list. Here is my code: typedef struct lista { struct no *prim; } Lista; typedef str...
asked by 05.06.2018 / 08:09
1
answer

Remove duplicate elements from a threaded list in python

My code returns error when trying to run: class No: def __init__(self,inidado): self.dado = inidado self.proximo = None def pegaDado(self): return self.dado def pegaProximo(self): return self.proxi...
asked by 01.12.2017 / 16:10