instruction stringlengths 35 29.1k |
|---|
The halting problem is $RE$ complete. With an oracle for the halting problem could you decide problems in $co RE$ with an oracle for RE?
|
We are given a flow network $G = (V,E,c)$, where $c$ is the capacity function as well as a maximum flow $f_m: E\rightarrow \mathbb R$ from $s$ to $t$. The goal is to find edges such that if decreased by one unit, the value of any max flow decreases as well. The time complexity should be $O(VE)$.
I found this question i... |
Is there a way of generating random isomorphic graphs for the purposes of testing tools like Nauty or BLISS? Every paper I've found says the authors had a database of certain isomorphic graphs, but I don't know how they constructed them or where I find test sets for graph isomorphism algorithms. I expect the answer to ... |
I particularly have a problem creating DFAs for multiples of larger numbers like 10, 11 ,12 etc. but I can create simple ones like 1, 2, 3 etc.
Even more so, I have a problem creating a minimized DFA for these problems. I think if a DFA has 10, 11 or so states, minimizing it properly could take a long time as there can... |
For example for the traveling salesman problem which is a proven NP-Complete problem, if we spawn a thread at each node in the graph such that each of those threads will, in turn, spawn as many threads as needed, would this work as a simulation of Non-deterministic Turing machine. Are there any theoretical gaps in this... |
Recently i wrote a programme using random module of python. Then i realised that the same output was being repeated quite a number of times though it was supposed to be completely random.
|
The subset sum problem is as follows:
Given a sequence of integers $\mathcal S=(a_1, ..., a_n)$ with cardinality $n$ and an integer $T$, determine whether there is a subsequence of $\mathcal S$ whose sum equals $T$. Denote this problem $SSP$.
I was given a variant of the subset sum problem:
Given a sequence of $\col... |
I'm stuck with the following problem:
Given an n*m board, find the maximum number of square groups that can be positioned on the board.
What are square groups?
They contain 4 distinct squares named: a, b, c, d
a should be the neighbor of b
b should be the neighbor of c
c should be the neighbor of d
Two squares are con... |
I'm confused with polynomial-time reduction and NP-hardness.
Let's say that the following integer programming is NP-hard.
$\min_{x \in K} f(x)$, where $K$ is a finite subset of $\mathbb{N}$.
But it is a special case of the following linear programming.
$\min_{x \in X} f(x)$, where $X$ is a compact subset of $\mathbb{R}... |
Question:
Ackermann Hierarchy defined as following: $$A_{k}(n)=A_{k-1}^{(n)}(1), \ k\geq2, \ A_1(n)=2n$$
In addition, Ackermann function defined as following: $$A(n)=A_n(3)$$
A. which of the following grows faster to infinity? $A_7(A_4(n))$ or $A_4(A_7(n))$.
B. suppose we want to find a function that grows faster tha... |
On wikipedia it says that $BQP ⊆ EXP$. However it is not known if $BQP \subset EXP$ Also I've seen that $PSPACE$ could contain $NEXP$ and does contain $BQP$. For this were assuming the incredibly unlikely scenario that $BQP = PSPACE = NEXP$. What would the implications be? I assume this would render P vs NP completely ... |
Consider the following basic problem, for which the statement is "obvious," but I can't seem to find totally convincing proof.
Problem: Let $S$ be a set of $n$ elements, where $n\geq 2$ is even. And let $f:S \rightarrow \{0, 1\}$ be a function that maps half of the elements in $S$ to $0$, and the other half to $1$. S... |
i need to convert this CFL to CFG
$$ L = \{\; 1^n 0^m 1^k 0^p \mid n\ge 2, k,m,p\ge 1, n+k=m+p\;\} $$
I am trying to solve this problem for a few days but i couldn't. Is there anyone to help me? I'm gonna blow my mind..If somebody can help i will be so grateful..
|
I was wondering if I could say any of the following is true.
Given a grammar $G$,
If the LALR parser has reduce-reduce conflict for $G$, then the SLR parser also has reduce-reduce conflict for $G$.
If the SLR parser has reduce-reduce conflict for $G$, then the LALR parser also has reduce-reduce conflict.
The LALR pars... |
I have to design a PDA that recognizes the language $\{a^nb^m \mid 0<n\leq m\leq3n\}$
I tried to partition the stack into 3 partitions with the first partition being the size of $n$ with character A, the second partition being the size of $2n$ with character B, and the third partition size of $n$ with character A.
I go... |
I'm trying to prove that the following language is L-complete
A is a language where each word is comprised of 0s and 1s & the number of 0's is double that of the number of 1's
So far I've managed to show that it can be solved in log space using a counter that adds 2 for every '1' and deducts 1 for every 0.
I need to pr... |
New to tsp and christofide algorithm pls help
What if instead of using a spanning tree as described in christofide algorithm we use two or more intersecting circles of the input points to determine shortest distance?
Suppose we have 5 points, we draw 5 circles around them of same radius as per the choice of the user an... |
I am taking a course on Eductive on System Design and I read about the ways the data can be partitioned amongst DB servers. See the snippet below:
b. Hash-Based Partitioning: In this scheme, we take a hash of the object we are storing. We then calculate which partition to use based upon the hash. In our case, we can ta... |
It is well known that "regex" with back-reference is not a regular expression anymore.
For instance, (.*)\1 matches any string repeated twice.
However, is it possible to construct a DFA for regex with lookaround?
I found this question and particularly this answer, which says
Look-ahead and look-behind are nothing spec... |
In my computer graphics course I came across this "pro" for point clouds:
Useful for large datasets (>> 1 point / pixel)
I'm trying to wrap my head about it, I know drawing is expensive, but, it somehow counterintutive to me that for larger datasets having to store more points is more efficient?
Why wouldn't it hold ... |
From the wiki this is the algorithm and we know that final complexity is O(n) but how we reached to this , is my problem :
algorithm welzl is
input: Finite sets P and R of points in the plane |R| ≤ 3.
output: Minimal disk enclosing P with R on the boundary.
part 1: if P is empty or |R| = 3 then
... |
I was reading the paper "Kou, L. T., Stockmeyer, L. J., & Wong, C. K. (1978). Covering edges by cliques with regard to keyword conflicts and intersection graphs. Communications of the ACM, 21(2), 135-139" and from what I understand, they prove that SET-ECC is NP-complete by constructing a graph G' and showing that (G, ... |
I'm reading the book Cracking the Code.
The answer for this question suggests a solution using timestamps and two separate queues. This is straightforward and involves simply enqueuing into the appropriate queues. Dequeuing oldest involves checking timestamps of front of both queues and removing the oldest.
I'm wonderi... |
I have a sequence of source files that are very similar (akin to frames in a video), and each file can be compressed by a codec independently, but there is no temporal compression.
I want to further compress the data by exploring the temporal correlation, but I don't know how to do that with the source files. However, ... |
I'm trying prove the correctness of my algorithm.
This is the problem in codeforces: https://codeforces.com/contest/1428/problem/C
Here's my code in C++ which was accepted:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
int num, ans, top;
string s;... |
Suppose that the stop-and-wait protocol is used on a link with a bit rate of 64
kilobits per second and 20 milliseconds propagation delay. Assume that the transmission time for the acknowledgment and the processing time at nodes are negligible. Then the minimum frame size in bytes to achieve a link utilization of at le... |
I'm new to Linear Programming and trying to create an automated scheduling algorithm, and am having trouble defining the objective function and decision variables. Any help would be appreciated:
Let there be E employees who need to be assigned to K types of shifts distributed over N days. Each shift K has an associated... |
In the (unlikely) event that $P=NP$ with a constructive proof of a polynomial time algorithm that solves 3SAT, obviously things will be very different. However, practically, it could happen that the degree of the polynomial run time is very large (e.g. $\Omega(n^{10000})$) such that any reasonably large problem is stil... |
What types of logic should one study as foundation before diving into the area of software verification? What I can think of are:
Hoare Logic (for proving correctness of imperative programs)
Linear Temporal Logic (to model-check programs)
What can be others?
|
So I've been reading Sipser's theory of computation book, and I've come across the pumping lemma for context-free languages, which as a reminder says that if a language is context-free, then there is some length p such that all strings longer than p can be represented in the form
$s = uv^i x y^i z$
and be pumped and re... |
I've got this question that asks me to make changes to the 2-3 trees that would make it possible to do a find(x) function that would find x with O(log(rank(x))) .
**rank(x) is x's index in a sorted sequence of all of the values of the tree. However we have to still do insert(x) and delete(x) with O(log(n)).
So I though... |
It is know that the Gabriel graph of a point set $P \subset \mathbb{R}^2$, $\mathcal{GG}(P)$ is a subset of the corresponding Delauney graph $\mathcal{DG}(P)$, i.e. $\mathcal{GG}(P) \subseteq\mathcal{DG}(P)$.
A Gabriel graph is defined as:
The Gabriel graph $\mathcal{GG}(P)$ of a point set $P \subset \mathbb{R}^2$ is... |
I have a question. I read many blogs, websites about CAP theorem. They say that single-node systems are CA, but how can it be "A" if that single node goes down ? Because if it does, the system will be unavailable, right ? And is "availability" in CAP equal to "availability" in HA of distributed systems ?
|
I have a 0-1 integer linear program for a set of $2n$ variables $S = \{x_1, ..., x_n, y_1, ..., y_n\}$. My objective is to maximize the number of pairs $(x_i, y_i)$ such that $x_i = y_i$, $i = 1, ..., n$.
$$
\max \sum_{i=1}^n \mathbb{1}(x_i = y_i)
$$
where $\mathbb{1}(x_i = y_i) = 1$ if and only if $x_i = y_i$, $i = 1,... |
Description
The task is to identify repeated patterns in a string and do lossy compression of the input string using the found patterns. The output is a list containing different ways of encoding the string (information loss VS description length).
For simplicity, I'll be using a binary string, though the solution shou... |
The PARTITION decision problem is defined as follows (taken from COMPUTERS AND INTRACTABILITY from Garey and Johnson):
Instance: A finite set $A$ and a size $s(a) \in \mathbb{Z}^{+}$ for each $a \in A$.
Question: Is there a subset $A' \subseteq A$ such that
$$
\sum_{a \in A'} s(a) = \sum_{a \in A \setminus A'} s(a).
$$... |
Suppose we have a sequence of $m$ tokens $(T_1, T_2, \ldots, T_m)$. We can split this sequence considering two parameters $w$ (which is the width of the window) and $x$ which is the overlap between windows. This is depicted in the following figure:
Now, suppose we have the function $f$ which takes as input a window an... |
So I basically had an exam question in which we were given a problem and we had to prove or disprove that it was in NP-complete. I tried to prove it but could not because apparently it could not be proved.
In the solution that the instructor sent us, they proved that we cannot prove that this problem is in NP; therefor... |
A binary image is encoded as a sorted array of non-overlapping runs, which represent value 1. Each run is defined by $r$, $c_s$ and $c_e$, with $c_s \leq c_e$. These are the row, starting and ending column coordinates of the run, inclusive. The runs are sorted by row then column. The image contains $N$ runs.
I want to ... |
Requirements:
Given a 2D array of 1's and 0's (black and white cells) find blocks of white cells of size 1xT or Tx1 where T >= 1. Any block should not be a subset of a larger block.
Return the number of these blocks.
This is an example solution of a 5x3 grid. There should be 8 blocks. Block y:1, x:0 is not a block b... |
Let L be a language of pairs $\langle R,G\rangle$, with the first element being a regex and the second being a CFG.
Is it decidable that G accepts whatever the regular expression does? In other words, is it decidable to say if $L(R)\subseteq L(G)$?
|
I know, the inner loop here is O(log n). But, I get confused by the multiplication in the outer loop part.
for (int i = 1; i <= 5*N; i++) {
for (int j = 1; j <= 1000; j = 2*j) {
doSomething(i, j);
}
}
The correct answer to the question is, O(N) with regard to: how many times does the function doSomething() r... |
Why do we use a private IP address instead of using the MAC address in a local network?
It makes sense that we have IP addresses for large networks where packets have to be routed because the IP address is location-dependant. Meaning routers can just route a packet to a location. But if routers had to route a packet t... |
There are many efficient algorithms for finding the shortest path in a network, like dijkstra's or bellman-ford's. But what if the weights of edges are time-dependent? I'm trying to find an efficient algorithm to find the path of graph with the lowest cost, where weights of edges depend on what time the edge is being w... |
I know that an existential type $ \exists t. t $ can be represented using universally quantified types as $ \forall r. (\forall t. t \rightarrow r) \rightarrow r $ and I have some basic intuition for this result. I wanted to try to derive this representation by hand to gain more understanding of it. I tried the followi... |
I looked at all possible options for $vx$ when you look at $z = uvwxy$ and can't find a contradiction in the case where $b$'s and $c$'s are in $vx$.
|
Suppose I have a graph $G=(V,E)$, where each edge $e$ has both a non-negative length $\ell(e)$ and a non-negative cost $c(e)$. Given a start node $s$ and a destination node $t$, I want to find a set of Pareto-optimal paths $s \leadsto t$. In other words, for each budget $b$ in some set (say $\{0,1,2,\dots,B\}$), I wa... |
I'm looking for an example of a randomized algorithm that halts with probability 1 (halts almost surely), uses only logarithmic space (worst case) and whose expected run time is not polynomial in the size of the input.
|
Link to the problem: https://codeforces.com/problemset/problem/1221/A.
The problem:
You are playing a variation of game 2048. Initially you have a
multiset $S$ of $n$ integers. Every integer in this multiset is a
power of two.
You may perform any number (possibly, zero) operations with this
multiset.
During each opera... |
I am working on a uni project, for which i will model synthetic electricity consumption time series using Markov-Chains. I am reading through current academic literature on that topic and came across an interesting paper (link below).
The authors use a 24x24 probability matrix for the different states that a household ... |
Let $v_i, s_i$ be the value and size of item $i$, let $\rho \in \mathbb{R}$, n be the maximum number of items. Then we add items based on $\frac{v_i}{s_i^{\rho}}$ in decreasing order. I was trying to understand a proof in a paper, but I get stuck at some points. The utility function $u_{\rho}$ is the value of items sel... |
I just read the definition of lambda calculus. Apparently it's Turing complete, but I tried writing a very simple function and I couldn't:
f(a)=b
f(b)=a
f(x)=x otherwise
so it just swaps the variables a and b.
Functional languages already have conditions which makes it easy, but how do you do it using only abstraction... |
I'm doing this problem https://leetcode.com/problems/maximum-alternating-subsequence-sum/ and attempting to change my code to use a matrix/array. I'm unable to figure out what the dimensions are. Drawing it out hasn't made it clear for me either and I think I'm missing a core concept or the recurrence relation. As far ... |
List $[E1,E2,...,Ek]$ in lambda expression can write as
$$λc.λn.cE1(cE2(...(cEkn)...))$$
Based on this, how to define head and empty lambda expressions
So that
$head[M..]$
can be beta reduce to M
and
$empty[]$ can be beta-reduce to True
$empty[N..]$ can be beta-reduce to False
So far I only figured out the True and Fal... |
In wiki, PTM are defined with two transition functions and a fair coin toss which determines which one is used at each step. One can also define them, much like NDTM, using a transition relation where in each step the machine chooses from its next possible configurations using a fair probabilistic choice. My question i... |
I want to form data structure for nearby neighbor search for 3D coordinates. What is the best way to do so?
|
Given that both $P \subset \mathit{NP}\ ?$ and $P^{\mathit{NP}} \subset \mathit{NP}^{\mathit{NP}}\ ?$ are open questions.
Is it possible that
$P \subset \mathit{NP}$ and $P^{\mathit{NP}} =\mathit{NP}^{\mathit{NP}}$?
Or is it the case that $P \subset \mathit{NP}$ iff $P^{\mathit{NP}} \subset \mathit{NP}^{\mathit{NP}}$?
|
n people named i are invited to a party. They are a(i) years old.
We want to position them on some tables by obeying the following criteria:
Each guest must sit around a table.
Each table should have at least 3 guests around.
The sum of age of each two adjacent guests around a table should be a prime number.
We need ... |
Considering the recent question "Is there an algorithm whose time complexity is between polynomial time and exponential time?", some commenters observed that merely providing a function with growth strictly between polynomial and exponential answers the question, because it is easy to construct an algorithm with the re... |
Trying to understand 3-SAT self-subsuming process
I've been studying solver theory and am trying to understand some of the basic concepts that I've been reading. In particular, the idea of self-subsuming (if I have the correct terminology here) is confusing me. It appears that it's possible to come to different conclus... |
I'm going through Algorithm Design Manual and it didn't take long before I hit a proof I don't understand. Can anyone point me in the right direction?
From the book:
Problem: Prove that $\sum_{i=1}^n i * i! = (n + 1)! - 1$ by induction.
Solution: The inductive paradigm is straightforward. First verify the basis case (... |
There is the axiom you should always prefer tail-recursion over regular recursion whenever possible. (I'm not considering tabulation as an alternative in this question).
I understand the idea by why is that the case? Is it only because of the compiler can optimize the recursive call in case of tail recursion? if that i... |
The Rabin–Karp algorithm uses a rolling hash function to find a substring matching a pattern:
$$ H = c_1a^{k-1} + c_2 a^{k-2} + c_3 a^{k-3} + \cdots + c_k a^0, $$
where $a$ is a constant, $c_1\ldots c_k$ are the input characters, and $k$ is the number of characters there are in the pattern we are trying to find in the ... |
A linear bounded automaton (LBA) is a restricted TM with finite tape.
Let $A_{LBA} = \{\langle M, w \rangle | M$ is an LBA that accepts string $w \}$. It can be shown that $A_{LBA}$ is decidable: since an LBA has only finite number of configurations, therefore an LBA does not halt iff it cycles. A cycling in the comput... |
Let $G = (V,E)$ be a directed graph with source $s$ and sink $t$ and $s \neq t$.
For each edge $e \in E$, we have $c(e) \in \Bbb N$.
After running Ford-Fulkerson algorithm a flow function $f$ returned a max flow.
Let $R_f$ be the residual network that represents the max-flow $f$.
I would like to prove that if $R_f$ has... |
Recently, I find that automata theory is very useful in computer science, it is used in many fields, such as computer network, digital design, computer architecture and operating system, even we can construct KMP algorithm using the theory of automata. I really wonder if there are any books or articles summing up thes... |
I'm trying to understand this paper and in Figure 1 page 389 there's a projection in the form of $\pi_{d.id : s.id}$. What does the colon mean? Because usually projections are simply $\pi_{name}(R)$
|
If $\sf{P} \ne \sf{NP}$ and $\sf{NP} \ne \sf{coNP}$ are both true then $\sf{P}$, $\sf{NP}$ and $\sf{coNP}$ are three separate complexity classes. In other words, verifying a solution, finding a solution and proving there is no solution to a formula are three separate tasks.
However, if $\sf{P} \ne \sf{NP}$ then both $\... |
In-place Acceptance Problem (InAP)
Instance: A deterministic Turing Machine M and a w input for it.
Question: Does M accept the input w without going through cell (|w|+1)?
Show that InAP is PSPACE-complete.
I am having problems in finding information about InAP and I have no idea how I can show that it is PSPACE-comp... |
Recently, I was having a debate with a friend about what it would mean to create a machine that ZKSnarks (proves) itself. I tossed the word pure machine out there while describing what I hypothesized would be the manner of state transition for such a machine, alluding to the notion of a pure function. I didn't really k... |
I try to understand algorithm from this Wikipedia article. Initially it is talking about some function f. I specifically getting problem in that part. Below is the paragraph which is quite mathematical. Can anyone explain me that?
For any function $f$ that maps a finite set $S$ to itself, and any initial value $x_0$ i... |
Assuming (the unlikely scenario) that the Polynomial Hierarchy collapses to second level. Thus, $\Sigma_2^p=PSPACE$.
How significant this result would be (broad consensus) as compared to the other open problems in TCS (the most important two being $P$ vs $NP$ and $NP$ vs $coNP$).
Most of the sources rightly point to th... |
I watched a video on why the RSA algorithm works and it said that $(M^e \bmod N)^d \mod N = M^{ed} \bmod N$ which makes sense if $M^e$ is smaller than $N$.
Would $M^e$ not be smaller than $N$, the decryption wouldn't work(I know why but there's no reason to explain it here).
So why do we say that the ciphertext is $M^e... |
Generalized chess is EXPTIME complete[1]. Generalized chess is also PSPACE complete[2]. Therefore $EXPTIME = PSPACE$. This implies that $P \neq PSPACE$
This proof is probably wrong. I want to know what I did wrong. They are probably referring to different problems regarding chess. But here are my sources. I can't say i... |
Consider g a function of n: $g(n)$.
Knowing that the function $f(n) \in Θ(g(n))$ and the function $h(n) \notin O(g(n))$, could we conclude anything, related to it's asymptotic behaviour, about $f(n) + h(n)$ with respect to $g(n)$?
Given that $f(n)$ is $Θ(g(n))$, I have that $f(n)$ grows the same way as $g(n)$.
Given th... |
I was looking at the wikipedia page for the Travelling Salesman Problem and found a reference to another exact algorithm besides Held-Karp that's also $O(2^nn^2)$.
Specifically: "This bound has also been reached by Exclusion-Inclusion in an attempt preceding the dynamic programming approach."
Can you explain how that a... |
Consider a circuit belonging to the class $\text{NC}^i$, as defined here.
From my understanding, the circuit consists of AND, OR ar NOT gates, each of bounded fan in --- without loss of generality, let the fan in be $2$ --- with $\log^{i} n$ depth and polynomial size.
Now, let's say we define a different circuit class,... |
I need to compute the time and space complexity in Big O notation for this algorithm I constructed for binary multiplication.
mul(a, b) =
- 0 if a = 0 or b = 0
- (b + p) if lowest(a) != 0
- p if lowest(a) = 0
where
p = join(mul(higher(a), b), 0)
lowest(a) returns the lowest order bit of a binary numeral a
e.g... |
A binary decision tree (DT) is a binary tree whose internal nodes are labelled by boolean variables (with repetitions), and whose leaves are labelled either $0$ or $1$. The size of a decision tree is the number of branches (or equivalently the number of leaves).
A DT determines a unique Boolean function of the variable... |
Consider simple tabulation algorithm firstly for Fibonacci numbers.
We will use the dictionary as a cache (and Python as example PL):
def fib_tab(n):
tab_dict = {1: 1, 2: 1}
for ind in range(3, n + 1):
tab_dict[ind] = tab_dict[ind - 1] + tab_dict[ind - 2]
return tab_dict[n]
Notice that for n < 1 fi... |
Given is the modified definition of a TM where everything is equal except for one change: $\Gamma=\Sigma\cup \mathbb{N}\cup\{\square\}$
How do I prove that there is a TM $M$ for any language $L\subseteq\Sigma^*$ while $\Sigma=\{a,b\}$ and $\Sigma\cap\mathbb{N}=\emptyset$ so that $T(M)=L$?
|
It is seldom considered that floating points are not evenly distributed in the real number line. I've been working with interval arithmetic and noticed when bisecting $[a,b]$ on the real number line into $[a,(a+b)/2]$ and $[(a+b)/2,b]$ starting from $[-1.3552646593344489*10^{308}
,0]$ until $a,b$ are neighboring floats... |
Git seems to use the two most significant hex digits of a content hash as a directory name for content-addressable objects. The same two digits are left out of normal file names. I'm assuming the intent is to limit the size of directory listings, while maintaining a relationship between names and content.
objects
├── 0... |
Finding a loop in a linked list is a classic algorithm but I found an off-by one case that is making me question my sanity, this first solution works:
def findLoop(head):
def p(s, f):
print(f'slow: {s.value}, fast: {f.value}')
slow = head.next
fast = head.next.next
while slow is no... |
Imagine you loop n times, and every iteration you create a string of space n with scope only within that iteration (thus it is no longer accessible in the next iteration). I would look and say that I use O(n^2) space because, for n iterations, I use n space.
However, logically, if every loop you destroy the previous it... |
Given two unrelated languages $L_0$ and $L_1$ contained in some complexity class $C$. Is the language $L_x=L_0\times L_1= \{(x,y)|x\in L_0, y\in L_1\}$ always contained in $C$?
And if that is the case, can we just extend this recursively and create a single language $(L_{All})$ from all other languages contained in $C$... |
Most computation theory textbooks just mention the equivalence of PDAs and Context Free Grammars. I'm able to construct a PDA from a given CFG, but find it very difficult to write an algo to check if a PDA accepts a string or not. Some would recommend the CYK algorithm, but that's for a CFG in CNF, not for a PDA. If th... |
Is there a programming language with named return values?
I imagine something like in the following (syntax to be workshopped):
def f(a, b):
export c = a * b
d = 3*c
export e = c + d
and then
from f(4, b=5) import *
print(c, e)
This would obviate the need to repeat variable names (now done by defining out... |
Problem statement: You are in a 2D grid where you can move in any of the 4 directions, no obstacles. You start at position (0, 0).
We say that you partially cover a point $(x,y)$ if your position has the same abscissa or the same ordinate (or both).
You are given an ordered sequence of n points $(x_1,y_1), ..., (x_n,y_... |
I'm trying to understand what is necessary to guarantee that a problem has a greedy algorithm that always produces optimal solutions.
In multiple places I find that a greedy algorithm can be constructed to find the optimal solution if the problem has two properties:
Optimal substructure
Greedy choice
There is one thi... |
Given a directed weighted graph $G = (V, E, w)$, we refer to the max flow when $x$ is the source and $y$ is the sink in the flow network of the graph $G$ as $f_{x,y}$.
I'm searching for a formal proof for the following inequality:
$$f_{a,c} \ge \min (f_{a,b},\,f_{b,c}).$$
I'm pretty sure that the proof relies on the ma... |
I discovered this issue last night & can't make sense of it. Numerical biases programming sounds ridiculous but the code is the same, only changing the denominator from 4 to 5 and changing the corresponding values and outputs. Why does the 4 denominator work but the 5 doesn't?
#include
using namespace std;
double main... |
I have a question regarding the theory behing solving Lasso's optimization problem via ADMM.
Let's look at this pdf https://candes.su.domains/teaching/math301/Lectures/Consensus.pdf.
First rewrite the problem (26.1) as (26.2), by adding the variable $z$, this is clear.
What is $y$ in the augmented Lagrangian (just one ... |
I'm a mathematician and the following came up in my research:
Fix some positive integers $a_0,...,a_n$ and $N$.
Consider subsets $A_i \subset \{0,...,N\}$ where $|A_i|=a_i$, subject
to some fixed conditions of the form: $A_{i_0}=A_{j_0}\sqcup A_{j_1}\sqcup ... \sqcup A_{j_t}$. (See an example below).
I want to code an... |
The question is quite short. Let $k$ be a given number. What is the maximal length of $k$-CNF formulae can we compute, over the set of binary variables $\left\{ x_1 ,\ldots, x_n \right\}$?
The way I see it, if we ignore the $k$ for a minute, we have $2^n$ different binary sequences, each sequence is a $1-1$ representat... |
The fastest algorithm I could find that finds the chromatic number of an undirected simple graph exactly in only polynomial-space is "Faster Graph Coloring in Polynomial Space" by Gaspers and Lee (DOI: 10.1007/978-3-319-62389-4_31). It's running time is $O(2.2356^n)$.
However that's from 2016/2017, so I'm wondering whe... |
For my programming project I need to implement a local search algorithm. The generic local search algorithm is easy to understand but the thing I am most struggling with is how to deal with the neighbourhood.
It seems that when you implement such an algorithm, you don't explicitly state the neighbourhood but you declar... |
Recently I came upon the Johnson's algorithm to find "elementary circuits" on a directed graph, which is really cool to me. I'm just implementing it from scratch in C++ following the original Johnson's paper
I have a couple of doubts before going on.
In the paper it's clear to me what $A_k$ about adjacency, but in the ... |
Let $m$ and $n$ be two integers, where $m \leq n$.
Suppose you are given $m^2$ matrices $W^{i,j} \in \mathbb{R}^{n \times n}$ for $i, j \in \{1, \dots, m\}$.
The goal is to find a sequence $a$ of $m$ integers $a_i \in \{1, \dots, n\}$ minimizing
$$
\min_a \sum_{i=1}^m \sum_{j=1}^m W^{i,j}_{a_i, a_j}
$$
Does this proble... |
Not problems like chess. I'm thinking problems that would be very useful to be able to solve in sub-exponential time. These would be problems not known to be EXPTIME complete.
Edit I mean problems that are not known to be in NP and assuming $NP \neq EXP$, Problems that are thought in EXP but there could hypothetically ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.