Skip to main content

Questions tagged [sorting]

Sorting is the process of applying some order to a collection of items.

sorting
Filter by
Sorted by
Tagged with
0 votes
1 answer
22 views

Laravel : sorting filter brands doesn't works but error points to an other function (which works)

I am trying to display my categories and brands when I click on them (a screen if needed). Categories work, but not brands. When I click on a brand, I get the error "Call to a member function ...
lara's user avatar
  • 19
1 vote
1 answer
32 views

Wrong Values being extracted when parsing a input file in TCL

I have an input file in the format https://regex101.com/r/4VAKoQ/1 I have written TCL code to extract some values from Other End Path section such that it should be be outputted in the following ...
user2643899's user avatar
0 votes
1 answer
17 views

Laravel my sorting filter doesn't work but i have no error or no messages

//my route Route::get('catalogue/{categorie?}','App\Http\Controllers\CatalogueController@index')->name('catalogue'); //my function function index($categorie = null ) { if($categorie) ...
lara's user avatar
  • 19
-2 votes
0 answers
23 views

Merge sort algorithms sort [closed]

Describe merge sort algorithm by natural language and pseudocode? Beside, It has some variants or improvements for job? I don't find solution. Here my pseudocode: function MERGESORT(ARRAY, START, END) ...
Quốc Duy Nguyễn Trần's user avatar
-3 votes
0 answers
56 views

I'm trying to implement the Dutch National Flag algorithm in Java [closed]

The goal is to sort the array so that all 0s come first, followed by all 1s, and then all 2s. enter image description here I'm trying to solve a special case of the Dutch National Flag 🇳🇱 problem in ...
Ananya Aggarwal's user avatar
-3 votes
0 answers
37 views

Unzip, extract specific files, sort into categories, change the format to .csv extension, in Python [closed]

I have this code which should identify all zip folders in the zip directory and extract all zip files into extract directory. All the zip files have a lot of files. I need a specific four from each ...
Na.Az's user avatar
  • 5
1 vote
1 answer
32 views

Arranging bars in ggplot

I'm trying to make a bar plot showing expenses and revenues for 7 countries, and I want to order them by their expenses. The problem is that ggplot orders it by the revenue, and I don't know how to ...
Henning Åsheim's user avatar
2 votes
1 answer
60 views

Adjacent items in Quicksort's output: Does the algorithm guarantee they have been directly compared?

Is the direct comparison of adjacent items in the output array guaranteed by the Quicksort algorithm ? In other words: During the course of the sorting, the Quicksort algorithm makes (k-2)2^k+2 ...
George Robinson's user avatar
0 votes
1 answer
43 views

SORT to merge two files and append data without changing lrecl

I have two files with the same layout and LRECL FIELD NAME FIELD LENGTH STORE-CUSTOM-ID X(08) STORE-GROUP X(25) STORE-LIST 9(04) OCCURS 500 TIMES I want to Merge these ...
Aarthi M's user avatar
-1 votes
1 answer
44 views

Sorting a object's properties after reducing

I am recreating the effects of an outlook mailbox by grouping a list of outlook emails by their conversation id. However, I need to sort my list twice such that the emails in each group are ordered ...
Qiuzman's user avatar
  • 1,423
0 votes
1 answer
37 views

Most efficient way to get the minimum and maximum values of the primary key of a Mongo collection

I am thinking the most performant way for collection myColl would be: db.myColl.find().sort( {_id : 1 }).limit( 1 ); // get min db.myColl.find().sort( {_id : -1 }).limit( 1 ); // get max Is there ...
Markus's user avatar
  • 1,102
0 votes
1 answer
75 views

C# sorted get different result from ORDER BY in SQL Server

I need to replicate the exact order produced by another program that used the ORDER BY clause in its SQL query: SELECT Name FROM TABLE_NAME ORDER BY Name Result: To reproduce the order on my side, ...
user23787413's user avatar
0 votes
0 answers
63 views

Find top k nodes based on values in an array - C [closed]

I'm looking for the most efficient implementation choice to select the top k nodes with the highest values from an array of size N, which could potentially be very large due to containing PageRank ...
Maria Ferri's user avatar
2 votes
2 answers
35 views

Merge Dataframe based on substring column labeld while keep the original columns label

I have a dataframe having columns with the a label pattern (name/startDateTime/endDateTime) import pandas as pd pd.DataFrame({ "[RATE] BOJ presser/2024-03-19T07:30:00Z/2024-03-19T10:30:00Z&...
Crovish's user avatar
  • 213
-1 votes
0 answers
17 views

Jelaskan saya kode ini secara detail dan mendalam dengan jelas [closed]

def bubbleSort (alist) : for passnum in range (len (alist)-1,0,-1): for i in range (passnum) : if alist[i]>alist[i+1]: temp = alist[i] alist[i] = alist[i+1] alist [i+1] = temp alist = [56,27,28,34,...
user25887265's user avatar
1 vote
1 answer
35 views

Shell Sort not Swapping Elements Correctly

I've been struggling with an issue in my Shell sort implementation for several days now. Specifically, I'm using gaps of 5, 3, and 1 for successive passes, but I'm encountering problems where elements ...
ROS_KIE's user avatar
  • 13
1 vote
0 answers
41 views

How to correctly measure time complexity of sorting algorithms (Python)

I am trying to capture the wall clock time, CPU time, and complexity of quick, selection, and bubble sorts, but I don't think that my timing outputs at the bottom are correct/plausible. Is there ...
buddy's user avatar
  • 11
0 votes
1 answer
56 views

Efficient Merge sort implementation in python

def merge(arr, l, m, r): merged_arr = [] i, j = 0, 0 while (i < len(arr[l:m])) and (j < len(arr[m:r+1])): if arr[l+i] < arr[m+j]: merged_arr.append(arr[l+i]) ...
Gerry's user avatar
  • 626
0 votes
0 answers
39 views

SSIS flat file destination sort order

This is an SSIS 2017 issue using a Flat File Destination. We pull the data from an OLD DB Source, run the column through a Sort Transformation and send the result to a Flat File Destination. In all my ...
TimC's user avatar
  • 1
0 votes
1 answer
31 views

<solved> DataGridView linked to a BindingList : sorting rows not working

I am a beginner. I am developing a program in C# with Visual Studio and Forms. My Form has a DataGridView linked to a BindingList. I would like to be able to sort rows by clicking a column header. I ...
Chandernagor's user avatar
-1 votes
2 answers
70 views

appending string to txt file only appends first letter python

with open("words_alpha.txt", 'r') as f: your_result = [line.split(',') for line in f.read().splitlines()] for i in your_result: for word in i: x = len(word) print(word) if x ...
Soapy's user avatar
  • 29
0 votes
2 answers
51 views

Sorting a HTML table

I have a HTML table that contains several columns. I've found a JS w3school snippet to sort this table. I've slightly modified this script to be able to sort also by a column that contains only a ...
f.soucy's user avatar
  • 13
0 votes
0 answers
10 views

Return a Sorted/Ordered nested collection property with JPA Data/Query

I understand I can create a ChildRepository method to return a List<Child> with OrderBy and I can order this by a nested Child property. However, when this List<Child> property belongs to ...
abdlost's user avatar
  • 11
1 vote
0 answers
16 views

How do I arrange a stacked bar chart in r ggplot2 based on one of the variables being stacked? [duplicate]

I am very new to coding and trying to learn the ways of ggplot2. I am stuck on trying to arrange my stacked bar chart by highest to lowest for one of the variables that is being stacked, so there is a ...
amy's user avatar
  • 11
-1 votes
1 answer
44 views

I wrote a query to make both column as descending order but it's applying for only 1st column [closed]

It's not applying for 2nd column that I mentioned, it's only applying for 1st column not for 2nd one SELECT SupplierID, CompanyName, City, Country FROM Suppliers ORDER BY Country DESC, City DESC; I ...
Sushmi Singh's user avatar
0 votes
1 answer
73 views

How can I find the median of two sorted arrays in O(log(m+n)) complexity

I copy the length of two initial arrays and then merge them into a third array and the length of the third array is equal to the length of initial two arrays added together. Then I try to find the ...
Fazeel Ayaz's user avatar
2 votes
2 answers
96 views

Is there a way to search an array of arrays for matching properties and if they match, make sure they aren't in adjacent positions?

I have been wracking my brain for a week on this problem and would appreciate any help or suggestions. I have a form that collects the users first name, last name and song. It stores those values in ...
Steven Wimer's user avatar
-1 votes
1 answer
37 views

How to write values into empty array from a loop dedicated to another function in Javascript?

I am doing a random sort of values according to the Fisher Yates method, and to explore the inside of this process I tried to out the random numbers (arsam1 is the number fixed set, iValue1 and ...
Adam Givon's user avatar
0 votes
2 answers
60 views

function for sorting contours of a Sudoku, top to botton and left to right?

i am trying to get a sorting of the contours found in this image: Box Result: Temporaly the contours are found like this: img_bw=cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) (thresh, im_bw) = cv2....
kami's user avatar
  • 3
-2 votes
0 answers
36 views

I try to implement a sort algorithm.... for studying. but I've reached end of my wits [closed]

I really want to become an advanced developer, so I was doing it like a bad guy... What I really feel like I can't do alone right now is merge sort. As for recursion, it's all messed up now and I've ...
Noel's user avatar
  • 1
0 votes
0 answers
18 views

MUI DataGrid sortComparator function signature in typescript

I am using MUI DataGrid ("@mui/x-data-grid"). I am looking to custom sort a column based on other column's values. const columns: GridColDef<Location>[] = [ { field: "siteNo&...
Deepak's user avatar
  • 1,068
0 votes
1 answer
53 views

How to sort the Eigen::Matrix that have std::pair<int, int> and delete the duplicates of indices

I need a way to sort and delete the duplicates of row and column indices of a sparse matrix. But at first I need to sort indices and later find a method to delete the duplicates. Eigen::Matrix<std::...
jomegaA's user avatar
  • 133
-2 votes
0 answers
56 views

Why new lines are added after sort in perl when getting max and min GLIBCXX/GLIBC/CXXABI versions [closed]

When I used this to get max versions, and it is OK: perl -0777nE'%h;$h{$1}.="\n".$2while/(GLIBCX*|CX*ABI)_([0-9.]+)/g;say$ARGV;print"\t$_\t".qx{echo "$h{$_}"|sort -V|tail ...
samm's user avatar
  • 706
0 votes
0 answers
44 views

Ordering 100 random points into a 10x10 grid [closed]

I have a set of 100 random points on an xy plane. I am looking for an algorithm that takes those points and orders them into a 10x10 grid. Ideally, this would work similar to how fluids fill in a ...
Spiralio's user avatar
  • 391
0 votes
1 answer
46 views

RegExtract a value from a comma-separated string

I have a Google Sheet located here: https://docs.google.com/spreadsheets/d/1s7tzyz9A9caaJGbiWPm1CDNBxmnv0Xrh3lb5yj9CDOk/ The first tab simply collects information from a Google Form. Enter your name (...
5Reaper5's user avatar
1 vote
1 answer
35 views

Where is stored the order from WooCommerce product category terms?

I am trying to understand where the display order of product categories defined by the admin is stored in the database. I intend to use this field in an SQL query to retrieve and display product ...
Manuel Gabrielli's user avatar
1 vote
2 answers
44 views

rearrange columns in dataframe depending on sorting output

I have the following data frame: df = pd.DataFrame( { 'a':[1,2,3,4,5,6], 'b':[1,1,3,3,5,5], 'c':[1,2,3,4,5,6], 'd':[1,1,1,1,1,5], } ) In [1051]:...
Lucas Aimaretto's user avatar
-1 votes
0 answers
32 views

Sorting Groups by the Order they are in Excel

I basically want my before_X.groupy and after_X.groupby groups to be sorted by which ever str[:3] comes first in the excel sheet according to the row. Right now the groups that are further down are ...
Nyanga's user avatar
  • 1
-3 votes
3 answers
92 views

custom comparitor for integers in string vector

I want to sort a vector of strings representing very large (10**6 digits) in ascending order in C++. I am trying to use a custom comparitor, but the sort is failing when comparing numbers of the same ...
YWH's user avatar
  • 23
2 votes
1 answer
57 views

Sorting the data in mongodb

I have a field in mongodb called propertyRating the values are 5.0/4.0/3.0/SC. I want to sort the data based on propertyRating, first 5 star then 4 star,3 star and in last SC. Is there any way to sort ...
Mamta Malvi's user avatar
2 votes
3 answers
71 views

How to performantly self-join same table multiple times with ascending and descending sort order?

Data Definition I have a status table like so, attributes not relevant to the question are omitted: id created value 1 2024-06-24T13:01:00 error 2 2024-06-24T13:02:00 ok 3 2024-06-24T13:03:00 ...
user1931751's user avatar
-1 votes
2 answers
75 views

char *array[200] sorting program doesn't read words

The program is expected to sort and display a list of words from a array whose elements are pointers to char. I use malloc to alocate space to each element and use a read_line function to store in the ...
Pepe Cuesta's user avatar
-2 votes
0 answers
43 views

Sorting the list of dictionaries [duplicate]

s = [ { "requisites": { "partyId": "722725f9-0b34-4835-93cf-fa3d588dbc13", "organizationId": "45ba6290-d4da-431e-bfd5-...
misantro0p's user avatar
0 votes
0 answers
41 views

Is there a full implementation of Lexorank including the use of buckets and rebalencing

So I have been looking into what is the best (most efficient) way to store an users ordering (ranking) and I have come across Lexorank. (This is purely research. I understand that Lexorank should not ...
Ilyes512's user avatar
  • 2,707
0 votes
2 answers
44 views

what is the most efficient way to gather all points at a certain height?

I have a List[List[int]] that represents points [x,y] points = [[1,2],[1,3],[2,1],[2,3]] What is the most efficient way to gather-up all the points with a specific height ? So if we want all points ...
BaltoStar's user avatar
  • 8,687
1 vote
1 answer
59 views

How to properly sort a nested dictionary by keys in Python3, where we take in account numbers from key strings

Assuming a dictionary that looks like this, where we have a string with some number for the key (not necessarily in any order, nor is it guaranteed that it would be in a continues sequence, and the ...
user25681348's user avatar
0 votes
1 answer
78 views

Python array sorting price incorrectly

I have made an array with a description and price but can't seem to get the sortign to sort by price. Can someone assist or guide me on why this isn't sorting by price correctly? I have checked the ...
Slippy's user avatar
  • 69
-2 votes
3 answers
103 views

Flatten a large array into a matrix

I've looked through a number of posts with similar titles but none seem to help me out with this code. I have a very large array (1200 rows, 48 columns, 6 slices). I'd like to flatten it into a matrix....
JDK's user avatar
  • 21
-2 votes
0 answers
62 views

Swift array sorting (with unknown comparisons managed) [closed]

I try to find a way to sort an array in swift, where elements are not all comparable together (only some of them). There is a simple syntax with: myArray.sort(by: { ... (return true or false) }) ...
Guillaume PELOUAS's user avatar
3 votes
3 answers
157 views

How to sort a data frame (in R base) by all columns, without knowing all the columns beforehand

I have a data frame with a number of fixed columns, followed by a variable number of columns, depending on the input. dd <- data.frame(key1=c("NED", "LTU", "LAT", &...
clp's user avatar
  • 1,410

1
2 3 4 5
1543