Most voted "list" questions
A list is an abstract type of data that represents a sequence of values, in which the same value can occur more than once. The main ways to implement a list is through an array (array, vector or one-dimensional matrix) or a chained list.
Learn more…1,022 questions
Sort by count of
-
0
votes1
answer180
viewsHow to get the maximum value of a Java circular list?
How can I get the maximum value of a circular list using a sentinel node?
-
0
votes0
answers380
viewsReplace matrix elements with an "X"
I have code that should print a matrix according to the input. You should print the matrix so that the "X" forms a right spiral starting from the middle, someone has some idea? ps.:Code comments are…
-
0
votes1
answer332
viewsManipulating list<int> in c++
My Class class Grafo{ int numeroVertice; list<int> *arestas; public: Grafo(int vertices); int addVertice(int quantidade); void addAresta(int verticeOrigem, int verticeDestino); void…
-
0
votes1
answer1077
viewsC Circular Double Chained List Descending Ordering
I need a little help here with Double Chained Circular List to solve a bigger problem. I need to do a function that already enters my elements in descending order. My code even works with entries…
-
0
votes1
answer48
viewsC# is not finding/recognizing my List
I have a List made with the following code: List<frase> frases = new List<frase>(); According to the documentation of System.Collections.Generic, my code is right. But for some reason C#…
-
0
votes1
answer216
viewsInsert with "for" into a chained list
I have a question, the teacher asked to insert elements in the chained list using the "for" but I’m having difficulty, the Class that creates the node is already working perfectly and the part that…
-
0
votes1
answer692
viewsUpdate Object List via Entity Framework
Good morning! I wanted to ask for your help just to see if there’s a better way to do it. Today I have a list of objects like Formatacao_RelatorioLinhaDeletada and perform a foreach on this list,…
-
0
votes1
answer49
viewsDeck(C++): Abort Trap 6
I’m trying to call a function I’ve done, but always this error appears: libc++abi.dylib: terminating with uncaught exception of type std::out_of_range: deque EXECUTAR FINISHED; Abort trap: 6; tempo…
-
0
votes1
answer304
viewsObject List(with some objects as attributes) for Datagridview - C#
How do I show the Street or Zip Code of the list below in Datagridview. People’s List (to display in datagridview) List<Pessoa> Pessoas; Classe Pessoa using System; public class Pessoa {…
-
0
votes3
answers50
viewsDetermine the indices of a vector to be subtracted
I have the following vector: a = [10, 20, 30, 40, 50, 60...] I need to create a new list that is the subtraction of the later index by the previous one. For example: b = [indice[0] - indice[1],…
-
0
votes1
answer80
viewsHow to Save All User Lists?
Hello is my first question here, I would like to ask a question. I would like to create a List that stores the user’s name, email address, password. Could someone help me? I thank you in advance,…
-
0
votes6
answers7088
viewsIntersection between two sets (element that is in set A and B at the same time)
I’m trying to make a function that returns the intersection between two sets: def intersecao(conjuntoA, conjuntoB): inter = [x for x in range(1,12) if x in conjuntoA and conjuntoB] return inter a =…
-
0
votes2
answers1856
viewslist index out of range Python
I have lists with numbers in string format and empty spaces. First I want to take the empty spaces, and then I want to convert to float. But right on the first for error appears: if (x[i]=='' or…
-
0
votes1
answer432
viewsHow to map a List to another List?
How can I map a list from one type to another list of another type ? I’m getting an object list of type public List<DetalheViagem> DetalheViagems { get; set; } And I need to move the valuables…
-
0
votes3
answers3451
viewsHow to count the records of a csv in python?
I’m a beginner in Python and I’m having a hard time. I have a CSV database separated by ";" with 6 columns. I’d like to count how many records you have, the sex of which is "Female". You can tell me…
-
0
votes0
answers29
viewsSearch for a smaller array within a larger one
I have two frequency lists, one observed and one modeled. I happen to want to find all the values closer to those observed within the model. The first has length of 38 and the second of 303. I did…
-
0
votes0
answers186
viewsDelete data in chained dynamic list using C language
Good afternoon. I’m doing a project for the college where the teacher asked to create an algorithm with dynamic lists, where one list should contain customers and another, products. The goal of the…
-
0
votes1
answer130
viewsIndex of tuples in a list - python
Organisation of information in the file (City, City, Distance) import csv with open('cidades.csv', 'r') as f: list1 = [tuple(line.values()) for line in csv.DictReader(f)] for i in list1:…
-
0
votes0
answers163
viewsPassing parameter inside the method in the foreach
I have the index that contains my class call CRUD and the foreach calling the class method crud. But within the foreach I’m trying to pass the table name parameter, but it shows nothing. If I take…
-
0
votes2
answers86
viewsI do not know how to call a certain item on the list that enters my "for" in other functions
I’m trying to make a program that picks up a list of partners that contain the name, email, and renewal day(like paying monthly fee), and when the day comes, send an email to it. But I’m having…
-
0
votes1
answer212
viewsJava Stream converter Map<String, Obj> to List<Obj>
I have this object filled: Map<String, List<LogLine>> logMap = new TreeMap<>(); And after I’ve made a filter, I’d like a flat list of it, but I can only create a list…
-
0
votes2
answers2091
viewsRemove Repeated Integers List in Python
I would like to remove repeated integers from a list and return a new list. lista = [1, 2, 3, 3, 3, 4, 5, 6, 6, 7, 8] The result would have to be this: [1, 2, 3, 4, 5, 6, 7, 8]…
-
0
votes1
answer161
viewsHow to create grid lists with C# in WPF?
I’m new in C#. I wonder how to create a grid list that contains images, something like what android has: Thanks in advance.…
-
0
votes0
answers97
viewsWhat is Listiterator and what is it for?
What would be the function of ListIterator? I have a variable of type List, that receives the information from my Postgresql Database, I need to access the information of this type variable List but…
-
0
votes1
answer92
viewsCustom sorting in Python
I have a list foo = ["BCB", "CAB", "CBC"] and a specific alphabetical order bar = "ACB". The result with that specific order should be resultado = ["CAB", "CBC", "BCB"] How do I sort that list?…
-
0
votes2
answers1542
viewsSum of Integer Numbers in a txt File
I have two txt files that contain only numbers (number per line), so I want to add line 1 + line 1 so successively until the last line of each file. Each file has the same line number. **In this…
-
0
votes2
answers119
viewsChained List C does not insert new node
I started making a chained list program, but when I use the print function, it wasn’t printing anything, so I discovered that the LISTA after leaving the function inserts, it again has the value…
-
0
votes1
answer36
viewsInteracting all items on a list
I have the following situation: I have 4 numerical lists ranging from 1 to 30. Ex.: AP_X = [1,2,3,4,5...30] AP_Y = [1,2,3,4,5...30] demanda_X = [1,2,3,4,5...30] demanda_Y = [1,2,3,4,5...30] I have…
-
0
votes1
answer51
viewsList with 3 c++ elements
I’m using list in c++, and in what I think its internal structure should contain: Content pointer to the next element It is possible to place one more variable within this structure, as the example…
-
0
votes1
answer535
viewsFind a specific element in a list with sub-lists (Python)
I’m tweaking a Pathfindig code based on A*, I need to check and modify an element within a list with several sub-lists, but I have doubts if I use a repeat loop, or if there is already a function…
-
0
votes1
answer402
viewsPython - print list elements that have 5 letters
Boas, Having the following list:: lista_nomes =['Manuel', 'Laura', 'Antonio', 'Jasmim', 'Maria','Silvia', 'Lu', 'Pancrácio', 'Diogo', 'Ricardo', 'Miguel', 'Andre',] I want to print the list elements…
-
0
votes3
answers9117
viewsconvert a string list into a list of integer numbers
x = ['443' , '552' , '342' , '368' , '9867' , '335' , '9412' , '7436' , '1692' , '85' , '990' , '332' , '8816' , '4567' , '279' , '119' , '2290' , '234' , '9863' , '345' , '230' , '5574' , '230' ,…
-
0
votes3
answers3331
viewsReturn the amount of elements repeated in a list
Could you help me with a question? How do I return the amount of elements that repeat in a list in python? For example: A list=[4,2,1,6,1,4,4] must return the value 2, because there are two elements…
-
0
votes1
answer169
viewsProgram stopping responding in C - chained list
I’m doing a college job in C and I’ve pretty much finished it. However, I got caught up in a bug that I can’t get out of. My show, when I cross the line aux1=aux1->next; simply stops working. It…
-
0
votes2
answers495
viewsType of list elements - Python
I have two lists of different sizes. The first is a list of lists. Where I need to compare the type of elements of this first list list with another list containing data type (str, int, float,..).…
-
0
votes1
answer393
viewsDouble Chained List Removal Doubt (C/ Ordered Insertion)
In a C++ class the teacher had proposed an activity where I had to do a program in the format of a double-chained list with ordered insertion. However, I have a problem on the Removal part. By…
-
0
votes1
answer98
viewsC# List Console
How do I display only the third values of the list, in case the ("500, 900, 2000, 1500, 2000). And how I do this same process to display only the third values of the list that has associated the…
-
0
votes1
answer89
viewsSmallest element of a sub-list, in a list
I’m trying to apply heuristics to a code that I’ve been working on, but I need to get the smallest element from a sub-list, from a list. example: L = [[1, 1, 6], [1, 2, 5], [1, 3, 7], [2, 1, 1], [2,…
-
0
votes1
answer43
viewsRemove all elements from the list without the Clean() method, is there a way?
For example I wanted to remove the elements from the list in this way: public class List : MonoBehaviour { List<string> inventário = new List<string>(); void Start () { for(int i =…
-
0
votes0
answers59
viewsCreate index alphabetically with Wordpres categories
I need to create an index with Wordpress categories, but do not know how to do. I can list the categories in alphabetical order, but I need to divide them by letters. For example: To ana Amara ....…
-
0
votes0
answers92
viewsHow can I read a CSV file with different line types?
I am trying to read a CSV file that has different lines. I am using fgets and Strtok to store in a list. the problem is that being different lines do not know how to stop and move to the next.…
-
0
votes2
answers136
viewsHow to transform a list [['a'], ['b']] into a string: ab
quantidade = int(input()) lista = [] lista2 = [] lista3 = [] palavra =() i = 0 while quantidade != len(lista): a = input() lista.append(a) for x in lista: b = x.split() lista2.append(b) for x in…
-
0
votes2
answers1459
viewsDelete and Query Python function
I have to make a simple program in Python. In the case of a library , however I’m having difficulties in the function of consulting and deleting. I honestly stalled, tried a lot of different ways…
-
0
votes0
answers253
viewsIt is possible to store a list in JSON file
I am displaying data that is brought from the database in some Dropdowns, as if it were a kind of website shopping cart page E-commerce, at the moment my page is like this: But I need to store this…
-
0
votes0
answers143
viewsPosition of first element in Heap object
I’m in doubt about the priority line heap, with regard to inserting items in that list. Every heap starts by inserting from the element vetor[1]? Or you must insert from vetor[0]? 'Cause I got a…
-
0
votes1
answer268
viewsArraylist of Objects + Inheritance
All right guys I’m having a doubt about inheritance, for example: List<Carros> carros = new ArrayList<>(); Chevete chevete = new Chevete(); chevete.acelerarMuito(); //Até aqui ok…
-
0
votes1
answer81
viewsList null android
I’m having trouble with the list, the method init() that is triggered as soon as I enter the screen has the following code: listaOpcionais = Globales.getListaOpcionais(); At this point I list what…
-
0
votes1
answer58
viewsRemoving items from a list
The case is as follows, when I remove the data from the list, when the number of the head is greater than the second is all right for example: List<a> 0 - ITEM A 1 - ITEM B (X) Exlui este! 2 -…
-
0
votes1
answer142
viewsHow to set the Index of a List to start at 1 instead of 0 when populated
Whenever I populate a list in C#, as in the example below, as I add items, they are arranged starting at position 0 in index. If I add 5 items to my list, I will have the positions 0, 1, 2, 3 and 4.…
-
0
votes1
answer325
viewsUse Arraylist or Linkedlist
The interface List has several implementations, among them ArrayList and LinkedList. Usually I have been using only ArrayList, but would like to know in which scenarios it is recommended to use the…