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

23
votes2
answers6299
viewsWhat defines a stable sorting algorithm?
It is known that there are several ways to sort the data of a collection, some examples are the famous Bubble Sort, Insertion Sort and Selection Sort. I heard some algorithms are stable and others…

23
votes1
answer510
viewsWhy learn different algorithms that solve the same problem?
I don’t have training in computer science. For example, whenever I want to sort a number vector x in one of the programming languages I use, just run sort(x) and everything is solved. However, the…

17
votes1
answer1515
viewsWhat is the difference between ordered, unordered and Sorted?
These terms are used in some data structures to define how elements are inserted and maintained, which means each? Sorted and ordered wants to say the same thing? Unordered means it’s random?…

16
votes5
answers14262
viewsHow to sort list with complex object by one of its properties?
I have a list of objects and I want to sort the list by one of the properties (Desc type string), how do I do this? public class Foo { public string Desc { get; set; } // Várias outras propriedades…

11
votes3
answers1814
viewsSort a multidimensional array with numerical values
Suppose the following situation in which I have a array composed of several array numerically valued: $array = array( array(22, 25, 28), array(22), array(22, 23) ) I’d like to leave this array…
php array algorithm multidimensionalarray classificationasked 10 years, 7 months ago Douglas Cabral 345 
11
votes1
answer269
viewsWhat sort algorithm does . NET use by default in a list?
I have a problem that I have to perform sorting in memory of a high number of items and I would like to know which algorithm that the . NET uses to sort when we call the method Sort() from a list,…

11
votes2
answers536
viewsExternal and internal memory sorting algorithms
I was researching the difference between memory sorting algorithms external and internal and found the following answer in Quora : "In cases where we have to classify more data than can fit into…

9
votes1
answer4345
viewsHow to sort a list of tuples by the nth element?
I have a list of fashion tuples: [(0, 1), (2, 3), (4, 5), (6, 3)] I want to sort that list by the second value of each tuple (i.e., in case we would [(4, 5), (6, 3), (0, 1), (2, 3)]. How to do…

9
votes1
answer1218
viewsSort numeric vector without using Bubble Sort
We usually learn in college that, to sort integer vectors, we use a technique called Bubble Sort: int[] vetorOrdenado = new int[8]; vetorOrdenado[0] = 2; vetorOrdenado[1] = 41; vetorOrdenado[2] =…

8
votes2
answers633
viewsSort array by a property
I am trying to sort an array by a specific property(weight), I found some possible solutions but they did not work for my case, someone would know where I am doing something wrong or another way out…

8
votes4
answers1166
viewsHow to sort the data of a query by predefined values?
Using as an example, I have a certain user table, where that user’s city is, is a reference to another table. I need to order these users in a query according to the location of the current logged…

8
votes5
answers14934
viewsSort Datatable Datetime Field
Hello. I have the following datatable: success: function (data) { $('#tablecontrole').html(data); $('#tablecontrole').DataTable({ "language": { "url":…

8
votes1
answer517
viewsParallelize python OddEven Sort sorting algorithm
I have developed the following serial code to perform the OddEven Sort sorting, which first sorts even/odd and then odd/even. import time def oddevenSort(x): sorted = False while not sorted: sorted…

7
votes1
answer3070
viewsTo sort a list of objects by TWO properties
On this topic: How to sort list with complex object by one of its properties? is explained as ordering by a property, but as ordering by two? Taking into account the following product class:…

7
votes3
answers1081
viewsSort chained list with O(n*log(n) method)
I need to sort a chained list (own implementation, without using Java API) with a sorting method that has O(n*log(n) complexity. Researching methods that satisfy the condition found the quicksort,…

7
votes2
answers512
viewsSort Datetime field only by Date part
I have a property of an entity that’s like DateTime? and in SQL Server is of the type datetime also. I need to make a query that sorts by date, but without considering the time, because in this…

6
votes1
answer876
viewsCombination of 4 numbers in Mysql
SGBD: Mysql Problem: List all possible combinations between the numbers "1,2,3,4", so that they do not recur between them. Example: 1 2 3 4 12 13 14 21 23 24 31 32 34 41 42 43...…

6
votes1
answer5108
viewsHow to sort an array of numbers from largest to smallest?
There is the function sort, but it sort from minor to major, and I’d like to sort from major to minor. There’s some function in javascript for that? Code with sort: var numeros =…

6
votes1
answer347
viewsinterpretation of quicksort
I learned Haskell, and now I’m starting to learn C. I’ve been trying to pass my quicksort code in Haskell to C but I haven’t succeeded. So I decided to look at some books and found the following…

6
votes2
answers1551
viewsSort words with accents in PHP
I am trying to alphabetically sort an array in PHP, where the key of each array position is a word. I’m using the function ksort. Sorting works, the problem is that accented words such as "acid" are…

6
votes3
answers1337
viewsIn what order is a Set stored? Random?
When I store something inside a Set, the order in which it stores is random? And how could I order a set Set?

6
votes2
answers1150
viewsSort month that is in full in Postgres
I need to make a ORDER BY in a table mes which has the months in full and in Portuguese (Janeiro, Fevereiro...). It has no relation to any other column in the table. It is possible to do this?…

6
votes2
answers57
viewsA: problems with Sort (NA)
I have a vector I want to order using sort but, in doing so, I do not see the missing values (NA). How to do it? Grateful. > x [1] "b" "c" "a" NA NA "b" "c" "a" NA NA "b" "c" "a" > sort(x) [1]…

6
votes1
answer551
viewsSorting with heapsort
When ordination is done with the heapsort and the candidates for the tree root are equal, the priority order is given to the highest or lowest index element in the vector original or is given by the…
classificationasked 8 years, 7 months ago Daniela Morais 4,687 
6
votes2
answers1002
viewsBogosort  what is this?
What exactly does the bogosort sorting algorithm? Because many say he’s inefficient?

6
votes3
answers269
viewsI need to sort a list in order that seems unusual
I have a query and want to sort this query by the attribute code. I did it as follows: consulta.OrderBy(c => c.Codigo); Result obtained: 1.01 1.A 14.04 14.11 22.01 3.04 30.01 4.01 40.02 Expected…

6
votes3
answers878
viewssort multidimensional array php
I have the following array returned from a webservice (in the image I identify what I want, below the text for copy): Array ( [DataTable] => Array ( [ID] => STOCK [Line] => Array ( [0]…

6
votes1
answer116
viewsSort 2 columns at a time  Asp Mvc + Fluentnhibernate
Good morning! I would like to know how to order two columns at once in a query so that in my case, 1 in descending order of date but in alphabetical order. public IList<Analise>…

6
votes1
answer1224
viewsWhat is the best implementation of 'Mergesort Algorithm'?
I know the Quick Sort algorithm, but at the moment I want to analyze Merge Sort. I found two types of Merge Sort implementation on the Internet. But when I compare them to the Insertion algorithm,…

6
votes1
answer272
viewsSort list by string resemblance
I have a list of string: AAA BBB CCC ABB ABC ACC ACD The user will type what he is looking for, would like to take to the first positions, the most similar. Example: String: A Upshot: AAA ABB ABC…

5
votes3
answers591
viewsSQL sorting only after the third character
I have a field in my table in Mysql that is string type, with the following data: Coluna 01DV 03DV 04DV If you enter the value 02CA the field lays like this Coluna 01DV 02CA 03DV 04DV I need him to…

5
votes2
answers178
viewsAbsolute ordering by data returned from DB
In PHP I am making a query to my database using Mysql. In my database I have the table fotos_album and inside I have the name of the photo. I want to sort the table by field nome. We imagine that…

5
votes1
answer4346
viewsHow to sort alphabetically and numerically the same list?
In my college work I must make a list of the kind of class I created and I must sort it in two different ways, one by alphabetical order and the other by average score. Also other information is…

5
votes2
answers14521
viewsSort dictionary by Python value
I have a dictionary with the following format dic={759147': 54, '186398060': 8, '199846203': 42, '191725321': 10, '158947719': 4} would like to know if there is how to sort it by value and print on…

5
votes0
answers856
viewsHow to sort a div by a string attribute with jQuery?
I am developing a list that has the header "ID" and "Status" and its ID and Status values,I have also defined an input of type Hidden for action. Following example: <div class="cabecalho">…

5
votes2
answers200
viewsHow to create a Stopwords using R
Hi, I need to do a task and I’m not getting into a logical reasoning. My scenario is: I have a DF with several columns, I need to "read column 3", identify the words and sort. Example: DF nome rua…

4
votes3
answers144
viewsHow to play items with a specific value for the beginning of an array?
I have an array questions[] with the following properties: perguntas[0] = { id:1; ordem: 3; inicio: 1 }; perguntas[1] = { id:2; ordem: 2; inicio: 0 }; perguntas[2] = { id:3; ordem: 1; inicio: 1 }; I…

4
votes1
answer344
viewsOrganize list with more than one criterion in case of a tie
I’m using sorted to organize a list, but I need two criteria to organize it for tie cases, for this, I call sorted( ) twice. It has how to make this organization calling sorted( ) only once?…

4
votes1
answer1179
viewsjQuery Datatables numerical column sorting containing hidden HTML
Making use of jQuery Datatables, we can indicate the type of ordering sought: $('#example').dataTable( { "aoColumnDefs": [ { "sType": "numeric", "aTargets": [ 0 ] } ] }); But if HTML is present,…

4
votes4
answers7700
viewsSort a multidimensional array by a column, keeping the same lines of the array
I have an array with two columns, where in the first column I have the name of a station, and in the second I have the address of the same. I need to sort this array alphabetically by station name,…

4
votes3
answers603
viewsProblem sorting an array with Sort()
One of them occurs when I wish to order a array number. Ex: var a = [44,7,5,6,4,2,1]; a.sort(); console.log(a); The expected result would be: [1, 2, 4, 5, 6, 7, 44], but what is always returned to…

4
votes2
answers102
viewsSort method is not ordering correctly
I have the following code: #include <bits/stdc++.h> using namespace std; int main() { int n, cases = 1, a[3]; cin >> n; while(cases != n + 1) { cin >> a[0] >> a[1] >>…

4
votes2
answers1683
viewsHow to sort this php array?
I have this array: $res = array(); $res[] = array("16/08/2013", "13:32", "ROBERTO"); $res[] = array("16/08/2013", "13:16", "AMANDA"); $res[] = array("14/08/2013", "12:36", "SILMARA"); $res[] =…

4
votes1
answer4379
viewsDifference between sorting methods Selection Dort, Insertion Sort and Bubble Sort
I’m studying the discipline data structure and I’m developing C programs++. I know basically these three types of ordination (Selection Sort, Insertion Sort and Bubble Sort), but I don’t know in…
classificationasked 7 years, 10 months ago user28366 
4
votes1
answer792
viewsHow does the system of voting and rating by stars work?
I see the rating of the apps in the stores of Microsoft and Google and I can not understand the logic of both, I would like to make ratings by stars! But first I need to understand the logic of…

4
votes2
answers333
viewsCalculate minimum number of permutations to sort
I received this question in a test, and I would like to know which ways to go. I have an array of distinct n integers, A = [A0, a1, ..., an1]. I can swap any two elements of the array any number of…

4
votes1
answer560
viewsC++  Sort particular points of a rectangle in a vector?
I have a project in c++ where I should map regions of an image using the mouse click. The point is that I should get the mapping points in a specific storage order, as in the image below: my problem…

4
votes1
answer678
viewsBubblesort Complexity Calculation
I would like to know how I can demonstrate by induction calculation the complexity of the bubblesort algorithm, both in the best case and in the worst case. def bubble_Sort(alist): for numc in…

4
votes2
answers851
viewsSort items from a Collection from a preset value
I have a Collection of the Eloquent and I would like to order it through two fields at the same time being one of them a predefined value. Ex.: this one Collection has several objects of the type…

4
votes2
answers1020
viewsHow to pass an integer file to a C vector?
I have a problem when passing data from my file (integer numbers) to the vector. The purpose of the program below is to check the performance of the sorting algorithms (Mergesort, Bubble Sort,…