Most voted "classification" questions
Sorting algorithms are used to lay out the elements of a given list in a certain order defined according to a desired parameter.
Learn more…290 questions
Sort by count of
-
2
votes2
answers2969
viewsHow to sort and sort strings without using Collection?
I am creating a register of employees with some fields(name, email, phone and salary) in ArrayList which are recorded in txt. After the data is entered into the array (before passing to txt) they…
-
2
votes1
answer173
viewsArraylist Comparator JSP Object
I’m having trouble implementing the Comparator method, to sort the Object Arraylist. I have an Enterprise class. Where I then create an Arraylist, which is filled from a content manager system. I…
-
2
votes2
answers428
viewsMultiple sorts with Arraylist
I have a question. I want to order the Arraylist person in different ways. <%@ page import= "java.util.*"%> <%! public class Pessoa implements Comparable<Pessoa> { String Nome;…
-
2
votes2
answers1400
viewsHow to sort a p:datatable
How do I sort a datatable by a text. For example my system is a service order system, I need the "Open" orders to come first. Follow the code of the datatable below. I tried to use sortby but it did…
-
2
votes1
answer183
viewsSelection Sort - Is that correct?
I implemented a logic of Selection Sort and would like to ask if it is correct. Because at the end of the process the result is expected, but went to make a real proof and found several algorithms…
-
2
votes2
answers17879
views(Python) Sort lists without Sort()
how to sort a list without using Sort()? The code below is correct, but the teacher does not want you to use Sort(). The code has the following instruction: "Make a program that, when filling a list…
-
2
votes1
answer106
viewsIs there any sort algorithm that actually runs on O(n)?
If such an algorithm exists, how is it possible for an algorithm to sort a data collection in linear time even if it falls in the worst possible case (reversed)?
-
2
votes1
answer2495
viewsBubble Sort in Assembly (MIPS)
My teacher asked us to implement Bubble Sort in the MARS environment but I’m not getting it. There is some error in the code. Can anyone find the error? The way out should be {1, 2, 3, 4, 5, 6, 7,…
-
2
votes1
answer186
viewsWhat is the benefit of a classification algorithm being stable?
A classification algorithm (Sorting) is said to be stable if it maintains the relative order of the elements with equal keys. I think my question is, what is the benefit of maintaining this relative…
-
2
votes1
answer154
viewsSort queryset Django by priority
I am creating a search system on my platform. I do a search for the title of the content, description and tags within it. Follow the code: questions = Question.objects.filter(reduce(lambda x, y: x |…
-
2
votes2
answers229
viewsDynamic SQL result sorting
First good afternoon, I work specifically with Java in the Back-end using Webservices Rest and Postgresql, after some professional enhancements I was instructed to pass ordering and pagination of my…
-
2
votes0
answers125
viewsArray sorting with heapsort simulating multi-child tree
Doubt: To order arrays with heapsort, it is customary to simulate in them trees with up to two children per parent, no longer. My question is whether there are studies, implementations, experiments,…
-
2
votes1
answer95
viewsMergesort, problem of logic
Gentlemen, I’m having a problem with my Mergesort sorting algorithm, I feel the problem is in logic. Merge code: static void mergesort(int[] x,int inicio,int fim){ if(inicio<fim){ int meio;…
-
2
votes1
answer79
viewsError in sorting numbers
Even numbers I managed to sort, only odd numbers I can’t sort. The memory address of the number appears. Link to the question: Even and Odd Here is my code: #include <stdio.h> int main(int…
-
2
votes4
answers745
viewsSort Divs by date in dd/mm/yyyy format
Does anyone know how I can sort a set of Ivs through a date present in their content? for example: <div class="box" id="box1"> <div class="date">01/05/2018</div> </div>…
-
2
votes1
answer298
viewsDetermine sequence of numbers with Bubble Sort from a python txt file?
I have a txt input file with data type the below: 7 6 8 4 8 5 0 1 2 1 0 3 2 3 0 This file is about information for 3 students of a school. The first line is the age of these 3 students (the first…
-
2
votes0
answers24
viewsDoubt in Javascript merge debug
I’m studying data structures with Javascript and so far everything was ok. Only when I got to the sorting algorithms, more specifically the merge Sort, I ended up crashing, I can’t understand the…
-
2
votes1
answer62
viewsProblems when printing the sorted number file
Guys, good night, I’m having a problem with this algorithm, I ask you to enlighten me with your knowledge. I apologize in advance if it’s hard to understand the code, I’m still in second period. The…
-
2
votes1
answer807
viewsStable vs unstable sorting
What defines a stable sort algorithm? In this question has already been talked a little about what is stable and unstable ordering, but I still do not understand the advantage of using an unstable.…
-
2
votes1
answer237
viewsHow to sort an array by the frequency of appearance of each element?
Not to delay too much I go straight to the point, I am trying to make a program for an exercise that possessed the following instruction: Build a function int ordenaFreq(int v[], int n) efficient,…
-
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
votes1
answer315
viewsHow to count the number of comparisons of an algorithm (insertionSort)?
I have a college job where I should create some vectors with random numbers and then sort in some methods(Insertion,Bubble,merge,etc). After sorting, I need to count the number of comparisons that…
-
2
votes3
answers345
viewsAn array index error
I’m trying to make an algorithm for Selection Sort, just to train algorithms even, in my view my logic is right about ordering, but it is returning me an error that I do not understand. Code: import…
-
2
votes2
answers157
viewsSort an array of strings with dates
I have the following array: let datas = ["nov/2018", "set/2018", "jan/2019", "dez/2018", "out/2018"] when executed datas.sort() it orders by alphabetical order, however, I must order first by year…
-
2
votes1
answer32
viewsHow to order one dataframe by order of another?
I have 3 dataframes with 2 columns and 5 rows each, as follows: Dataframe 1: estado casosNovos <chr> <dbl> 1 SP 3189 2 CE 1921 3 AM 1365 4 PA 1135 5 MA 938 I would like to order the DF2…
-
1
votes1
answer419
viewsPaging with Eager Loading in Laravel
I’m having a little ordering problem involving paging and Eager Loading. What I need to do: On one part of my site, I need to bring paged results from a subcategory The subcategory is daughter of a…
-
1
votes4
answers1530
viewsProblem with sorting in Postgresql
I’m having a problem sorting columns in Postgresql despite being configured correctly in UTF-8. The version of Postgresql is 9.3 and it is installing on a Macosx Maverick 10.9.5 (this problem has…
-
1
votes0
answers27
viewsMake an Order by date
I have the following class I want to sort her values by date public class ItemListAnuncios { private String texto; private String data; public ItemListPropaganda(String texto, String data) {…
-
1
votes1
answer2935
viewsSort Char vector in C using selection method
I am trying to sort a char vector using the selection method (Seletion Sort), but it is returning me the vector exactly the same way, without even making a change. Can someone point me to the error…
-
1
votes2
answers437
viewsSorting in recursive query
In another question I asked i had found a solution but ordering only works if the ID’s are growing: USE TESTE GO WITH Niveis AS ( -- Membro âncora SELECT Id, IdPai, convert(varchar(1000), Nome) as…
-
1
votes1
answer1352
viewsposition of a tr (html <tr></tr>) in the sequence of tr’s
I have a simple screen, where I have already been able to create elements dynamically, with the click of the button, these elements are draggable up and down, and are two different elements, one…
-
1
votes1
answer183
viewsSort nodes from Tree view
In my Tree view I have several child nodes. All nodes are created with numbers as these identify a different file and are composed by date. How could I sort these nodes numerically? I mean, like:…
-
1
votes0
answers106
viewsAggregate with Sort - Mongodb
I have a query in Mongodb, I do Aggregate to count how many items there are in each category, everything works well, however I can’t sort the data, that would be ordered by the Title field. Follow…
-
1
votes3
answers301
viewsSort query with cakephp paginate 3.0
$this->paginate = [ 'contain' => ['Unidades'], 'fields' =>['PontoDeColetas.id','PontoDeColetas.nome','PontoDeColetas.status','Unidades.id','Unidades.nome'], 'order' => ['Unidades.nome'…
-
1
votes1
answer960
viewsHow to sort an array of objects in java
Hello, I have a class teams where they have scores (int), winning number (int), defeats (int) etc. Within the method main, I have an array of 20 teams and need to sort them by the score, if the…
-
1
votes1
answer106
viewsSort array php
I have a array, in which values are arrays. How can I order the first array, accordingly with a value that is in the second array? Example: array(array(id=>5), array(id=>2), array(id=>1),…
-
1
votes1
answer168
viewsDynamic Linq Ordering using System.Linq.Dynamic
I’m trying to sort a list using the library System.Linq.Dynamic, follows the code excerpt: list = db.TABELA.Where(consulta.Colum + ".Contains(@0) ", consulta.filtro).OrderBy("@0 ",…
-
1
votes2
answers1083
viewsSort a. csv file from the numeric column
I have the following file: es;548 la;1832 primera;35 vez;107 que;2598 hago;15 un;878 pedido;642 y;1713 creo;83 ha;207 funcionado;1 muy;371 bien;257 los;1054 precios;88 fuesen;11 And I’d like to sort…
-
1
votes0
answers181
viewsHow to order pages columns with clicks
I need a great help with php. I am new to object-oriented programming, with help from some people I have managed to make a site where heritage work, and try to follow some programming rules whenever…
-
1
votes1
answer93
viewsWhy use a pointer to that algorithm?
When I withdraw the code does not work. Why? And why the algorithm of Insertion Sort is only suitable for list of small entries, type array and list (little)? void insert_sort(int *vetor, int TAM){…
-
1
votes2
answers247
viewsHow to sort a list by the number of occurrences? In Python
Like, I have a list like this: lista = [1,1,2,3,3,3] And I want to order her to stay lista = [3,3,3,1,1,2] That is, the most occurring values would be at the beginning of the list, while the least…
-
1
votes1
answer440
viewsHow to order a struct within a struct
I am wanting to do ordering of a struct that is referenced within another struct: Detail: can be a sort using Selection Sort typedef struct{ int tipo; char dispositivo[50]; int prioridade; }Perif;…
-
1
votes1
answer91
viewsWhat is the C++ vector
The college professor asked to research the ordering scripts and perform tests with them, determining which is better in which situation. I found the scripts, though on the site the guy does not…
-
1
votes1
answer165
viewsWhat does "sort an array" mean, either by rows or columns?
What it means to "sort an array", whether by rows or columns?
-
1
votes1
answer44
viewsRankin in in Mysql
I’m trying to generate a ranking of absences for HR. The record of absences is made in a separate table of the Employee’s registration. I need to bring the list of active employees and the amount of…
-
1
votes1
answer74
viewsCould you help me with Mergesort?
I’m having trouble compiling the Mergesort sorting method. #include <stdio.h> #define TAM 10 void intercalar(int vet[],int aux[],int ini1, int ini2,int fim2) { int…
-
1
votes1
answer299
viewsBag of words in Python
I have a news dataset and I want to separate them between two classes. For this I thought about using Bag of words, but I’m not getting it with Sklearn. I tried the following: #Bag of words from…
-
1
votes1
answer3648
viewsSort HTML tables
I have 2 tables that were initialized in HTML but that join rows and columns through 2 Javascript functions. HTML Table 1: <table id="myTable" > <thead> <tr>…
-
1
votes2
answers438
viewsBubblesort random numbers
The numbers are generated randomly in the vector, but when I call the function Bublle to sort the result returns 0. Someone can help me???? using System; namespace BubbleSort_CSharp { class Program…
-
1
votes1
answer96
viewsSort records containing numbers at the end
I have a table with the following records: +----+------------+--------------+ | id | title | url | +----+------------+--------------+ | 1 | Olá Mundo! | ola-mundo-1 | | 5 | Olá Mundo! | ola-mundo-3…