3
votes
2answers
205 views

All possible pairs of two items

I have 4 different items {1, 2, 3, 4}. I want to obtain all possible pairs of two of the items. I have written: ...
8
votes
8answers
661 views

Replace interior of matrix with zeros

I have f.e. the following square matrix: ...
0
votes
1answer
124 views

Generate encoding from nested list

Taking reference of Huffman code algorithm, ...
1
vote
4answers
208 views

Calculating the median difference between elements with a (particular pair) of consecutive integer indices residing in the same sublist

NOTE: I formally made a serious mistake in the first example provided. pointLists[[1]] had an extra element, and we should have a guarantee that ...
15
votes
3answers
516 views

How to partition a list to make each subset's size equal and mean as close as possible

Suppose we have 3 lists each with 18 numbers like this: ...
17
votes
1answer
337 views

Underlying Algorithms for List Manipulation Functions

Does anyone know, or know of a link for the underlying algorithms used for list manipulation functions? Specifically: Union with and without the ...
7
votes
2answers
343 views

Finding all points of period n in an iterated map

I'm trying to implement an algorithm of Jenkinson and Pollicott to calculate the Hausdorff dimension of a Julia set for the map $f_c : z\mapsto z^2 + c$. It's described on page 40 of their paper, ...
18
votes
11answers
983 views

Generating an ordered list of pairs of elements from ordered lists

I have a pair of ordered lists. I want to generate a new ordered list (using the same ordering) of length n by applying a binary operator to pairs of elements, one from each list, along with the index ...
7
votes
2answers
324 views

find subsequences of constant increase

A list like l = {0, 1, 2, 3, 4, 5, 7, 9, 12, 13, 18, 19} may have subsequences of constant increase, $a_{n+1} = a_n + k$. For example: ...
11
votes
2answers
1k views

Simple algorithm to find cycles in edge list

I have the edge list of an undirected graph which consists of disjoint "cycles" only. Example: {{1, 2}, {2, 3}, {3, 4}, {4, 1}, {5, 6}, {6, 7}, {7, 5}} Each ...
12
votes
5answers
2k views

Finding all elements within a certain range in a sorted list

Suppose we have a sorted list of values. Let's use list = Sort@RandomReal[1, 1000000]; for this example. I need a fast function ...