sorting

mergesort array of int using pointers

Hello everyone! For school I have to program a merge sort using only pointers. I've tried almost everything, but I can not get it working. #include <stdio.h> #include <stdlib.h> #include <string.h> #define num_elementi(array) (sizeof(array)/sizeof(array[0])) void selsort(int arr[],int n); void swap(int * a, int * b); void print(int a...

Sorting a text file & removing duplicates

Hi! I have a large text file with 4-digit codes and some information about them in every row. It looks something like this: 3456 information 1234 info 2222 Some ohter info I need to sort this file, so the codes are in ascending order in the file. Also, some codes appear more than once, so I need to remove duplicates. Can I do this wi...

Ignore "The" when sorting a View in Drupal

Hi ! How can I ignore "The" when the user sorts a view in a Drupal site ? ...

Merging structs with same user id and then sorting based on attributes...

I have any array of structs. Each struct in the array has the following attributes: user_id num_hot_dogs_eaten date_last_pigged_out Here's what I want to do: Find the structs with matching user_id's, and merge them into one struct record where num_hot_dogs_eaten is the sum of all matching records and date_last_pigged_out is the m...

XSLT Sorting with

I am using the Muenchian method to group data from my xml document from Marc's solution and I am trying to sort the data within each group without much success. I have tried the following, but no sorting is carried out: replaced: <xsl:value-of select="MemberLastName"/> with <xsl:apply-templates select="MemberLastName" > <xs...

How to sort Search Results based on a Field Value in Lucene-3.0.2?

Hi, I have googled a lot and also searched in stackoverflow.com about how to sort search results based on a Field Value in Lucene 3.0.2, but not found any useful data. I'm getting the search results from the index, based on the user query but not able to sort the results based on field like id or date. I have pasted my code here for se...

Sharepoint data view web part toolbar sorting default

I have a data view web part on a page which is displaying a table of data. I want to allow users to choose which column to sort by. I think the only way to do this is go into the data view properties, and enable the toolbar with sorting. This works and allows the user to select a column to sort using a dropdown list of columns. The defa...

unix sorting, with primary and secondary keys

Hi! I have the following problem: I would like to sort a file on more fields. A sample tab separated file is: a 1 1.0 b 2 0.1 c 3 0.3 a 4 0.001 c 5 0.5 a 6 0.01 b 7 0.01 a 8 0.35 b 9 2.3 c 10 0.1 c 11 1.0 b 12 3.1 a 13 2.1 And i would like to have it sorted alphabetically by field 1 (w...

Sorting an array of objects in Chrome

I just got a report that some code I wrote is breaking on Chrome. I've tracked it down to a custom method I'm using to sort an array of objects. I am really tempted to call this a bug, but I'm not sure it is. In all other browsers when you sort an array of objects, if two objects resolve to the same value their order in the updated arra...

Need help sorting list of objects by key.

I am unable to get this code to sort a list of objects using either .sort() or sorted(). What am I missing here? P.S. My solution.distance() method could use some cosmetic surgery too if anyone has any suggestions. Thanks! import random import math POPULATION_SIZE = 100 data = [[1, 565.0, 575.0], [2, 25.0, 185.0], ...

Python sorted list search

Are there any Python built-ins or widely used Python libraries to perform a search in a sorted sequence? ...

What does +0 mean after an ORDER BY in Oracle

I am trying to understand what the +0 at the end of this Oracle 9i query means: SELECT /*+ INDEX (a CODE_ZIP_CODE_IX) */ a.city, a.state, LPAD(a.code,5,0) ZipCode, b.County_Name CoName, c.Description RegDesc, d.Description RegTypeDesc FROM TBL_CODE_ZIP a, TBL_CODE_COUN...

WPF Datagrid sorting on a column bind to XML containing umbers

Hi, I am binding my WPF Datagrid to an XML source. I have a DataGridTextColumn column representing the Id of my object. When I sort on that column, it gives me for example: 1, 12, 13, 2, 3, 31, 4. I obviously would like to sort it as 1, 2, 3, 4, 12, 13, 31. Is there a way to specify that I want to sort the column based on the integer...

PHP - Sort array elements based on another array's elements :)

so I have two arrays. one of them looks like this (it's values or the number of elements can change): array('4dec' , 'def3', 'a3d6', 'd12f'); and the other: array(array('id' => 'd12f', 'name' => 'John'), array('id' => 'a5f1', 'name' => 'Kathy'), array('id' => 'def3', 'name' => 'Jane'), array('id' => 'a3d6', 'name' =...

How i can create a new ties.method with R rank() function ?

Hello guys, I'm trying to order this dataframe by population and date, so i'm using order() and rank() function : idgeoville date population 1 5 1950 500 2 8 1950 450 3 4 1950 350 4 3 1950 350 5 4 2000 650 6 5 ...

ItemsControl - Bind Control's and Backing Collection's Sort Orders Together

Hello, Is there a way to bind an ItemsControl (like ListView or DataGrid) to a sorted collection such that: whenever the collection is resorted via code, the ItemsControl automatically reflects the new sort order, AND whenever the ItemsControl is sorted, it re-sorts the collection? Thank you, Ben ...

Excel: Sort columns by row content

Hi, it's hard to describe. I have some columns, say three: 10 20 20 20 22 24 24 24 26 What I like to get is: 10 XX XX 20 20 20 XX 22 XX 24 24 24 XX XX 26 where XX is an empty cell. Is there a way to get this? Bye, Thomas ...

Sorting ArrayList of shapes

I have an ArrayList of MCommand objects (cmdList) and I want to sort it so that shapes with closest points are next to each other in the ArrayList. For example, say I have three lines in the ArrayList: line(xs, ys, zs, xe, ye, ze) cmdList[0] = line1(1.3, 2.5, 3, 4, 5, 6) cmdList[1] = line2(1, 5, 6.77, 7, 8, 2) cmdList[2] = line3(1, 6,...

Sort Div id by using Php (or by java)

Is there a fairly easy way to sort div id's with php? I tried a jquery script to sort it be it gave a big delay on the page load. Example html part (unsorted) <div id="1">Content1</div> <div id="3">Content3</div> <div id="2">Content2</div> Example html part (End result, Sorted with php or java) <div id="1">Content1</div> <div id="2"...

perl sort key then by subkey--if subkey undef set to null string

my %data ( KEY1 => { SUBKEY1 => "Canada", SUBKEY3 => "75.00", SUBKEY2 => "50.00", }, KEY3 => { SUBKEY2 => "150.00", }, KEY2 => { SUBKEY3 => "200.00", SUBKEY1 => "Mexico", }, ); How do I print a list that is sorted by Keyname and for each keyname sorted by subke...