instruction stringlengths 35 29.1k |
|---|
I'm trying to understand what is the minimum of the following function,
$$
f(\mu) = \frac{1}{n}\sum_{i=1}^n F\left(\frac{\pi(i)}{n}\right) (x_i - \mu )^2
$$
where $F$ is a step function that assign $1$ to any $t \in [0, \gamma]$ and $0$ in $(\gamma, 1]$, $\pi$ is a permutation that sorts the $i$s based on the ascending... |
I have a question to enhance a B-Tree and add a function called find(k) which gets a key - k and returns the index of it in the sorted keys of the tree, using $O(N)$ space complexity, and it needs to be in $O(t \cdot \log_t{n})$ time complexity. I also need to show that the function does not make the regular functions ... |
I have some difficulty proving the correctness of my solution to the following exercise. Let $G = (V,E)$ undirected connected graph, $w \colon E \to \mathbb{R}$ weight function. Let $T$ a MST (minimum spanning tree) of $G$. Now, we add a new edge $e'$ to $E$ with weight $w(e')$. Find an algorithm that updates $T$ so it... |
I'm pretty new to complexity theory and it seems like I stuck with this problem. We should find language $B$ such that it accepts any words rejected by $A$ but in that case, it seems that $B$ is a complement of $A$ and therefore $B$ belongs to $coNPC$. What is my mistake? Thank you!
|
Here is an excerpt from Andrew S. Tanenbaum, Computer Networks, 5th edition, Chapter 3 (The data link layer), Page 208:
My question is about this part.
[Convolutional codes have been popular in practice because it is easy to factor the uncertainty of a bit being a 0 or a 1 into the decoding.]
Why is it easy to use con... |
The Question is from DP tiling a 2xN tile with L shaped tiles and 2x1 tiles?
I want an explanation about this question or theory
|
I have tried to solve the following question:
van Emde Boas Bounds Show that $T(u) = T(\sqrt{u}) + O(1)$ has the solution $T(u) = O(\log\log u)$. Hint: consider the binary representation of $u$.
In CLRS (Introduction to Algorithms), they make use of the master method case 2. They let $m = \log_2u$ so we have $T(2^m) ... |
I have a Data Structure question where I need to manage an hotel, each room has a number between $1-n$
and it can be occupied or not.
Available Data structures: AVL* Trees, B-Trees, Arrays, Stacks, Queues, Binary Trees.
$O(n)$ Space complexity available.
Using AVL OR B-Tree is a must.
I have to support these func... |
I am not quite sure howto define SET-PARTITION as a language as in Sipser. Is it
$$
\left\{ \langle S,A,B\rangle \;\middle|\; (A,B) \text{ is partition of } S \text{ and } \sum_{n\in A} n = \sum_{n\in B} n \right\}
\quad \text{ or } \\
\left\{ \langle S\rangle \;\middle|\; \text{ there exists a partition } (A,B) \te... |
TAPL (page 549) proposes the following lemma in order to prove soundness of System F type system:
Substitution lemma for types:
$E, X, \Delta \vdash t: T \implies E, [X \mapsto S] \Delta \vdash [X \mapsto S]t: [X \mapsto S]T$
Proof of the T-TApp case:
$ E,X,\Delta \vdash t[A]: [Y \mapsto A]T $
and by rule T-TApp we ha... |
I have an undirected unweighted graph with a single component. I want to know if removing a given node will disconnect the graph. I know that I can remove the edges to the node and then use DFS to get the number of components, however this seems rather inefficient as I need to check all vertices in the graph for this. ... |
I was reading a Wikipedia page on Primitive Recursive Functions but there is a phrase for describing the simple for loops which I really don't understand. Can anyone explain this to me?
The Phrase:
An upper bound of the number of iterations of every loop can be determined before entering the loop
The Wikipedia page
|
Let's say I have a long text of 1M words and I would like to create a table of all the words ordered by the number of occurrences in the text.
One approach would be populating a dynamic array with each word and linear search them to count the occurrences in $O(n^2)$ then sort the array by occurrences in $O(n \log n)$. ... |
I am new in this field. In the book Foundations of Machine Learning by Mehryar Mohri, Afshi Rostamizadeh, and Ameet Talwalkar. The authors define the generalized error of a hypothesis as
$ R(h) = \Pr_{x \sim D}[h(x) \neq c(x)] = E_{x \sim D}[1_{h(x) \neq c(x)}]$
which is a number. However in the Definition 2.3 a conce... |
In classical optimization literature numerical derivation of functions is often mentioned to be a computationally expensive step. For example Quasi-Newton methods are presented as a method to avoid the computation of first and/or second derivatives when these are "too expensive" to compute.
What are the state of the a... |
In Lambda Calculus, the distinction between data and code doesn't seem to exist. Is there something fundamental about this, or purely Lambda Calculus's thing?
Some context: as a software developer, I got used to the concept of data so much that I never considered its true nature. I'd very much appreciate any references... |
I have a table like this:
PostId | Body | AuthorId
2 b F
2 b E
2 b C
4 d A
4 d E
8 h F
So what I want is to get all the rows that have mo... |
Suppose that $L$ is some language over the alphabet $\Sigma$. I was asked to show that the following languages is decidable:
$$L' = \{w \in \Sigma^* | \text{ there exists a word } w'\in L \text{ such that } |w'| \leq |w| \}$$
I.e., $w \in L'$ if $L$ has some word with length smaller than $|w|$.
The way I was thinking... |
I want to solve a linear programming problem in the $2n$ variables $x_1, \ldots, x_n$ and $y_1, \ldots, y_n$ where the cost is of the form $x_1/y_1 + \cdots + x_n/y_n$. Specifically, I want to solve
\begin{align*} & {\rm minimize}~ \sum_{i=1}^n x_i/y_i \\
&\mbox{ subject to } Ax + B y \leq c \\
& x>0, y>0,
\end{align... |
I observed that all the interval tree implementations I am able to come up with are required to utilize a stack (or a-like) to answer queries (report any overlapping interval with a key).
In general when visiting a node in an (common) interval tree you are required to visit multiple child nodes and check for results th... |
let's say $f(n) = O(g(n))$ and $l(n) = O(m(n))$
is it always true that $f(n) \cdot l(n) = O(g(n)) \cdot O(m(n))$ ?
|
If we have a Turing machine in a model with a tape that is infinite only to the right and assume at some point the head tries to move left from the leftmost position.
How should we define the behavior in such a case? Is a machine doing so for some input not a valid Turing machine? And if so, how can we make sure when w... |
I have a bunch of objects that I am not sure on how to represent in order to maximize memory occupancy and possibly avoiding large CPU overhead. The most natural way to see the whole data structure is as a tree. A picture is worth a thousand words
Each tree node contains an object that I simply represented as an integ... |
In general for the (two-party) set disjointness problem for inputs of length n, we know that the parties need to communicate $\Omega(n)$. Surprisingly, today I discovered (if I understood correctly) that this is not true for product distributions, i.e. when Alice's and Bob's inputs are chosen independently from arbitra... |
I've been looking at the following combination sum problem:
Given a set of candidate numbers (candidates) (without duplicates) and a target number
(target), find all unique combinations in candidates where the candidate numbers sums to
target.
The same repeated number may be chosen from candidates unlimited number o... |
Function Problem: Given $N$ find a $2$_$sum$ that uses at least $ONE$ prime.
Fact: Prime Gaps grow logarithmically on average. And, in worst case if memory serves correct it grows with a bounded constant.
Take notice that $count$ (defined below) will only equal to $s$, if the $AKS$ primality statement executes $s$ tim... |
Here is a picture from Andrew S. Tanenbaum, Computer Networks, 5th edition, Chapter 3 (The data link layer), Page 207(English Version)/Page 206(Japanese Version):
I want to verify whether my interpretation is correct or not. My interpretation is in the picture that has red arrows.
From the picture, I made a table to... |
I'm trying to implement a decision procedure for finding solutions to a scheduling problem; this involves computing the point in time which is under the most contention. Each task to be scheduled has a continuous compactly supported piecewise linear distribution of possible time allocations; the total contention at any... |
Given n numbers, design an algorithm to find the smallest $n^{\frac{2}{3}}$numbers, in sorted order. (Assume $n^{\frac{2}{3}}$ is an integer.)
I don't understand this question. Can I simply $x = n^{\frac{2}{3}}$ and fetch the $A[x]$?
|
I am designing a feature recommendation system and I have encountered an algorithmic problem and I am wondering if any of you know if there are known algorithms to solve this type of issue. In our recommendation system the content recommended can have in its metadata information at what range it should be put. To demon... |
I have a language:
$$ \{a^jb^k \mid j \neq k \text{ and } j \equiv k \pmod 3 \}$$
I want to prove that this language is regular. My first thought was to create a regular expression that accounts for all three of the cases of modulo 3 like such:
$$(aaa)^*(bbb)^* | a(aaa)^*b(bbb)^* | aa(aaa)^*bb(bbb)^*$$
However, this do... |
For double hashing, we have some constraints on $h'(k)$
(1) It should never evaluate to 0
(2) It should be relatively prime to m
How to show that all slots in an open addressing table will be included in a probe sequence.
|
Given a CFG in Chomsky Normal Form and a sentence s.
I want to count the number of different parsing trees that parses s.
assuming I know how to change the CYK algorithm so it would count the number of parsing trees, how can I determine if one tree X is different then tree Y? obviously it can be done in a naive way tha... |
I would like to know if someone can give me an example of how a prefix sum which contains 8 elements can be computed with just three processors.
Prefix sum
|
I'm currently working on a personal software project (as a hobby) and would like to know which kind of approach I should follow according to you.
My application scans some websites (like Amazon or eBay) to check items of a specific category and show them all together ordered, for instance, by price.
Currently I use Pyt... |
I am learning about block ciphers and while I understand the concept of Electronic Codeblock mode and cipher block chaining, I could not find any relevant practical examples online. Can someone provide a short example of a scenario where we convert plain text into cipher text using ecb and cbc (with initialization vect... |
I have the following function.
int fun(int n)
{
int count = 0;
for (int i = n; i > 0; i /= 2)
for (int j = 0; j < i; j++)
count += 1;
return count;
}
It has O(N) time complexity. I thought it's O(N LogN)(i.e. If we remove the inner loop we get)
for (int i = n; i > 0; i /= 2){
...
}
This is... |
Let
$T(n):=\begin{cases} \frac{2+\log n}{1+\text{log}n}t(\lfloor\frac{n}{2}\rfloor) + \log ((n!)^{\log n}) & \text{if }n>1 \\
1 & \text{if }n=1
\end{cases}$
I need to prove that $t(n) \in O(n²)$, thus $t(n) \leq c\cdot n²$
I asked the question here and I got really great help last time, the thing is after I was shown l... |
So what confuses me is that let's consider a function f. According to a definition from a text book it asserts that f is called recursive, if there is a Turing machine that computes it (for all input strings output of the machine should be equal to output of the function given the same input).
But in general, we say th... |
Assuming we have two programs $p_1$ and $p_2$ and two line numbers $n_1$ and $n_2$. Does $p_1$ reach $n_1$ in less computational steps than $p_2$ reaches $n_2$? By reduction from Halting, this is clearly not decidable, but I think it is semi decidable.
To do so, I would build an interpreter, that executes $p_1$ and $p_... |
I'm trying to understand splay tree performance compared to a standard balanced tree like AVL/red-black. In practice, I am pretty skeptical of the amortized bounds Tarjan and Sleator proves in their paper. Maybe because I am not that smart to actually understand these proofs, but I am still curious of one certain patho... |
For many years now, I have heard about "AI" and "neural networks" and all these buzzwords, and it is regularly claimed on Slashdot that this or that open source program is able to "do AI". But then I go to its website and I have no idea what I'm even looking at, let alone how to actually use it. I give up and forget ab... |
I am given two functions:
$ fl(fl(x+y)+z) $ and $ fl(x+fl(y+z)) $ and asked to derive their relative error. Then, given a set of conditions:
a) $ x < y < x $
b) $ x > 0, y < 0, z > 0 $
c) $ x < 0, y > 0, z < 0 $
determine which parenthesization has less relative error.
After some algebra I determined the following rela... |
A friend in industry proposed a problem to me. If you have a supply warehouse, you can treat each station with products as a node. Each node has a probability it will be visited by an employee working on an order. Is there a way to decide what product goes at each fixed node to minimize total travel time, by all employ... |
Ternary heap is like a binary tree, just every node can have up to $3$ sons and not $2$.
I try to bound the number of nodes in the heap, $n$, using the height of the heap $h$.
The solutions get to:
$$
3^h < n < 3^{h+1}
$$
Yet, I get to:
$$
\frac{3^h}{2} < n < \frac{3^{h+1}}{2}
$$
In short, what I do is:
$$
\sum_{i =... |
I want to solve Problem 4.10 from Randomness by Salil Vadhan. https://people.seas.harvard.edu/~salil/cs225/spring15/PS3.pdf
Consider a bipartite expander $G$ with left degree $D$ so that every subset $S$ of the left vertices with at most $K$ vertices has at least $(1-\epsilon)D|S|$ neighbors. Then $G$ also has the prop... |
I am trying to compute the Follow set of the following Grammar:
E -> E' E A
A -> + | *
E -> num
E' -> num
I start by adding the end of string symbol, via. some non-terminal S such that:
S -> E$
E -> E' E A
A -> + | *
E -> num
E' -> num
Becomes the Grammar. With this I get the following set constraints for the product... |
I'm stuck with the following problem by Skiena (The Algorithm Design Manual, p. 106):
Problem: Give an efficient algorithm to determine whether two sets (of
size $m$ and $n$, respectively) are disjoint. Analyze the worst-case
complexity in terms of $m$ and $n$, considering the case where $m$ is
substantially sm... |
Let's say I've finished my compiler for my new language. Next step is write a custom editor with syntax highlighting (type checking and semantic can wait), is there a cookbook or any kind of guidance to accomplish this project?
|
Suppose there exists an algorithm that takes as input an unsatisfiable SAT formula, and never fails to verify it in polynomial time. However, when the input is a satisfiable formula, it doesn't work (let's say time and memory problems, the algorithm gets lost in the reasoning).
Then Co-NP = P because we can verify uns... |
i think the above is incorrect; specifically, i think H isn't bijective. say our alphabet is the lowercase letters [a-z] and that char(a) = 0. then, e.g., H("abc") = H("bc").
am i missing something?
|
I'm taking a class. In this class every week we have a partner. There are an even number of people in the class. We'd like avoid having repeat partners if possible so that everyone gets to work with as many people as possible. I'd like to know how many weeks we could accomplish this before we're forced to partner someo... |
Given a undirected graph which only has two different edge weights $x$ and $y$ is it possible to make a faster algorithm than Prim's algorithm or Kruskal's algorithm?
I saw on Kruskal's algorithm that it already assumes that the edges can be sorted in linear time with count sort, so then can we gain any benefit by know... |
I have a hashtable with length $m$. Initially it's empty. Next, $n/2$ unique random numbers $\in [0, n]$ are added to it.
What would be variance of chain length when such $n/2$ numbers are being added $x$ times?
I tested it using code with $n=2^{16}$, $m=2^{15}$ (part of md5 was used as index) and got the following res... |
Suddenly a thought came to my mind and I thought of resolving it as follows.
We know that:
String is a finite sequence of symbols from an alphabet $\Sigma$
i.e. we cannot have an infinite sequence representing a string, which means there is no definition such as
$w = "abcabe...........$
which is unending
Now when we co... |
Exercise 3 from https://massimolauria.net/courses/2015.ProofComplexity/lecture6.pdf
Consider the set of inequalities $x_i+x_j\leq1$ for $1\leq i<j\leq n$.
Find a derivation of $\sum_{i=1}^n x_i\leq 1$ in $O(n^2)$ length.
If it were just algebra I could just show by contradiction that at most one $x_i$ could be 1 and ... |
I have been asked this question, but don't know how to go about answering it.
Three process, which are implementing Lamport's clocks, are running and a lot of events are taking, place including some messages being sent between the processes. The arrows and circles represent in-processor events and messages being sent ... |
I'm trying to figure out the running time for a Dijkstra algorithm. All the sources I have read say that the running time is O(E * log (E)) for a lazy implementation.
But when we do the math we get O(E * (Log(E)+E*Log(E))).
Since E isn't a constant, I don't see how someone could reduce this to O(E * log (E).
Are we a... |
Say I have a deterministic turing machine which solves decision problem S with oracle access to both problems B, C that are in $NP$.
Can S be solved with oracle access to only one problem in $NP$?
That is, can B and C somehow be combined into one problem in $NP$ (thus showing S is in $P^{NP}$)?
|
Given a square matrix of size N X N (1 <= N <= 1000) containing positive and negative integers with absolute value not larger than 1000, we need to compute the greatest sum achievable
by walking a path, starting at any cell of the matrix and always moving downwards or rightwards.
Additionally we also have to find the n... |
I'm performing some correlation assessment à la NIST Recommendation for the Entropy Sources Used for Random Bit Generation, § 5.1.
You take a test sequence and compress it with a standard compression algorithm. You then shuffle that sequence randomly using a PRNG, and re-compress. We expect that the randomly shuffle... |
For a language L $\subseteq$ $\Sigma$* , define LOG(L) = { u $\epsilon$ $\Sigma$* | $\exists$ v s.t. |v| = $2^|$$^u$$^|$ and uv $\epsilon$ L}. Show that if L is regular so is LOG(L).
I was trying to come up with some finite state automaton for LOG(L) but can't find any. Please give some hint.
|
Problem: Write a program which generates Deterministic finite automaton which accepts given language. Language is defined with alphabet and start/end sub strings.
For example: Alphabet={a,b,c}; start sub string="ab"; end sub string="cb"
I need to construct DFA which will accept strings of kind: {abcb, abaacb, abcabcb..... |
\begin{align} L &= \{ w \in \{a, b\}^* \mid \text{ no prefix of $w$
starts with $b$}\} \\ &= \{w \in \{a, b\}^* \mid \text{ the first
character of $w$ is $a$} \} \cup \{e\} \end{align}
Why is it in union with an empty string? If an empty string from $b$ can also be a prefix.
|
I know some algorithms which compute the convex hull in a continuous space. Are there efficient algorithms to compute it in a discrete domain?
For example in 3D discrete space, given the blue points, we want the convex hull including the green points. This fugure's points are plotted on the plane $v_1 + v_2 + v_3 = 7$.... |
A Forgetful Turing Machine (FTM) operates just like a normal Turing machine except that, in every instruction (i.e., transition), the letter written in the tape cell is always the letter $a$, regardless of the current state and the current letter (although the read/write head is still allowed to move either Left or Rig... |
Σ(alphabet) contains 3x1 column matrices
[[0],[0],[0]], [[0],[0],[1]] , [[0],[1],[0]]... [[1],[1],[1]] such that each
element in the language is a THREE SET
of the columns where the bottom row is the sum of the two top rows
example
[[0],[0],[1]], [[1],[0],[0]] , [[1],[1],[0]] is an element of the Language
BUT
[[0],... |
I read a statement that was unclear to me, and was hoping to get some clarification.
It said that given a full binary tree with $n > 2$ leaves, there exists some internal node such that one third to two thirds of all $n$ leaves in the tree are its descendants.
From my understanding, I know each internal node in a full ... |
And if it is not true, what are the problem classes or characteristics for which genetic algorithms are superior?
|
Given a general branching program, is there an algorithm which can find an equivalent branching program $P$ of minimal length. That is $|P| \leq |P'|$ for all equivalent branching program $P'$.
If not, are their some specific cases where this algorithm exists?
|
Let N be an n bit number. A brute force algorithm factors N by trying to divide N by all of the numbers between 2 and sqrt(N). Given that dividng two n bit integers takes O(n^2) time, what is the asymptotic running time for the brute force factoring algorithm?
|
In the Min-Ones-2-SAT problem, we are given a 2-CNF formula φ and an integer k, and the objective is to decide whether there exists a satisfying assignment for φ with at most k variables set to true.Show that Min-Ones-2-SAT admits a polynomial kernel.
What I did
check if I can satisfy a 2-CNF Sat with k variables set ... |
Consider the recursive quick sort with random pivoting i.e. each time a random pivot element is chosen uniformly. When this randomized algorithm is being applied to an array with n distinct element, what is the probability that the smallest and the greatest element will be compared during run of the algorithm.
|
I need to create an algorithm that will output the number of self-crossings for an irregular orientation of an n-pointed star, whose vertices lie on the boundary of a circle. The sample input is as follows:
5
24.0
168.0
312.0
96.0
240.0
Where the first integer is n (the number of vertices), proceeded with n lines, eac... |
Consider cellular automaton rules for a two-dimensional universe with two states, where a cell's new state can depend on its previous state and the states of the cells in its Moore neighborhood. Such a rule can be modeled as a function that takes as input a 3 by 3 matrix of bits, and outputs a bit.
Such a rule can be r... |
Given N arrays of variable length.
Find a way to concatenate the arrays in such a way that the number of inversions is minimum
An inversion for an array Arr can be defined as,
a pair of indices (i,j) such that,
i != j
i < j
Arr[i]>Arr[j]
I tried to concatenate the arrays on the basis of sum, such that the one with m... |
I am working with the median-median algorithm or BFPRT algorithm and I seek to understand why would the partition of the array by $7$ blocks would work but with the $3$ fail?
If we divide into blocks of $7$ then we will get:
Solving it by substitution I think the following manner:
It is a recursive tree. In the worst ... |
We have a number of people that must be partitioned into groups, but there may be people that dislike other individuals. Partition the people into the minimum number of groups such that no person is grouped with someone they don't like. (If A doesn't like B then A cannot be in a group with B. Each person must belong... |
I have some questions about Baker, Gill, Solovay proof of the existence of an oracle such that P^B != NP^B. The proof can be found in Siam Journal of Computing, 4:432-442, 1975 [219].
Why Isn't this construction considered a counterexample to P = NP? And if it is not, can it be strengthened into one? It seems tome tha... |
It is an open question if NP $\neq$ Co-NP but if the conjecture were proved, this would mean that P $\neq$ NP
because P is closed under complement.
Now a fact that fails to enter my head is the following:
We take 3SAT which we know is NP-complete and then we take 3TAUTOLOGY which is Co-NP-complete. The last formal la... |
I asked this question to the OR community (https://or.stackexchange.com/questions/1498/how-is-the-field-of-operations-research-evolving) but, since there are quite a few CS people working in OR, I would like to get the perspective of the community.
Classically, it seems the problems that OR people studied (at least the... |
In the book by Cover and Thomas on information theory, there is a chapter on algorithmic information theory (kolmogorov complexity and so forth).
As far as I understand, algorithmic information theory was developed separately from information theory, and Kolmogorov didnt formalize AIT in terms of shannon entropy and so... |
Suppose you're given a DFA $M$ with a 5 tuple of $(Q, \Sigma, \delta, q_0, F)$.
How do you construct an NFA that accepts $L(M)$ and $\{\varepsilon\}$, the set containing the empty string? I know that a DFA is an NFA.
My thought is that you would simply add a new transition from the start state to the accepting state, w... |
Given a minimal NFA for a finite language, is there a polynomial-time algorithm to find a minimal regular expression for the same language?
This question is based on a recent question regarding minimization of regular expressions for finite languages given a regular expression. I was surprised to learn there don't appe... |
What can be an initial guess for finding the tight asymptotic bounds of $T(n)=2T(n/2)+ \sum_{i=0}^{n} (i+2)^2$ using substitution method?
|
suppose I have 6$\{0,1,2,3,4,5\}$ numbers.I should generate following 4 pairings of numbers where there will be 3 pairs in each pairing s.t
each number should be in one pair and also every number should be paired
a pair(like 0-1) should be present in only one of the pairing. and also every possible pair should be pres... |
This post and this post indicate that when the dimensionality gets higher, KDTree gets slower.
Per scikit-learn doc, the KDTree becomes inefficient as D(dimensions) grows very large (say, $D>20$): this is one manifestation of the so-called “curse of dimensionality”.
Is there some theoretical verification or explanation... |
I've been asked to do this task in an online assessment. I've passed, so my solution is supposedly correct, but I am unable to prove it. The task is:
Given a set of parts (array of integer part sizes), worker must put them all together. Parts are assembled in pairs. To put together two parts of sizes A and B worker nee... |
Example
N = 9 and K=3
4 + 4 + 1 = 9 .
What I have tried.
We can not go on dividing with 2.
We can use unbounded knapsack with array elements from 2^0 to 2^32.
|
I am learning this post
Fast computation of nearest neighbors is an active area of research in machine learning. The most naive neighbor search implementation involves the brute-force computation of distances between all pairs of points in the dataset: for N samples in D dimensions, this approach scales as $O[D N^2]$.... |
What are the differences between NP, NP-Complete and NP-Hard?
I am aware of many resources all over the web. I'd like to read your explanations, and the reason is they might be different from what's out there, or there is something that I'm not aware of.
|
It is known that metric TSP can be approximated within some constant value, such as 3/2 through Christofides' algorithm. It is also known that non-metric TSP cannot be approximated within some constant value (unless P= NP), thanks to Sahni and Gonzalez.
It isn't clear however if non-metric TSP can be approximated withi... |
I'm trying to understand an algorithm shown in my textbook for solving a system of congruences. The problem states:
Let $r$ and $m$ be arrays of size $n$, such that every two numbers (modulos) from $m$ are coprime. Find $x$ such that
$$x \bmod m_0=r_0\\x \bmod m_1=r_1\\...\\x \bmod m_{n-1}=r_{n-1}$$
So yeah, the classi... |
I'm trying to pack hexagons, within bigger hexagons, as shown here:
For this example, I have 5 "children" to put in my "father" hexagon.
Each time I've got too many children, I would like to reduce the size (divide by 3?) of the children, to store more of them, as shown on this image (ignore the bad position quality):... |
In Hitting Set problem we are given a collection E of subsets of V and we want to find smallest subset H of V which intersects (hits) every set in E.
In decision version of the problem, we are asked if there exists a hitting set H of size at most k.
This problem is known to be NP-hard. However, I wonder if the problem ... |
In Theta notation what are the running times of these algorithms?
Algorithm 1
for i=1..n
j=1
while j*j <= i:
j = j + 1
Since the outer loop is going to n and the inner loop is going to sqrt(n). My guess is that it is Θ(n^2)
$$
\sum_{i=1}^{n} O(1) \sum_{j=1}^{\sqrt n}O(1)
= \sum_{i=1}^{n} \sqrt j*\sqrt... |
I'm not sure this is equivalent to bipartite vertex cover question. The question is:
Given a BIPARTITE graph, what is the minimum number of vertex from the right side whose edges cover all vertex from the left side.
e.g. In the following graph, the answer is 1, cause vertex g has connection to all vertex on the left.
... |
In the
paper (p. 3)
and the
slides
presents the formulation of the Steiner problem on graphs
via so called Steiner cuts.
But according to the definition, the number of Steiner cuts and so the number of constraints grows exponentially with
the number of vertices in the graph.
First question: How to solve the prob... |
What are the category theory structures describing queues and topics? By queues and topics I mean the ones described in systems like Apache Kafka, AcriveMQ or Java Messaging Service.
Where I can find material about that?
|
The specific problem I'm working on is the puzzle presented in this video. For those who don't want to watch the video, my summary of the puzzle is:
A frog is sitting on the edge of a pond facing the opposite bank. In front of the frog, running along the pond's diameter, is a line of $N$ lilypads. This is a very athle... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.