instruction
stringlengths
0
29.8k
⌀
Let $\mathcal{G}$ be a graph class. For any class $\mathcal{H}$, we know that the minimal number of vertices that has to be removed from $G\in \mathcal{H}$ such that we get a graph from $\mathcal{G}$ is at most twice the number of edges that has to be removed from $G$ in order to obtain a graph from $\mathcal{G}$. E...
null
Given an optimization problem $X$, it is easy to [construct a decision problem][1] $Y$, such that there is a two-directional polynomial-time reduction between $X$ and $Y$. Therefore, we can define a class of optimization problems "$P^O$", which is the class of all optimization problems whose corresponding decision pr...
Decision version of optimization problems with polynomial-time approximation algorithms
|optimization|approximation|decision-problem|complexity-classes|
{"Voters":[{"Id":1342,"DisplayName":"Erel Segal-Halevi"}],"DeleteType":1}
null
{"Voters":[{"Id":1342,"DisplayName":"Erel Segal-Halevi"}]}
Given an optimization problem $X$, it is easy to [construct a decision problem][1] $Y$, such that there is a two-directional polynomial-time reduction between $X$ and $Y$. Therefore, we can define a class of optimization problems "$P^O$", which is the class of all optimization problems whose corresponding decision pr...
There are $n$ persons want to order food online. They plan to eat pizza. Each student has several favorite toppings (such as mushrooms, onions, garlic, sausage, etc.). Each student wants to eat at least half a pizza, and the toppings on the pizza must be her/his favorite Assuming that each pizza can only add one toppin...
Need help solve a problem
|algorithms|
Suppose you are given a bit string $B[1 ... n]$. Now, suppose that some bits are just padding bits conveying no information, the rest of the bits may be permuted and some meaningful (that is, non-padding) bits should be inverted from $0$ to $1$ and vice versa. According to my intuition, the total number of interpret...
For context free languages, I wonder that if all LL(k) languages can be recognized by a LR(1) grammar?
Can all LL(k) grammar can be recognized by LR(1)?
null
There are $n$ persons want to order food online. They plan to eat pizza. Each student has several favorite toppings (such as mushrooms, onions, garlic, sausage, etc.). Each student wants to eat at least half a pizza, and the toppings on the pizza must be her/his favorite Assuming that each pizza can only add one toppin...
A problem similar to the Packing problem
``` CREATE TABLE issue ( ID varchar(36) not null, title varchar(255), issue_num varchar(255), release_year year, comic_language_code varchar(3), edition varchar(255), PRIMARY KEY (ID) ); ``` From the example SQL code above, it breaks BCNF if the ID is a surrogate key that can uniquely identify all ...
I have come across this question in an abstract reasoning test: [![A figure of three rows demonstrating clues to a puzzle. Each row has an initial figure, e.g. A small white circle with a horizontal line across it, followed by a set of five dots. Each dot is either black, indicating a function attributed to that dot...
Generate clues to a puzzle so that it always has a solution
|algorithms|
null
There are $n$ students want to order food online. They plan to eat pizza. Each student has several favorite toppings (such as mushrooms, onions, garlic, sausage, etc.). Each student wants to eat at least half a pizza, and the toppings on the pizza must be her/his favorite Assuming that each pizza can only add one toppi...
null
If the events occur at random, unknown times, all you can get are random samples of the signal, and by collecting enough of them, the statistical distribution of the signal values. If the signal is known to be monotonic, say increasing, with a neglectable falloff time, you can retrieve it by inverting the cumulative...
I am going to try and make django/react web app of a solver to 2 dimensional [cutting stock problem][1] I am kinda lost with all the math in the papers online. I did make a greedy algorithm successfully but i want a more efficient solution. Is there any resources/methods that may help me start in the algorithm? ...
Creating an algorithm for 2d cutting stock problem
|algorithms|optimization|
null
The pre-trained model is used as the encoder model within the U-Net. For a high-level example, see this github below, in which pre-trained encoder is specified as input arg for the U-Net segmentation model. https://github.com/qubvel/segmentation_models.pytorch
Give a class $\mathcal{H}$ of predictors from the set X to $\{0,1\}$. Here each $h \in \mathcal{H}$ is a function from $h: X \longrightarrow \{0,1\}$. The Empirical Risk Minimization is defined as $$ERM_{\mathcal{H}} \in Arg min_{h \in \mathcal{H}} (L_s(h))$$. Where $S=\{(x_1,y_1,\cdots,(x_m,y_m))\}$ is a sample $L...
Difference between paradigm and Algorithm in Machine Learning
|algorithms|machine-learning|
Give a class $\mathcal{H}$ of predictors from the set X to $\{0,1\}$. Here each $h \in \mathcal{H}$ is a function from $h: X \longrightarrow \{0,1\}$. The Empirical Risk Minimization is defined as $$ERM_{\mathcal{H}} \in Arg min_{h \in \mathcal{H}} (L_s(h))$$ Where $S=\{(x_1,y_1,\cdots,(x_m,y_m))\}$ is a sample $L...
null
A paradigm is an abstract concept. It is a general method useful to know to solve a problem and/or construct algorithms, but not a particular algorithm. In your example, the paradigm is to minimize the empirical risk. But it does not say how to perform the minimization concretely.
A paradigm is an abstract concept. It is a general method useful to know to solve a problem or construct algorithms, but not a particular algorithm. In your example, the paradigm is to minimize the empirical risk. But it does not say how to perform the minimization concretely.
null
The partitioning scheme is not stable because of this: it focuses on gathering elements lower than the pivot into a lower partition of the table. But as it is doing so, it kicks elements out of that lower partition to make room. It has nowhere to kick an element, other than by exchanging it with the element which is ta...
null
In some sense these questions are never solvable, because the problem is ill-defined. There always exists multiple candidate solutions that are consistent with the information provided. As such, a mathematician who is being pedantic might say these types of questions are lame. Let me give you an analogy. I'm thin...
null
The lambda caculus equals to Turing Machine,so What is lambda caculus's "fix point combinators" corresponding to Turing Machine? according to the paper <Primitive Rec, Ackerman's Function, Decidable, Undeciable, and Beyond Exposition by William Gasarch>,Turing Machine can: The machine acts in discrete steps. At a...
What is lambda caculus's "fix point combinators" corresponding to Turing Machine?
|turing-machines|computability|lambda-calculus|functional-programming|
I am interested in the traditional graph partitioning problem, which roughly speaking seeks to obtain a partition of a graph into a number of components, in which each component has about the same size (either in terms of number of nodes or sum total of node weight), and the sum total weight of edges that cross between...
Does there exist an algorithm / software that finds optimal graph partition while enforcing contiguity on a subgraph?
|graphs|optimization|partitions|minimum-cuts|
There are $n$ students want to order food online. They plan to eat pizza. Each student has several favorite toppings (such as mushrooms, onions, garlic, sausage, etc.). Each student wants to eat at least half a pizza, and the toppings on the pizza must be her/his favorite Assuming that each pizza can only add one toppi...
Suppose I have an undirected graph $G=(V,E)$, and boolean variables $x_v$ (one for each vertex $v \in V$). These variables select a subset $S \subseteq V$ of vertices, namely the vertices $S=\{v \mid x_v\}$ whose corresponding boolean variable is true. I want to express the constraint that $S$ is connected, i.e., ...
Boolean constraints for a connected component of a graph
|satisfiability|integer-programming|constraint-programming|connected-components|connected|
Here is one encoding. Introduce boolean variables $x_{v,i}$, with the intended meaning that $x_{v,i}$ is true if $v$ is selected and $v$ can by reached by a path of length $\le i$ from $s$ (where $s$ is some starting vertex). You can force the $x_{v,i}$'s to have the desired meaning, by adding the following constra...
If your graphs aren't too large, you could try to solve this using an integer linear programming (ILP) solver. Introduce 0-or-1 variables $x_{i,v}$, to indicate that vertex $v$ is part of the $i$th component. You can enforce that each component is connected ("contiguous") using the techniques in https://cs.stackexc...
There are $n$ students want to order food online. They plan to eat pizza. Each student has several favorite toppings (such as mushrooms, onions, garlic, sausage, etc.). Each student wants to eat at least half a pizza, and the toppings on the pizza must be her/his favorite Assuming that each pizza can only add one toppi...
null
Hi I understood it is not currently possible to solve SAT in polynomial time. Does this mean we can not currently solve an expression with n different boolean variables or with m different symbols in the expression in polynomial time with respect to n? For example : ( A or B ) and ( not not A and B ) The diffe...
SAT polynomial time
|algorithms|time-complexity|algorithm-analysis|logic|satisfiability|
In any scenario/students' choice of toppings, you don't have to order more than $n$ pizzas - each student picks one for themselves with one of their favorite topping. Another observation - you will always have to order at least $\lceil\frac{n}{2}\rceil$ pizzas, because any student can eat no less than half a pizza. ...
null
The following is a ticket Dispenser Mechanism, it's from the article: "Closing the Complexity Gap between FCFS Mutual Exclusion and Mutual Exclusion By Robert Danek and Wojciech Golab" http://www.cs.toronto.edu/~rdanek/fcfs_disc.pdf ``` shared variables: Tickets: array[0..7N-1] of {INUSE, FREE } initially ...
Ticket Dispenser algorithm and the size of the Ticket array
|algorithms|distributed-systems|
[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/5STV0.png For this question I figure we need to define a system of linear inequalities which I thought could be something like this : <br> a1x1 + a2x2 + ... + anxn ≥ b if (x1, x2, ..., xn) ∈ X <br> a1x1 + a2x2 + ... + anxn ≤ b if (x1, x2,...
Showing there exists a polynomial-time algorithm for deciding the existence of a linear classifier
|complexity-theory|np-complete|np-hard|np|polynomial-time|
In general, asymptotic complexity concerns itself with the size of the input. In this case, the number of input symbols. SAT is thus not polynomially solvable in the worst case as a function of the number of symbols. It is also not polynomially solvable with respect to the number of unique variables. This is trivia...
null
In a video Noam Chomsky said, that if these LLM get bigger, than also the things they are not good at get bigger too. He doesn't explain more details about this. So is this true? In what way do their problems get bigger? Sry for the little context of in what they are getting also more bad at. here is the video: (it...
I have the following question to solve;<br> Given `K` BST consisting of `N` total elements, show how you can create a Red Black Tree in `O(NlogK)` time. ---------- I had the following idea but it falls on the last part of insertion into the red black tree; Get an inorder scan of each BST (total of `O(N)`)...
Merge K BST into a single RBT
|algorithms|time-complexity|binary-search-trees|red-black-trees|
null
In any scenario/students' choice of toppings, you don't have to order more than $n$ pizzas - each student picks one for themselves with one of their favorite topping. Another observation - you will always have to order at least $\lceil\frac{n}{2}\rceil$ pizzas, because any student can eat no less than half a pizza. ...
Your idea of maintaining a min-heap of $K$ elements is great. You "extract the min value from the auxiliary heap and insert it into the RBT". When you insert it into the RBT, you are not taking advantage of the information that it is the largest element so far. You are treating it just like an arbitrary element, whi...
Consider the system of inequations having the $a_k$ and $b$ for unknowns. $$\forall x\in X:\sum_{k=1}^n x_ka_k-b\ge 0, \\\forall y\in Y:\sum_{k=1}^n y_ka_k-b< 0.$$ This system is made of a polynomial number of equations in $n+1$ unkonwns. By the Linear Feasibility, you can determine if the system has a solution ...
I have the following question to solve; > Given $K$ BST consisting of $N$ total elements, show how you can create a Red Black Tree in $O(N\log K)$ time. I had the following idea but it falls on the last part of insertion into the red black tree; Get an inorder scan of each BST (total of $O(N)$) into lists. F...
Merge K BST of N elements in total into a single RBT in O(N log K) time
Your idea of maintaining a min-heap of $K$ elements of the form `(value,list_index)` is great. You "extract the min value from the auxiliary heap and insert it into the RBT". When you insert it into the RBT directly, you are not taking advantage of the information that it is the largest element so far. You are treat...
null
If your graphs aren't too large, you could try to solve this using an integer linear programming (ILP) solver. Introduce 0-or-1 variables $x_{i,v}$, to indicate that vertex $v$ is part of the $i$th component. You can enforce that each component is connected ("contiguous") using the techniques in https://cs.stackexc...
|graphs|satisfiability|integer-programming|connected-components|connected|
The lambda calculus is not "equal" to Turing machines. There is a correspondence, but it is not equality, it's one of simulation. You should not expect every aspect of one to have a corresponding counterpart in the other. For instance, it does not make sense to as "what does the Turing machine head correspond to in lam...
TL-DR; $10$ Yes, you need to have possibility to ask up to $10$ questions to (comparison) sort an array of $6$ elements. However, it is possible to create an optimal algorithm that will require no more than 10 questions in worst case, but in average **only** $9.57777$ questions (in $416$ cases $10$ comparisons, i...
The lambda calculus is not "equal" to Turing machines. There is a correspondence, but it is not equality, it's one of simulation. You should not expect every aspect of one to have a corresponding counterpart in the other. For instance, it does not make sense to ask "what does the Turing machine head correspond to in la...
null
null
null
null
TL;DR version: Your initial statement was accurate - I'll add some more clarity (hopefully) for people who come across this post later on: The formal definition (from Daniel I.A. Cohen in ): A **transition graph**, abbreviated TG, is a collection of three things: 1. A finite set of states, at least one of which...
TL;DR version: Your initial statement was accurate - I'll add some more clarity (hopefully) for people who come across this post later on: The formal definition (from Daniel I.A. Cohen): A **transition graph**, abbreviated TG, is a collection of three things: 1. A finite set of states, at least one of which is ...
If we consider the class fair division problem where we have a set of $n$-agents and a set $M$ of $m$-items, where each agent has a valuation function defined on the set of items $$v_i : 2^m \rightarrow \mathbb{R}$$ The problem is to find an allocation across the $n$ agents $(A_1, ..., A_n)$ such that no agent envie...
Envy-Free Allocation is NP-Hard
|algorithms|complexity-theory|algorithm-analysis|np-hard|game-theory|
null
I was just reading [this](https://quantumcomputing.stackexchange.com/questions/24082/what-is-the-complexity-of-hidden-subgroup-problems) question on the quantum computation stack exchange. It asks whether the HSP is in NP or not, and the answer notes that NP is a class of languages, not oracle problems. The answer t...
Analogue of NP for oracle problems
|complexity-theory|reductions|np|oracle-machines|polynomial-time-reductions|