Sorting Questions

sorted array in other array, but only index

I have a small problem, i have a array: int tab[] = {7,2,6,1,8,1,5,3,7,2} //index: 0-9 and its it index =

How to sort an array by keys in an ascending direction?

Here is the input i am getting from my flash file

A good reference card / cheat sheet with the basic sort algorithms in C?

I've been looking (without great luck) for the perfect reference card with all the basic sorting algos in c (or maybe in pseudo code). wikipedia

What is this sorting algorithm? And is there a more efficient way?

I wrote this algorithm while learning about o(n) algorithms, and after the last

What is this sorting algorithm?

I happened to write a simple sorting algorithm, but i am not sure what this algorithm is called. #include<stdio.h>

How does one rank an array (sort) by value? *With a twist*

I would like to sort an array in ascending order using c/c++. the outcome is an array containing element indexes. each index is

Displaying the output of a sorted array causes problem

I tried applying bubble sort algorithm to an array of values. i have 5000 values in my input, from 1 to 5000. i imported values from a text

Fastest way to "sort" bit sequence by toggling bits

Given a finite random sequence of bits, how can the minimum number of bit toggles necessary to result in a sorted sequence (i.e. any and all 0's

Best way to retrieve K largest elements from large unsorted arrays?

I recently had a coding test during an interview. i was told: there is a large unsorted array of one million

Array data structure in nodejs

I'm working on a nodejs project where i need to restructure an array of objects. below is the sample out put i get from database,

Sort with mongo and return specific objectId´s first

A structure like this: // (id´s simplified) user: {_id : objectid("4"), name: "max sampleman"} {_id :

How to sort an array in lexiographicall order

My goal is to sort the following array

what is the difference between 'sort -k1 file.txt' and 'sort -k1,1 file.txt'?

If a file contains multiple columns, seperated by comma, like this: aaa,1,4,4,5,7 bbb,1,4,9,1,2 is there

sorting lines of an enormous file.txt in java

I'm working with a very big text file (755mb). i need to sort the lines (about 1890000) and then write them back in another file. i

Create a descending list of instances of different values in a pandas dataframe

I need to filter through a pandas dataframe, and sort one of the columns, returning the number of instances of each value in descending order.

Python - How to sort date string in a Data Frame?

I have a df pandas.core.series.series such that: 0 11/8/16 1 11/8/16 2 6/12/16 3 10/11/15 4

Remove Multiple Rows from Range Satisfying Conditions

I'm pretty new to doing 'advanced' stuff in excel, so i wasn't able to figure this out myself. i'm working with the following google sheets

How can I sort a javascript array of objects that specify prerequisites between them?

I have an array of objects that determine which ones should be showed first. an example of this array would be: [ {

Sort array of objects depending on another array values Javascript

I have two arrays: first array : selectedrows= [ { "nr":"4",

How can I sort class members by name in NetBeans, or another Java IDE?

I want to sort members by name in the source code. is there any easy way to do it? i'm using netbeans, but if there is another editor

Sorting an Dataframe wtih Index in form of List

I have a pandas df that i need to sort based on a fixed order given in a list. the problem that i'm having is that the sort i'm

Combine arrays into objects depending on elements

I have two arrays, array 1 containing the sections, and array 2 containing the objects, the goal is to insert the objects from array 2 inside the

How can I make a set of numbers that increase every 30 seconds to line up in an ascending order?

If you run this javascript code below, var i = 20220215155; function increment(){ i++;

Sorted string after removing the same characters not working right

Overall the code is working except one part. the code first outputs sorted string in alphabetical order. then the repeated characters are removed

Generate a new dataset from two existings datasets with conditions

I have two dataset with the same columns, and i would like to create a new one in another sheet with all rows from the first dataset and add to it

Remove Object from Array of Object in Angular

I have this type of json and what i want, to remove the complete object of startgeotag from array of object. [{

Passing string for variable name Python

I am writing a program that can take in three numbers and three letters on seperate lines. the program will then seperate the numbers into items

Incorrect operation of the sort () method on Node v.8.1.3?

There is an array at the input ['1:nnn','1:vvv','2:zzz','1:yy','1:cc','2:xx','2:uu','2:tt','2:qq','2:aa','1:ff','1:ll','1:pp']

Laravel OrderBy in relationship data

How to order in relationship collection for the output grocery.name? it just sorts by the parent id as default now, which i'm not

I am getting error when running this loop

You are given an array of integers a. a new array b is generated by rearranging the elements of a in the

Sort a list in Python with key argument

I would like to sort a list of elements according to this statement: i>=j if(i_rank < j_rank or ((i_rank == j_rank) and

Sort nested list based on another sorted nested list python

I have a nested list in a list. in the first nested list, it has dates and in second, it has

Laravel filter and sort a collection based on conditions

I have a collection for example with these details: collect([ [ 'id'

Sort by index and column

I am trying to sort by an index and column but to no avail. partial dataset id

Tkinter window not updating till after the loop is done

I've been wanting to make a sorting algorithm visualizer using python and settled to use the tkinter library as my way of visualizing the data (if

Python - How to double sort an array of objects following a specified order of the attributes?

I have a class of this type class challenge(): difficulty = field(type=float) category = field(type=str) and

Sorting alpha-numeric li from a node

From an html page i was able to get a nodelist through queryselectorall. after that through a cycle i got the node i need to work in

SwuiftUI Custom Sorting

I'm just starting out in swuiftui so bear with me. i have a game stuct that has a field lastupdated and title. i want to have the choice to sort

Sorting Array Returns Array Out of Order

I'm so confused right now. i'e spent the last hour and a bit trying to sort directories based on their creation date. here is where i'm at:

Vue 3: Rendering the object in descending order issue

I am trying to render the data in the desc order, but vue 3 always render it in the asc order

How to get sorted dictionary from another one instead of a list

I have dict ={'deblai': [100, 1], 'blocage': [10, 4], 'beton de propreté': [50, 2]} dictionary and want to sort it based on the

Menu item not showing titles in android

I am currently adding the sorting functionality to my food app. but my app didn't show the menu items instead it shows a blank white menu.any ways

Sum javascript object value that have the same key

I am trying to add number of likes if the date is the same. from my code i have same dates but different time of the day. i want to add all likes

How to sort an array ob objects on the basis of object keys?

I have an array in following order [ { "source": 0, "target": 1, "value": 22 }, { "source": 1,

Python modifies the original variable after the function call

I am wondering if someone can explain why python modifies the original variable after assigning it to another variable and then passing the second

Python sort list of dicts

I have list of dicts and those dicts also have dict objects. this is the list:

Combine multiple unsorted text files into one sorted file using python

I have a list of text files names as a variable in python. i want to create another text file which contains all the lines of the files in the

How to make a list of Months along with Year (for eg. January 2022, February 2022) from a given Date until current month in Flutter/Dart?

I am trying to prepare a list of months with years, such as below: monthyearlist = ["december 2021", "january

Javascript - Finding distinct properties in array of objects (matrix)

Background: pre-processing code will run on a lot of data to extract the properties that needs to be shown on a chart. the chart is a parallel

Sort object array with undefined and null values

How can i sort an object array which has null and undefined values using javascript. my target is to show items that has property of "jobtitle"

sortwith one of the POJO values?

I have random pojo values, and i want to sort by one of the pojo values, the structure of the values ​​i want to sort is as follows: a-1, a-2,

laravel 6 calling post route to return to the same page for sorting table

I am trying to create a table which the user can sort i created the following two routes route::get('/manager',

How to sort Python's PrettyTable integer column correctly

We have a problem sorting a population column. the issue is that prettytable reads all data from a csv file as strings and sorts the

sort object array based on string + numeric value in JavaScript

I'm trying to sort array using a function. but when the number is going to two digit sorting is not correct. otherwise it's showing correct

Sort number array and return index js

I have an array. it looks like below: var num = [2,1,2,6,2,4]; i would like to sort but return

How to sort by date and one more parameter

Initial array var array = [ { "name": "service-1", "status": "cancelled", "startdate": "2020-04-02t00:00:00",

Convert sequence of Array in own sequence

Convert array of list into my own order current output: [ { "key": "dg power output", "value": "6.00", "unit": "kwh",

How to partially sort list of dictionary by dictionary value in Python

I want to sort dictionary by 'filename' if type ==1. for other items, don't touch them during sorting. my_list = [ {'fact9':

List sorting, if integers are same that related strings should be in alphabetical order and the interger values should be ascending order

The dart list should be sorted alphabetical based on the same integer value inside the element object. if the integer has same values those

How to sort distance in ascending order from latitude and longitude

Here i downloaded data of places from a server via script, now i want to sort the list of place in ascending order of distance using

Note able to sort data in ascending/descending based on key of object in angular /typescript

I am new to angular and trying to make an covid 19 app in angular where i have two components, state component and

Sorting Algorithm output at end of pass 3

Given the following initially unsorted list: [77, 101, 40, 43, 81, 129, 85, 144] which sorting algorithm produces the

Sort strings in pandas

I have a data frame in pandas and i want to sort it by column. if i use .sort_values() like in the below code:

In Flutter how can I sort integer values stored in strings

I have the numbers like listdata=[1.69k,1.32k,1.25k,1.23k,2,45,34] i want output like

Sort and return difference in an array task, returning Undefined

The function needs to take an unsorted array(ages) as it's parameter, then return an array of: smallest number, largest number, difference between

Compare Dictionary values of another Dictionary KEYS

Roles_dict1 = {'ceo':1,'cto':2,'devops':3} user_list = {'jhon':'ceo','matew':'devops','bill':'cto'} for key in roles_dict1.keys:

Issue with shared sorting function in javascript

I have a list of users with properties and i want to output a best list according to each propertly. when i comment out "nrgames":

Randomly split sorted array into smaller sorted arrays

I have a big sorted array of unique numbers. i do want to split it into n smaller disjoint sorted

Sort Firebase Data from AsyncSnapshot<QuerySnapshot<Object?>> with Dart .sort() Function

I am having trouble sorting data after a firebase query. in my database, there is a collection of bikes, and each bike has a

Laravel datatable sorting issue

I'm using laravel - data tables by yajra

How to sort a List of items based on dateTime in Flutter | Flutter

I have list of products with product name and date. i want to sort that list of items based on date and time. this is the list of items that i

Compare two Dictionary Key Values

Roles_dict1 = {'ceo':1,'cto':2,'devops':3} user_list = {'jhon':'ceo','matew':'devops','bill':'cto'} for key in roles_dict1.keys():

Sorting over an object passing the search value via a callback results in undefined

i have multiple 'sort options' that id like to pass to make this function re-usable, but all passed strings result in undefined when

Laravel Eloquent, sort whereHas / width datas

Here my code : list(\$orderby, \$orderdirection) = explode('.', request()->get('sort_by')); \$prestations =

python re-arrange elements in a list based on the sublist values

I have have a list of lists that i would like to re-arrange based on the values of its sublist. list = [["c","d"], ["b", "c"],

JQuery sorting li by only first div inside

Try to make a sort by using jquery sort. i would like to sort this li's by first div content(in my example, sort by aaa, bbb, ccc and ddd

Sorting an array in a custom fashion?

The goal of this code is to sort this array [1,2,3,4,5] to look like this [5,3,1,2,4]. i also want it to sort arrays that someone else sends me,

Error in merging sorted linked lists to one sorted linked list in python

I have the following code. i create 2 linked lists (l1 and l2) and i would like to combine them together to one sorted

JavaScript array sorts itself

I'm trying to write a bubble sort animation - for that i want to put all the iteration in the separate array and then reproduce them. but the

Find and validate immediate neighbors of the given source node of a 2D matrix?

I am working on a javascript project for the pathfinding visualiser where i am having difficulty in finding and validating the immediate

Array sort with mixed alphabetical and numerical content not working in Firefox

I have a javascript array called years with some dates and one textual item like so: [ "2017", "2018", "2019", "historic"

Why is my sort function sorting a different array I did not ask for?

I want to copy an array and sort it. however, when i copy the array and sort it, it seems to sort both arrays. does anyone know why this is?

CouchDB query no index exists for this sort error

I have seen already this question a lot of times, yet here i am asking same question. why do i get this error: error running

Get the first three largest values of a 2dnumpy array in python

Hi i have a numpy array for eg. arr = np.random.rand(4,5) array([[0.70733982, 0.1770464 , 0.55588376, 0.8810145 , 0.43711158],

Pandas python relative questions instead of sorting

I have a question on how i can implement this type of functionality in pandas. i have the following fields

Python: Sort a large list that doesn't fit in memory

I have a decently sized .tsv file containing documents in the following format id doctype normalizedname

Creating a crude bogo_sort using Python 3.7's asynchronous for-loop

Basically i wrote the following short code sample. i'm imaging that i could "try out" python's simple "async for" loop...

Filter an array of repeated objects and get the sum of them

So i have the next information, what i want to achieve is filter the array of objects and sum the qty of the objects repeated

Bad performance of sorting algorithms implemented

I have implemented some sorting algorithms including insertion, selection, shell, two kinds of merge. i found that the performance of my

Sort 2D list in flutter depending on 3rd element of each list

I am trying to sort a 2d list depending on user requirement like [i][1] or [i][2]. to achieve this i first convert the list to a map and then add

pandas dataframe sort columns according to column totals

I was able to sort rows according to the last column. however, i also have a row at the bottom of the dataframe which has the totals of each

Sorting an array of objects on both ascending and descending order on same click

I have an array of objects: var arr = [{ title: "finance", book: "book1" }, { title: "nature", book: "book2" }, { title:

JQuery DataTable Date Order

I have two problems. in my table, there is a created date column and i am soring by this date. unfortunately it sorts as string, instead

Sorting array of object with multiple values

I have this array: var array = [{

Efficient Human-Readable Date String Sorting Algorithm in Javascript

I'm trying to sort thousands of date strings from my database in my react table. the component that i'm using allows users to sort information by

Flutter Filter List base on Month

How i can categorise list based on month let say i have example list like below : record( id: '01', namefood:

QuickSort algorithm failed with stackoverflow error

I tried to implement quicksort algorithm from thomas h. cormen, charles e. leiserson, ronald l. rivest, clifford stein - introduction to

How to sort data in graphQl with apollo server?

I use apollo-server to write a graphql code. before send data i want to do some sort on data based on optional fields and filters, and i need to