Merge two sorted linked lists in java

I need to merge two sorted linked list into one sorted list. I've been trying to do so for hours, but when I reach the end of one of the list I always have some trouble. This is the best I could do. My filaA and filaB are liked lists of data type "lo...
more »

2017-03-19 17:03 (2) Answers

Editing a table field used for sorting

I have a table of entities like <tr ng-repeat="e in entities"> <td ng-repeat="c in columns" ng-switch="e.type"> <span ng-switch-when="text" ng-model="e[c.name]"></span> <input ng-switch-when="input" n...
more »

2017-03-19 12:03 (1) Answers

C++ RadixSort efficient ways

I am trying to implement the Radix Sort algorithm in C++ trying to sort an int array. As far as I see, there are two possible ways: Sort by binary digits, e.g. get bit after bit using bitwise operators and sorting them in 2 buckets (0 and 1). Sort...
more »

2017-03-19 10:03 (1) Answers

Sorting a list of dates by chronological order?

My program takes a list of dates in the format of (month day year). It then sorts it in chronological order of most recent events.It should sort the years from 90 to 99, and then from 00 to 12. For example it should sort this list. January 1 01 ...
more »

2017-03-19 02:03 (2) Answers

Qsort and Comparators weird behaviour. C

So, I am using qsort in my C program from C library. It works as expected so I decided to play around with comparators. Comparator 1 (I use this): int compare (const void * a, const void * b) { if (*(double*)a > *(double*)b) return 1; else ...
more »

2017-03-18 23:03 (1) Answers

Sorting an array based on calculated values

For a recent java coding test I had a question similar to the following: A function receives a string of comma separated values. Add the digits of each number contained to create a single value for that number. Order these in ascending order Return ...
more »

2017-03-18 22:03 (1) Answers

Middleman tag sort case insensitive

In Middleman static site generator, sorting the tags array is case sensitive. Capital letters are sorted before lower case, as in: "A, B, C, a, b, c" when using the code: <% blog.tags.sort.each do |tag, articles| %> <% end %> It seems...
more »

2017-03-18 20:03 (2) Answers

Comparing two selection sort methods

This question is similar to (link) but not exactly what I am looking for. Here is a selection sort I wrote below, it's in Java. public void sort() { int smallIndex; for(int i = 0; i < arr.length; i++) { smallIndex = i; ...
more »

2017-03-18 19:03 (2) Answers

Maximum concurrent meetings given participant list

The Problem Following our team check-in, we break off in to co-ordination meetings with (n) participants covering various (uniquely named) Topics. Currently, people stand around trying to self organize and we are not maximizing concurrency of meeti...
more »

2017-03-18 15:03 (1) Answers

PagingPredicate issues with comparator

PagingPredicate when applied on IMap not sorting on the complete collection. It is only sorting for the given pageSize. But I want the collection to be sorted first and then apply the paging and provide the result. I use below constructor: PagingPr...
more »

2017-03-17 18:03 (1) Answers

Array sorting in matlab

Hi i have a 289x2 array that i want to sort in MatLab. I want to sort the first column into numerical ascending order. However I want to keep the second column entry that is associated with it. Best way to explain is through an example. x = 76 1 ...
more »

2017-03-17 13:03 (1) Answers

Python: sort specific elements in a list

I have a list of elements I want to sort, but I don't want to sort all of them, only those with a particular state. For example, let's say I have a list of peole: lst = [Mary, John, Anna, Peter, Laura, Lisa, Steve] Some of them have a job, let's s...
more »

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

How to sort a List of ArrayLists (not arrays)?

I have an adjacency list implemented using a List[] of ArrayLists. I want to sort the List in descending order of the size of the ArrayLists. I figured I would do this by writing a Comparator... But how would I do this? or is this just not possible a...
more »

2017-03-16 22:03 (1) Answers

How to sort an NSArray with nested NSArray

I have an instance of NSArray with instances of NSArray inside. The inner arrays contain only instances of NSString. I need to sort the nested arrays alphabetically by a selected index. E.g. @[ @[@"test",@"B",@"test2"], @[@"bla",@"A",@"bla"], ...
more »

2017-03-16 21:03 (1) Answers