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
-
1
votes1
answer790
viewsError: incompatible types when assigning to type 'char[200]' from > type 'char'
When I try to insert the char motorista an error appears: [Error] incompatible types when assigning to type 'char[200]' from type 'char' Code: #include <stdio.h> #include <stdlib.h>…
-
1
votes1
answer15660
viewsPython, ascending order of numbers
My goal in the code is to print an increasing order of integers. For example: User type 2 numbers and I want to print the ascending order. Ex.: n1 = int(input('Digite um número')) #O usuário digitou…
-
1
votes1
answer1502
viewsHow to print an element from a list of lists in python
I have a list of lists, like: [ ('name1',size1), ('Nome2', size2)] I want to print just the name of each list, how could I do it?
-
1
votes1
answer1518
viewsList (static) operations c++
Good afternoon guys, I’m having a hard time understanding the operations in Statist lists, I know create and display, but how do I remove and search within the list, the sorting algorithms I’ve…
-
1
votes1
answer87
viewsHow to declare list in class?
I have a class Usuario you will have a list of the class Pastas, and this class will have a list of the class Questão. public class Usuario{ String nome; ArrayList< Pasta > listaPasta; } My…
-
1
votes1
answer63
viewsHow to print a message saying that the searched element was not found in the list? Python 3
Hello, people! How do I print a message on the screen saying that the keyboard input is not in the list? Note: If the keyboard input is in the list (for example if the user type 'password'), the…
-
1
votes1
answer1567
viewsHow to compare, remove equals, etc elements of two vectors in java?
I am doing a work in java to perform operations together, but as I am learning now I do not know how to compare the elements of vectors to make the following operations, union, intersection,…
-
1
votes2
answers1134
viewsConcurrentmodificationexception how to proceed?
I have the following method: private void houveAlteracao(Long id) { try { Objeto objeto = service.find(id); objeto.setEventos(JsfUtils.ordenarListaEventosPorHora(objeto.getEventos())); Objeto obj =…
-
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
answer896
viewsReference and Parameter in Python
I have a Python class that has a function that returns me a triple (3 information together) and I wanted to create 4 different objects because I need 4 different triples. The question is that the…
-
1
votes1
answer145
viewsWhat is the difference between these forms of command execution?
These commands in Python: lista = eval('[' + input("Digite sua lista: ") + ']') And this: lista = input("Digite sua lista: ") And this: lista = [int(x) for x in input().strip()] Why the latter gives…
-
1
votes1
answer463
viewsHow to remove all nodes from a circular list?
I’m having a hard time getting the logic of how to remove all nodes from a circular list, if someone could give a brief explanation of concept and / or point out the errors in the code I’ve already…
-
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
votes0
answers885
viewsDistance table google maps api and python
Hello, I am using the Google Maps API to check the distance between two points, for this I have two local.csv files and coordinators.csv. The ultimate goal is to know the distance of the locations…
-
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
votes3
answers416
viewsHow to Insert in a non-zero position in an empty list?
How can I insert a value in a non-zero position into an empty list? Ex: lista = [] . . . lista.insert(3, 'valor')
-
1
votes2
answers872
viewsHow to know how many numbers in one list are repeated in others?
I have four lists of their values: A = [1,2,3,4,5,6,7,8,9,10] B = [1,2,3] C = [4,5,6] D = [7,8,9,10] Would it have any function to compare list A with the other three lists and tell how many numbers…
-
1
votes2
answers50
viewsGet list names that are 4 in size
I am trying to solve the following problem: from a list of names, I need to return only the names with len 4. I wrote the code below but apparently the loop is not working since, in a list with 4…
-
1
votes1
answer255
viewsProblem using vowel lists and even numbers
The exercise is as follows: Make a program where the user type a letter and a number integer. If the letter is vowel and the number is even, or the letter is consonant and odd number, show…
-
1
votes2
answers60
viewsSearch for inconsistency in a C#list
Good afternoon. I have a list of the Project class The Project class has the properties: public string ID { get; set; } public string Nome_Usuario { get; set; } public string Nome_Projeto { get;…
-
1
votes2
answers219
viewsC# - Initialization of an array/list
I wonder if you can instantiate a vector of size n and initialize it with a specific value. (Without using one for this) For example, I would like to instantiate a vector, which will have size 100…
-
1
votes2
answers1595
viewsCheck if there is value in List
I’m trying to make a condition, where I would check, whether in a List there is a value, so I created the following: private void Itens_Edit(object sender, EventArgs e) { if(editar == 1) { int a =…
-
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
answer83
viewsProblem with using Java lists
I have a file loaded with 300,000 prices. I need to put prices in ascending order in a list. If I put it in standard mode, analyzing in a linear way where to insert each price, my algorithm is very…
-
1
votes4
answers1960
viewsBack position in data JSON format or list with Python
I am working with data similar to the structure below: {"Id":1, "Data_inscricao":"2017-01-01", "Texto":"Loremipsum", "Numeracao":26, "Tempo":"25s"}, {"Id":3, "Data_inscricao":"2010-05-02",…
-
1
votes3
answers3098
viewsUse return of a function in another function
I have a function in Python that takes a text and returns 2 lists, one with all the words that appear and the other returns is the number of times each word appears. def frequencia(lista): conv =…
-
1
votes1
answer1654
viewsHow to concatenate strings into a list?
If I have a list of string-like objects and want to concatenate all these items, how do I do that? For example: row1 = ['___', '___', '___'] I would like to print: '___|___|___' I managed to do so,…
-
1
votes2
answers2437
viewsInvert Simple List
EXERCISE: Write a method that inverts a linked list: Entree: 10, 99, 101, 666 Expected Result: 666, 101, 99, 10 I thought to follow the following logic: It would arrive until the last element (666)…
-
1
votes0
answers33
viewsHow to return the lists of a list in ocaml?
I don’t know how to return the lists of a list in the language ocaml. For example: wanted to give the input [["Preto";"Branco"];["Amarelo";"Vermelho"]] return ["Preto";"Branco"] and then…
-
1
votes2
answers88
viewsOrganize string data flow by default
Friends, I am working on a scraping project. At some point, I capture a table on the screen in the shape of a giant string, more or less like this: list = ('0004434-48.2010 n EU n (30 working days)…
-
1
votes1
answer149
viewsUser type 15 random numbers, program returns the average, numbers larger than average and those smaller than average!
num = [] soma = 0 media = 0 for i in range(1, 16): num = int(input('Digite um número: ')) soma += num media = soma / 15 if num[i] > media: print('Maires que a…
-
1
votes1
answer837
viewsMy double chained list is not ordering
Class On Double package ListaDuplamenteEncadeada; public class NoDuplo { private Integer elemento; private NoDuplo anterior; private NoDuplo proximo; public NoDuplo(Integer elemento, NoDuplo…
-
1
votes2
answers396
viewsDoubt about struct and list in c
I’m having trouble when you need to give a value to a person, in case I need to give the value name and age to the person. I tried to create a struct PESSOA and a list containing a person and an id,…
-
1
votes2
answers219
viewsLoop memory and processing optimization
The code is simple and is working perfectly, but wanted tips on how to optimize it, what would be the best methods to use to allocate less memory, best practices, etc. using System; using…
-
1
votes1
answer319
viewsRemove element from the list in C#
I have a list and I want that after the foreach from that list, remove all elements from it, the method RemoveAll() asks parameter, but I don’t know which parameter to pass. foreach (var lista in…
-
1
votes1
answer92
viewsList as function input
In Python 3.7 items of a list can be arguments of a function? def media(x,y,z): lista = [7,8,9]
-
1
votes1
answer205
viewsColumn Python function for a list
I need to create a function that adds columns from one list to another list in the same order by following this structure here (you can use FOR). def column_to_list(data, index): column_list = [] #…
-
1
votes3
answers497
viewsConvert string into a list where each element in the list is 3 characters from my initial string
I wonder how I can turn one string on a list where each element of that list is a string with 3 characters from string original. Therefore if the string original was like this "AAGGGTTGG" I get a…
-
1
votes2
answers461
viewsConvert JSON to Array in java
I have a JSON that represents a test query: {"dctitle":"TestesStatus", "oslc_cmtotalCount":2, "oslc_cmresults": [ {"dctitle":"33643640", "rdfabout":"XXXXXXXXXXX", "dbid":"XXXXXXXXXXX",…
-
1
votes2
answers108
viewsWhy don’t you instantiate the list so it doesn’t accumulate?
I have the following class: public class TesteLista { public static void main(String[] args) { List<String> dados; Teste1 t = new Teste1(); dados = t.getList(); System.out.println(dados); } }…
-
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
answer443
viewsHow to put a List<> in a Listview?
I have a method to read my database that returns me a List<>, I would like to know how I display this List<> in a Listview component DLL dll = new DLL(); dll.listaVeiculoss(); //Esse…
-
1
votes1
answer107
viewsHow do I let a list with multiple indexes turn into a list with only one index in Python
How do I transform an element like this: lista = [testando, este, aplicativo] on a list like this: lista = [testando este aplicativo] Someone knows how to do this, and if it is possible to do this…
-
1
votes2
answers1278
viewsPass product list to another Activity
Hello, I am learning and I wanted the suggestion of you, in a simple way at first, how to make this passage of products to another Activity. The application I’m developing it loads a list of…
-
1
votes3
answers69
viewsTransform a list into several within the same
I have the following list: X = [1,2,3,4,5] I want you to stay like this: X = [[1],[2],[3],[4],[5]]
-
1
votes3
answers1181
viewsHow to access the elements of a list declared in a different class?
I have developed a code that generates a list when the following input data is informed: List size (or how many "Indexes") The values that will fill the said "Indexes". Values are collected within a…
-
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
votes2
answers262
viewsAdd value to a string list
I have a class, and in it I have a List<string> and I just create it to add the values elsewhere. But when I try to add a value, I get the following error: Nullreferenceexception: Object…