Why does Collections.sort() creates an extra object array and performs Tim sort on the array and then finally copies the sorted array back into List object? I know this call is optimized for LinkedList, but won't we lose out on performance for ArrayList?

## Count letter frequency in word list, excluding duplicates in the same word

I'm trying to find the most frequent letter in a list of words. I'm struggling with the algorithm because I need to count the letter frequency in a word only once skipping duplicates, so I need help finding a way to count the frequency of the letters in the entire...

## How can I remove “null” elements in an array?

I am currently doing a coding challenge that states:Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below (which is an image of a QWERTY keyboard).

## Is it possible to compare two binary trees in less than O(n log n) time?

I wrote a java routine to compare 2 binary trees. I am looking for better algorithms that run in less time.

## Find all subarrays of fixed length with a given ranking

I have an array of numbers, for example:and an array that determines a rank, for example:My goal is to find all the subarrays of A that "obey" the rank B. If a subarray obeys the rank, that means that the i-th smallest element of the subarray must have B[i] as...

## Given two arrays, find the permutations that give closest distance between two arrays

Lets say I have two arrays of the same length n, named A and B.These two arrays contain real values. We define the distance between two array as the mean squared distance.

## Given (a, b) compute the maximum value of k such that a^{1/k} and b^{1/k} are whole numbers

I'm writing a program in C++ that tries to find the minimum value of k > 1 such that the kth root of a and b (which are both given) equals a whole number.

## Given (a, b) compute the minimum value of k such that a^{1/k} and b^{1/k} are whole numbers

## Filtering list under limitations

The input is List<Item> sorted by score, Item looks like:Now I need to select 10 elements which have the highest scores from the array, under these limitations:

## Algorithm for downsampling array of intervals

I have a sorted array of N intervals of different length. I am plotting these intervals with alternating colors blue/green.