Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 9025

Informally, an algorithm is a set of explicit instructions used to solve a problem (e.g. Euclid's algorithm for computing the greatest common divisor of two integers). For more specific questions on algorithms, this tag may be used in conjunction with the approximation-algorithms, algorithmic-randomness and algorithmic-topology tags.

6 votes
Accepted

Algorithm to find if an element X can be represented with the sum of one number of each subs...

First sort $S_2$ and $S_3$. Divide into $n$ subproblems: for each $a\in S_1$, look for $b\in S_2,c\in S_3$ such that $b+c=X-a$. Let's do one such subproblem in $O(n)$ time. Let $b_j$ be the $j$-th …
Brendan McKay's user avatar
2 votes

Enumerating m-tuples of Integers Subject to Implication Constraints

This isn't research mathematics, but since there is an answer already I'll add one. The key issue for efficiency in this type of problem is to not generate partial potential solutions that are not pa …
Brendan McKay's user avatar
0 votes

Algorithm for counting the number of strings at a particular edit distance

I'll assume you are using an edit distance that can be computed in polynomial time and that the reverse of an edit is also an edit. Also, for any string there are only a polynomial number of possible …
Brendan McKay's user avatar
5 votes

Changing combination lock

Let $N=m^n$, the number of possible keys. I will use usul's idea in a comment to show that it can be solved in at most $N^3\log N$ guesses. Make a variable $s[F,s_0]$ for each possible function $F$ a …
Brendan McKay's user avatar
3 votes
Accepted

Search for common substructures in list of graphs

I don't think there is a general technique. The only related situation I'm aware of is "motif detection" in biological networks, which involves exhaustively counting small subgraphs in very large spar …
Brendan McKay's user avatar
0 votes

Asymptotics of repeated decrease by logarithmic part

I'm guessing you can approximate it with the differential equation $$ x'(n) = -\log(x(n)). $$ The solution to this satisfies some equation involving the exponential integral special function, namely $ …
Brendan McKay's user avatar
4 votes

Sub-linear algorithm for minimum spanning tree (MST) for a tree metric.

Lev Reyzin and Nikhil Srivastava, On the longest path algorithm for reconstructing trees from distance matrices. Inform. Process. Lett. 101 (2007), no. 3, 98–100. I haven't looked at this, but the ab …
Brendan McKay's user avatar
1 vote
Accepted

Reachability in a k-partite graph

Firstly, the number of such pairs might be worse than linear in the number of edges. Consider three equal parts with the first two parts having vertices of out-degree $n^{1/2}$. Then the number of e …
Brendan McKay's user avatar
4 votes
Accepted

Algorithm to decide if the union of a set system covers the power set

Given $T_k = [m_k,M_k]$ and $X\subseteq [n]$, it is easy to calculate the number of sets in $T_k$ that contain $X$: $$Q_{X,k}=|\{T\in T_k \mid X\subseteq T\rbrace|.$$ So start with $\sum_k Q_{\emptys …
Brendan McKay's user avatar
1 vote

Make $n$ numbers equal using pairwise averages

Too long for a comment. Without loss of generality, we can assume the numbers are integers. I'll show that one can always achieve an integer multiset with only two values. For a multiset $Y=\{\!\{ y_1 …
Brendan McKay's user avatar
3 votes

An efficient generalized algorithm to obtain an arbitrary element of a lexicographically ord...

If the efficiency is very important for you, you should consider if you really need lexicographic order. Other orders have slightly faster unranking. For example, I like this one for subsets of size …
Brendan McKay's user avatar
2 votes
Accepted

A fast algorithm for a probabilistic counting problem without replacement?

I'm not sure why you ask for "distinct integers" when sampling without replacement guarantees distinctness. Let $q_i=1-p_i$. The ordinary generating function $$F(u,y) = \prod_{i=1}^n (q_i+p_i uy) \pr …
Brendan McKay's user avatar
14 votes
Accepted

Is there an efficient algorithm to check whether a matrix is symmetrizable using only permut...

The problem is NP-complete, see C. Colbourn and B. D. McKay, A correction to Colbourn's paper on the complexity of matrix symmetrizability, Information Processing Letters, 11 (1980) 96-97. Here is a s …
Brendan McKay's user avatar
7 votes
0 answers
181 views

How quickly can we test if a graph is distance-regular?

A (simple, finite, connected) graph $G$ is distance regular if there exist integers $b_i,c_i,i=0,...,D$ such that for any two vertices $x,y$ in $G$ and distance $i=d(x,y)$, there are exactly $c_i$ nei …
Brendan McKay's user avatar
0 votes

Enumerate spanning trees

Contract $e_1$ and delete $e_2$. Say $G$ is the original graph and $H$ is the new graph. Now run the tree enumeration algorithm on $H$. After reversing the contraction, you get all the spanning trees …
Brendan McKay's user avatar

15 30 50 per page