How to sort a batch of 2D tensors in tensorflow?

I have a tensor A with the shape of [#batch, #MaxSequence, #Features], where the actual lengths of the 2nd dimension (may be less than #MaxSequence) are stored in a tensor L. I want to sort A by the 2nd feature in the 3rd dimension on the sequence in...
more »

2017-10-04 20:10 (1) Answers

How to Sort array alphabetical and by strlen

I am looking for the cleanest ways to sort array alphabetically and by strlen in PHP. The cleanest way i came up with to sort by strlen is this: array_multisort(array_map('strlen', $array), $array); How would i extend this to sort alphabetically b...
more »

2017-10-04 18:10 (1) Answers

Array merging and sorting complexity calculation

I have one exercise from my algorithm text book and I am not really sure about the solution. I need to explain why this solution: function array_merge_sorted(array $foo, array $bar) { $baz = array_merge($foo, $bar); $baz = array_unique($baz); ...
more »

2017-10-04 16:10 (1) Answers

Sort Class List by specific Variable

I have a list of classes, which contains a string. The string I want to use to order the list by, looks like this: "A1534-11" I would like to order them by the 4 numbers after the letter. The basic OrderBy method just sorts it by the letter. How can...
more »

2017-10-04 14:10 (2) Answers

Java 8 - Sort list of integers with nulls

Lets say you have a list of integers containing null vaues List<Integer> integers = Arrays.asList(null, 9, 11, 7, 5, null); Now if you want to get max value, you can try OptionalInt max = .mapToInt(Integer::valueO...
more »

2017-10-04 11:10 (3) Answers

How to set the list by alphanumerical order?

I have a folder containing 10 subfolders with the following naming : Folder1,Folder2,Folder3,... i want to manipulate them by that order however when i apply lst = os.listdir(dirname) lst.sort() the output is the following : Folder1 Folder10 Fo...
more »

2017-10-04 10:10 (1) Answers

foreach loop where order needs to be specific

I am trying to go through an array of shipping methods, and then set them in a table as an option. The problem is that my shipping methods are scrambled, and we don't want to rearrange it in our database. That means I need to go through all elements,...
more »

2017-10-03 15:10 (2) Answers

Item date sorting from API JSON in angular

I've generated some news items from a laravel API output, i display these on a angular 4 cli project. I noticed the items aren't on descending order though and I'm trying to fix this on the client side. Check it out, this is what I've got. This is m...
more »

2017-10-03 11:10 (4) Answers

How to sort LDAP Result with LDAP filter?

I'm creating a LDAP directory search using PHP. I'm able to successfully search and return results. I want to be able to sort results according to hierarchy. Now I have: ou=HR,ou=Employees,ou=People,dc=instatsport,dc=com ou=IT,ou=Employees,o...
more »

2017-10-02 20:10 (2) Answers

Extracting k largest elements

If I have n integers, is it possible to list the k largest elements out of the n values in O(k+logn) time? The closest I've gotten is constructing a max heap and extracting the maximum k times, which takes O(klogn) time. Also thinking about using ino...
more »

2017-10-02 18:10 (3) Answers

Using Menu Buttons to modify LINQ search terms

In VBS 2015, I have created a form that uses a LINQ query to import a CSV file of names, locations, ages, ect., sorted using a unique record. The data is input into a Data Grid and then may be filtered and sorted by the selection of buttons from the ...
more »

2017-10-02 18:10 (1) Answers

Storing XML with no Unique field.

i have a big xml file that i want to sort but i'm a little rusty on how to handle this case. I have a big xml file with about 40k rows but this xml file has no unique element that i can use to sort after. Is it possible to order by 2 elements so to...
more »

2017-10-02 17:10 (1) Answers

JavaScript Sort by Date on table not working

Hi I cannot get sort function working on date. It changes order of the rows but it doesn't sort properly and dates are all over the place. I would like upcoming events to future events. See my code below. $('tr.Entries').sort(function(a,b){ ...
more »

2017-10-02 07:10 (2) Answers

Java: Find String with the highest value

I need to accept a string as input, split it into an array of individual words ( split on " ") and return the highest scoring word as a string. Each letter of a word scores points according to it's position in the alphabet: a = 1, b = 2, c = 3 etc. I...
more »

2017-10-02 05:10 (5) Answers

3-way Merge Sort C program

I have trying to "upgrade" my normal merge sort for a school project. But my new code seems to not coorporate as it should so i have a MergeSort3way function that splits the Array inputed in 3 subArrays then it call itself till the sort is finished ...
more »

2017-10-01 17:10 (2) Answers

Heap sort is not used in C++ library

Since heap sort has time complexity of O(nlogn) in all scenarios i.e. best case,average case and worst case. While quick sort has time complexity of O(n2) in worst case. Then despite having less complexity in worst case, why heap sort is not impleme...
more »

2017-10-01 16:10 (2) Answers

Having trouble with bubble sort Java

I'm try realize bubble sort and it's doesn't work! Help me find a problem. Code: public class Main { public static int e=0; public static int arraylength; public static int[] array = new int[10]; public static void main(String[] ...
more »

2017-10-01 15:10 (3) Answers