Most voted "chain-list" questions
A chained list is a representation of a sequence of objects in computer memory. Each element of the sequence is stored in a list cell: the first element in the first cell, the second in the second and so on.
Learn more…190 questions
Sort by count of
-
2
votes1
answer635
viewsChained list within Chained list
I’m struggling with chained lists inside a chained list. The program is a card game in which there is a doubly chained list of players and within each node of that list, a list (the hand) of cards.…
-
2
votes1
answer91
viewsLinked List - append and push
I’m trying to learn Linked List and I made the following code: #include <iostream> using namespace std; typedef struct snode { int data; snode *next; } node; void start(node ** head) {…
-
2
votes1
answer77
viewsInsert function does not work
I am building a chained list to save a string with the following signature on the record: typedef struct Lista *Noticia; struct Lista { int hora; char *Texto; struct Lista *PN; }; And insert the…
-
2
votes1
answer2607
viewsHow to remove duplicate elements from a C list?
I have a contact list and need to be removed duplicates, I was trying to solve using the code below: Elemento* remove_duplicados(Elemento* agenda) { Elemento* a = NULL; //POnteiro do Elemento…
-
2
votes1
answer75
viewsMy C code contains some errors (Data Structure List)
I created a Music Player for a Data Structure discipline using Double Chained and Circular List. However, you are showing some errors and I am not seeing where. Could someone help me ? Maybe it’s…
-
2
votes3
answers100
viewsPrintf does not print inside the while
the purpose of the code is to print the values of linked lists. Example of what the list looks like: L->[3]->[4]->[5]->X, should print 3, 4, 5. However. typedef struct lligada { int…
-
2
votes1
answer374
viewsHow 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 did the method asking it to add as if it were an initial element if the list is empty (it is working) and, if it is not, scrolling through the…
-
2
votes1
answer214
viewsHow to delete a node in a chained list in Java?
I have the following java code but it’s not working properly. I need to delete a node from a chained list. Someone help me? /* Delete Node at a given position in a linked list head pointer input…
-
2
votes1
answer1942
viewsSort list on in C
My problem involves reading data from a text file, where is provided the CPF, name, email, age, sort using list sort in ascending order through age, if you are equal age sort by Cpf. But I’m having…
-
2
votes2
answers77
viewsArray is not showing the data that should be there
Class Interface: switch(opcao) { case 1: Usuario umUsuario = new Usuario(); umUsuario.criarUsuario(); break; case 2 : System.out.println("Busca de usuario"); System.out.println("Forneça o cpf do…
-
2
votes1
answer84
viewsDoubt - Dynamic list
I have the following structure for my dynamic list: typedef struct DataNode { int id; } DataNode; typedef struct Node { DataNode data; struct Node *Next; } Node; typedef struct List { int size; Node…
-
2
votes1
answer499
viewsProblem with chained list in C
I am doing a college job where basically the Program should be done in C language using chained lists and have 3 options: Add music (beginning, middle or end of list) with name, band and duration;…
-
1
votes1
answer119
viewsHow to block the insertion of information using a List
Well I’m using list structure and I’ve tried everything and so far I can’t. I am trying to get the product entity to receive ONLY the CPF from a vendor. The entity Product works when the entity…
-
1
votes2
answers37
viewsProblem deleting from recursion list
I’m trying to use this function to remove from the list, but it runs endlessly. void rDeleta(lista* l, int elemento) { if(l!= NULL) { if(l->elem == elemento) { lista* aux = l; l = l->prox;…
-
1
votes1
answer172
viewsFunction return type for a chained list
What kind of return to use in a chained list? For example, insert at the beginning of the list. void inserir(pessoas **pessoa, int valor) no return (void). Or return a pointer from the list.…
-
1
votes3
answers196
viewsIs it possible to store values without using static vectors?
I need to create a sparse matrix of the cross-dynamic list type and my cells are the type: typedef struct CELULA{ int linha; int coluna; double valor; }CELULA; But every time I create a new cell in…
-
1
votes0
answers55
viewsRecover chained list of.bin file
I am programming in C and I have a code that uses a sequential list of 50 positions to store in each of its spaces the first address of several chained lists, so far so good, the problem is when I…
-
1
votes1
answer992
viewsInsertion at the end of a chained list C
I would like to know how to go through the list so that I can add a new No at the end of it, in the case at the position no->Prox of the last in the present in the list. Here is my code: typedef…
-
1
votes0
answers23
viewsFunction that finds the last node in the List and inserts a new node at the end of the List
Complete the function below that finds the last node in the List and inserts a new node at the end of the List. What’s the problem of this function? How to improve it? I’m new to data structure, if…
chain-listasked 5 years, 10 months ago Brognoni 11 -
1
votes1
answer384
viewsHow to order double chained list without affecting the original list?
Hello! So far, I have been able to implement all the methods on the list, including the sort method. However, the problem is that when ordering, even creating a new list and making it receive the…
-
1
votes0
answers41
viewsDouble-chained list with a graphical interface to browse the list
I’m new to programming, I’m having a hard time. I implemented a doubly chained list I need to navigate the sorted data of the list by a graphical interface, both next and previous, only I do not…
-
1
votes1
answer317
viewsHelp with C nested structs
I was creating in C a list and using a struct, after finishing I tried to see what changed with a struct nestled, created two structs basic, one receiving only one value and another receiving this…
-
1
votes2
answers668
viewsFunction help to delete repeated values contained in a double-chained C List
I’m not able to develop a function within my code that removes duplicate values within a doubly chained list, could help me? Follow the code done so far, the function I need to fix is the…
-
1
votes1
answer1028
viewsTransforming a Single List into a Double Chained List
For a college job, I need to get a C function to receive a Single List and return a Double Chained List with the even values of the Single List that was passed. My attempt is this, but only displays…
-
1
votes1
answer5263
viewsString chained list (character array) in C
I’m doing a job for college, and it’s basically about hash table. At work, I have to do a Hash table of a n strings, for example. Instead of making an array of characters (in this case, an array of…
-
1
votes1
answer234
viewsDynamically creating lists and saving their addresses (top of list)
Hi, I’m doing a college paper on Hash table and I’m having some difficulties. I will try not to complicate too much (to tell you the truth, the execution of my code helps me to understand what I…
-
1
votes2
answers6045
viewsHow can I invert a simple chained list without using a previous pointer
I have to solve a data structure fiction problem that consists of reversing a chained list but how can I invert a list if I don’t have its elements (Less of course p-start and p->end )follows the…
-
1
votes1
answer59
viewsTrash memory output function inserts in the middle of a list
Staff developed this function: tipo_lista * insere_meio(tipo_lista *aux, tipo_lista * valor, int pos){ int cont=1; //é a posição do primeiro elemento da lista encadeada tipo_lista * p = aux;…
-
1
votes1
answer1616
viewsCircular List Double chained in C/C++
I’m having trouble removing the first and last element of this circular list. // Created by Thiago Cunha on 25/05/2017. // #include "double_linked_list_circular.h" int count = 0; List* init() {…
-
1
votes1
answer61
viewsList
I need to create a road map, where each path points to another and so on. I’m using pointer pointer to a list, so I can build something similar to an adjacency list, but at the time of entering the…
-
1
votes1
answer438
viewsPrint on dynamic list screen
Staff can not perform the function of printing on the screen, could help me in this function below. void imprime_lista(Lista* li){ while (li != NULL) { printf("%d ", li -> struct amatricula); li…
-
1
votes2
answers299
viewsInserting elements in a dynamic list
I did this function, but I do not know if it is right, there is no error in the compilation, but it gives an error when the prompt that the program has stopped working. Insertion at the beginning:…
-
1
votes1
answer303
viewsHow to make a pointer point to NULL?
I need an element position in a dynamic vector to be empty, so I can check if I can place an element inside it later. However, the compiler does not allow it. Follow my code: MATRIZ_ESPARSA…
-
1
votes1
answer325
viewsAddress type Struct for INT
I have the following Struct: struct nodo{ int elo_a; char nick[26]; char cidade[16]; int idade; int elo_p;}; I have both struct assignments: struct nodo *variavel; struct nodo *offline; Ok, I…
-
1
votes1
answer785
viewsRemove duplicate elements from a python chained list
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…
-
1
votes2
answers1187
viewsMeaning of two asterisks in function call
I’m trying to understand a code about simply chained list. The function InserirInicio has as a parameter Nodo **inicio, float dado. I could not understand the use of two asterisks in the parameter…
-
1
votes1
answer323
viewsHow to use free in a structure variable (chained list)?
I can’t use the free() in "struct Lista *proximo". Follows my code: #include "stdafx.h" #include <stdlib.h> #include <conio.h> #include <locale.h> struct Lista { int num; struct…
-
1
votes2
answers3307
viewsConcatenating two linked lists into C
I’m starting my studies on dynamic structures in C and I’m having trouble making a code to concatenate two lists. The paint part on the screen the contents of the lists is working, but when…
-
1
votes1
answer677
viewsCreate Chained Dynamic List
I am learning how to work with chained lists. In one of the videos classes I attended, the teacher suggests the following code: struct celula { int info; struct celula *prox; }; typedef celula Elem;…
-
1
votes1
answer1407
viewsRemove the first element from a double chained list - C
I’m having trouble removing the first node from my double-stranded list. I created a function that returns the list type (Value) to perform the operation, by showing the list elements within the…
-
1
votes1
answer174
viewsData Structure, Double Chained List. Doubt about the Double List Constructor
Note: Code taken from a Data Structure booklet. Why not pass the number of nodes from the Double Chained List by its Constructor (as in Stack or Queue structures)? public class ListaDupla { private…
-
1
votes0
answers177
viewsCode Issues in C Chained List
I’m having a problem with a C code. I’m trying to open a txt file that has movie name, year , actor,... And I’m putting the movies on a chained list. The problem is at the time of sorting the movies…
-
1
votes1
answer132
viewsDoubt about chained list in C
Hello, I made a simple chained list in C, with the insert start and insert functions at the end, as I do the removal functions? #include <stdio.h> #include <stdlib.h> typedef struct no{…
-
1
votes1
answer52
viewsSorting an unordered list does not work
The code works until the part I have ordered a list already created using a new list, only I can not identify the error. That’s when I created the functions Ordain and Addordenado that started to go…
-
1
votes0
answers56
viewsGraph represented as list linked to list
I am trying to implement a graph with list structure linked to list by pulling the data from a txt file (input.txt). A 100 2 B 3 D 4 B 150 2 C 3 E 2 C 150 1 F 2 D 150 1 E 4 E 100 1 F 1 F 200 0 The…
-
1
votes1
answer127
viewsHow to store a chained list
Hello, I have some questions that I will illustrate below: Having two double chained lists A and B with the structure struct lista { Ponto* dado; /* dado = número */ struct lista *prox; /* ponteiro…
-
1
votes0
answers56
viewsProblems when deleting an element from a list within another chained list
I’m having a problem removing an element, I have a function that is responsible to delete the element within double-chained lists. How it works? In the main function is called the name of an…
-
1
votes1
answer32
viewsDouble-linked and circular list, 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…
-
1
votes1
answer62
viewsWhy is my C code that uses queue giving Segmentation fault?
Hello I must implement a queue that receives the name information and Cpf but only when I try to unroll something gives seg fault, without the row of the unroll wheel normal, but I do not see the…
-
1
votes1
answer70
viewsProblem with repeated number removal algorithm on doubly 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) {…