Questions tagged as 'lista-encadeada'

1
answer

Is there any problem with pointers in this struct that works with linked lists?

Hello. I'm developing a game with the C ++ language and I think I'm making a mistake in using threaded lists. I emphasize that I know there are more interesting features than using linked lists in C ++, but this is a project I did for college...
asked by 13.12.2015 / 15:03
1
answer

Chained List - sorting by selection

I am reproducing a sort ordering algorithm using threaded list. I'm using two loops using a cell min, iej, with respect to cell j, ok, but when changing the min pointers and i is not working, when i change the two, i starts the loop in the po...
asked by 18.11.2015 / 00:54
1
answer

Function inserts does not work

I am building a linked list to store a string with the following signature in the registry: typedef struct Lista *Noticia; struct Lista { int hora; char *Texto; struct Lista *PN; }; And the following function insert: void...
asked by 19.07.2017 / 21:42
1
answer

Error comparing two strings

I'm trying to compare two strings , so when I enter a name in my threaded list it can not be inserted if it already exists. I have already used the search_name function to display a searched name and to exclude, but now it is simply giving s...
asked by 05.12.2014 / 20:05
1
answer

Recursive Method LinkedList

I'm having difficulty implementing a recursive method for the method of inserting an element at the end of a simply linked list. The following is the Iterative method: public void addLast(Node<E> novoNodo){ if(isEmpty()) a...
asked by 17.11.2014 / 17:14
1
answer

How to delete a node in a linked list in Java?

I have the following code in java but it is not working properly. I need to delete a node from a linked list. Someone help me? /* Delete Node at a given position in a linked list head pointer input could be NULL as well for...
asked by 10.05.2018 / 19:54
1
answer

How to add an element at the end of a linked list

I need to add an element at the end of a linked list, I made the method asking it to add as if it were an initial element if the list is empty (is working) and, if it is not, scrolling through the list as follows: else{ Celula * cursor = p...
asked by 24.04.2018 / 17:44
2
answers

Segmentation Fault When Removing List Occurrences

The following code has the purpose of removing all occurrences of an integer in a list (linked lists), returning at the end the number of elements removed. Home Give me the segmentation fault error. Thanks for any explanation. typedef struct l...
asked by 26.04.2018 / 20:35
1
answer

How to remove duplicate elements from a list in C?

I have a list of contacts and need to remove duplicates, I was trying to solve using the code below: Elemento* remove_duplicados(Elemento* agenda) { Elemento* a = NULL; //POnteiro do Elemento anterior Elemento* p; Elemento* q;...
asked by 30.11.2017 / 18:55
1
answer

Linked List - append and push

I'm trying to learn Linked List and made the following code: #include <iostream> using namespace std; typedef struct snode { int data; snode *next; } node; void start(node ** head) { (*head)->next = NULL; } void push(...
asked by 12.07.2017 / 02:43