» Home » sorted » Page 1
how to create recursive merge of 2 sorted lists resulting in sorted merged list
by ertuzio in Programming Languages

I am learning about recursion I am trying to return a sorted list by merging 2 sorted lists and am getting lost Please help. I know this is incorrect already Any constructive help would be appreciated Thanks

public static ArrayList<Integer> mergeMyList(ArrayList<Integer> list1,
ArrayList<Integer> list2)

Java Code Review: Merge sorted lists into a single sorted list
by Copter in Programming Languages

I want to merge sorted lists into a single list. How is this solution? I believe it runs in O(n) time. Any glaring flaws, inefficiencies, or stylistic issues?

I don't really like the idiom of setting a flag for "this is the first iteration" and using it to make sure "lowest" has a default value. Is there a better way around that?

public static <T extends Comparable

Improving performance of merging lots of sorted maps into one sorted map - java
by Matt Watson in Java

I have a method that gets a SortedMap as input, this map holds many SortedMap objects, the output of this method should be one SortedMap containing all elements of the maps held in the input map. the method looks like this:

private SortedMap mergeSamples(SortedMap map){
SortedMap mergedMap = new TreeMap();
Iterator sampleIt = map.values().iterator();

Keeping a sorted list of elements, sorted by an attribute external to that element
by Nate-X in Programming Languages

I have a "manager" class maintaining a list of objects. Each Object has a certain "position", but this is not known to them, only the manager knows about this. The manager must assign each Object a position and maintain its list of Objects sorted according to this "external attribute".

Note that an Object's position can change at any time. Ideally I should be able to immediately get

Python: Sorted representation of dict of lists, sorted by number of elements in list, after removing duplicates
by Tim Watson in Coding

I have a dictionary that looks like this:

example_dict = {
0: [(1,2),(3,4),(3,4),(4,5)],
1: [(1,2),(3,4),(5,6),(7,8)],
2: [(4,5),(7,8)]}

I would like to get a sorted representation of this dictionary by number of elements in each list after 'temporarily' removing duplicates (only for the purpose of sorting, I don't want

How to determine if one or more column in a large text file is sorted or not sorted
by Pottuvoi in Programming Languages

I have greater than 1GB big text file. The file has 4 columns delimited by TAB.

Col1: Guid
Col2: Date-time (yy-mm-yyyy 0000000000)
Col3: String
Col4: String

I want to determine if one or more of its column are sorted or not sorted.

Is there any quick way to do that? Maybe using Perl or some unix command? Or anything similar?

inserting element to a sorted vector and keeping elements sorted
by yhelothar in Programming Languages

So I have a vector, and I want the elements to be sorted at all times. How should I go about inserting an element into that vector and keeping the elements sorted when I pop them out. I looked into std::lower_bound, however, that gave the opposite of what I wanted.

For example, this is what I want: When I pop all the elements in the vector it should be:
1 2 3 4 5. That means t

Fast in-place partitioning of sorted array into two sorted subarrays
by deanschang in Programming Languages

Edit - I removed all unnecessary context explanation - too wordy and ultimately irrelevant to the problem. In summary I'm partitioning arrays of coordinates during the process of building a balanced KD Tree (see wikipedia article, Construction section for more. I actually have k parallel arrays of n items that each have to be partitioned by the same comparison)

This is not homewor

efficient sorted Cartesian product of 2 sorted array of integers
by atomicstack in Development Tools & Services

Need Hints to design an efficient algorithm that takes the following input and spits out the following output.

Input: two sorted arrays of integers A and B, each of length n

Output: One sorted array that consists of Cartesian product of arrays A and B.

For Example:
A is 1, 3, 5
B is 4, 8, 10
here n is 3.
4, 8,

Printing a sorted treemap(sorted based on values)
by dlouzan in Programming Languages

I have a sorted a TreeMap based on values, and it's printed as shown:


But it seems like the words with same values are being printed in the reverse sorted order:

"abortion, able, ab, aaro

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .