instruction
stringlengths
0
29.8k
⌀
|reference-request|computer-networks|memory-hardware|
This is a problem from my Algorithms course in uni There are $n$ students, each have a single book. They come into a party to exchange books among themselves. Each have a list of students that have the book that they want. Give and prove an algorithm that says if a switch of books is possible, i.e. every student ...
Suppose you have three modules $m_1,m_2$ and $m_3$, each with a capacity of $c_i$ and area $a_i$. How can I find some of the solutions to choosing an amount of each module so that the total sum of areas is exactly $A$ and the sum of the capacities is exactly $C$?. I tried to formulate this as an optimization problem bu...
Finding some solutions to this problem
|algorithms|optimization|
You have already figured out that $f^{-1}(x)$ can be used as a potential NP certificate. You are just missing the crucial part in the definition of NP. You don't have to compute the certificate, you can non-deterministically guess this certificate and verify if it is a good certificate in polynomial time. How hard ...
You have already figured out that $f^{-1}(x)$ can be used as a potential NP certificate. You are just missing the crucial part in the definition of NP. You don't have to compute the certificate, you can non-deterministically guess this certificate and verify if it is a good certificate in polynomial time. How hard ...
This idea blows my mind, I would appreciate for any guidance. In essence, the question is how a machine should work to transform any kind of formal logic into its graphical representation (e.g. conceptual graph)? And moreover, from graphs into linear form. I have heard about ISO standard for Common Logic framework. ...
|reference-request|logic|graphics|knowledge-representation|
If you reformulate this problem as a graph problem with students as the vertices and directed edge from $i$ to $j$ when $i$ wants $j$'s book, then this problem translates to find a sub-graph over all vertices which is a union of simple directed cycles. You can probably do this by computing the SCC decomposition and ...
If you reformulate this problem as a graph problem with students as the vertices and directed edge from $i$ to $j$ when $i$ wants $j$'s book, then this problem translates to finding a sub-graph over all vertices which is a union of simple directed cycles. You can probably do this by computing the SCC decomposition a...
null
Given an adjacency matrix or other data based on the nodes, there are many algorithms for determining whether the graph is acyclic (e.g. row reduction or leaf trimming). If I have only a set of nodes (e.g. {(a,b), (b,c), (d,b)}), I could obviously convert that into an adjacency matrix and proceed from there. I'm ...
Is there an algorithm to test for an acyclic undirected graph, using edge data, not node data (e.g. adjacency matrix)
|algorithms|graphs|
(I reorganized my question.) We have a function $f$ mapping the integers $\{1, . . . , 2^k\}$ ONTO the integers $\{1, . . . , 2^k \}$ such that when these integers are represented in binary, and $f$ is polynomial time computable but the inverse function $f^{-1}$ is not polynomial time computable. Define a language $L ...
null
Define a graph problem as follows. Given a graph $G$ and two integers $c$ and $k$, delete $k$ nodes and all edges incident to them, such that, in the remaining graph, every connected component has at most $c$ nodes. What can I say about the time complexity class of the above problem? I can easily prove that under...
How much does proving that a special case of a problem is NP-complete tell me about if the general problem is NP-complete?
|graphs|time-complexity|np-complete|
Define a graph problem as follows. Given a graph $G$ and two integers $c$ and $k$, delete $k$ nodes and all edges incident to them, such that, in the remaining graph, every connected component has at most $c$ nodes. What can I say about the time complexity class of the above problem? I can easily prove that under...
If a problem $P'$ is a special case of problem $P$, this means that $P'$ can be reduced to $P$. Therefore, if $P'$ is NP-hard, it follows that $P$ is NP-hard (because if any problem $H$ in NP can be reduced to $P'$, then it can also be reduced to $P$). If you also have a proof that $P$ is in NP (your proof of polyno...
null
You could use a disjoint set (union-find) data structure, iterate through the edges one by one. For each edge $(u, v)$, if they already belong to the same subset, then the graph is not acyclic. Otherwise, you merge the subset containing $u$ with the subset containing $v$. If all edges are added successfully, the graph ...
Given an adjacency matrix or other data based on the nodes, there are many algorithms for determining whether the graph is acyclic (e.g. row reduction or leaf trimming). If I have only a set of edges (e.g. ${(a,b), (b,c), (d,b)}$), I could obviously convert that into an adjacency matrix and proceed from there. I'...
null
You could use a disjoint set (union-find) data structure and iterate through the edges one by one. For each edge $(u, v)$, if the two vertices already belong to the same subset, then the graph is not acyclic. Otherwise, you merge the subset containing $u$ with the subset containing $v$. If all edges are added successfu...
Let us use math a bit. What we need is the method of elimination of variables and the extended Euclidean algorithm that solves linear Diophantine equation of two variables. Throughout the explanation below, I will skip various easier cases so that we can focus on the main idea. ------ Let the amount of $m_i$ be $...
null
I'm trying to break down the Time complexity algorithm for IDDFS. Acknowledging that in general my understanding of maths is not that great. So I will be trying to talk things out. [![enter image description here][1]][1] For BFS it is intuitive to me that we take the exponent of each level of depth since we are e...
Trying to understand the time complexity of IDDFS
|algorithms|data-structures|big-o-notation|
null
null
You can read the details of the analysis of the algorithm [here](https://en.m.wikipedia.org/wiki/Iterative_deepening_depth-first_search). But the idea is the deepest nodes in the graph with respect to a specified source/root node will be visited once, and there are at most $b^d$ of them. That accounts to the last t...
You can read the details of the analysis of the algorithm [here](https://en.m.wikipedia.org/wiki/Iterative_deepening_depth-first_search). But the idea is that the deepest nodes in the graph with respect to a specified source/root node will be visited once, and there are at most $b^d$ of them. That accounts to the l...
#### An approach that uses [integer linear programming (ILP)](https://en.wikipedia.org/wiki/Integer_programming) The given condition can be consider the requirement $AX+s=b$ of an ILP in standard form. However, as noted in the question, there is no function to maximize. Well, that is not big obstacle at all. We can sp...
Suppose you have three modules $m_1,m_2$ and $m_3$, each with a capacity of $c_i$ and area $a_i$. You are also given $A$ and $C$. How can you find some of the solutions to choose an amount of each module so that the sum of areas is exactly $A$ and the sum of the capacities is exactly $C$? All variables including the am...
Given required total area and capacity, choose an amount for each of three given modules
|algorithms|optimization|integer-programming|diophantine-equation|
#### An approach that uses [integer linear programming (ILP)](https://en.wikipedia.org/wiki/Integer_programming) The given condition can be consider the requirement $AX+s=b$ of an ILP in standard form. However, as noted in the question, there is no function to maximize. Well, that is not big obstacle at all. We can sp...
In what paper(s), textbook(s), and/or classnote(s) can I find a detailed proof of the completeness of a certain proof system for PLTL (Propositional Linear Temporal Logic)?
Assume $$C_1 = (x_1 \lor x_2 \lor \lnot x_3)\hspace{0.2cm} C_2 = (x_4 \lor x_5 \lor x_3) \hspace{0.2cm} C_3 = (x_3 \lor x_5 \lor x_6)$$ Let $$ \phi_1 = C_1 \land C_2 \land C_3$$ and $$ \phi_2 = (x_1 \lor x_2 \lor x_4 \lor x_5) \land (x_3 \lor x_5 \lor x_6)$$ Question --- Are the two formulas $\phi_1, \phi_2$...
How can I assert if two boolean formulas are equisatisfiable?
|satisfiability|boolean-algebra|
Is this a valid method to merge clauses in CNF formulas?
Say that I am given a graph $H$ and a graph $G$ where the maximum degree of $G$ is known. How can I use BFS to find out if $H$ is an induced subgraph of $G$ in $O(n)$ time? My current take is the following: - Run BFS on $H$ and take note of the layer depth. - Assume I have a function $g(x)$: $H_{nodes}$ -> $G_{no...
Algorithm for detecting if H is a induced subgraph of G in O(n)
|graphs|time-complexity|breadth-first-search|
Given a finite set of integers $Z$ and a number $z$, I would like to check if there exists a subset $A=\left\{ a_1,...,a_{\left| A\right|}\right\}\subseteq{Z}$ and a set of $\left| A\right|$ numbers $k_1,...,k_{\left| A\right|}$ such that: $$ \sum_i k_i \cdot a_i = z$$ It is a generalization of regular subset, an...
Unlimited use subset sum
|complexity-theory|turing-machines|subset-sum|recursively-enumerable|
null
Given two sets of values $a_1, a_2, ... a_n$ and $b_1, b_2, ... b_n $ what would be a good way to shuffle them together while keeping $a_i$ and $b_i$ at least $gap$ spots apart? For example, if we have `A B C` and `a b c`, then `b A C a B c` is a valid 2-gap shuffle, but not a valid 3-gap shuffle (because of the a's...
Shuffling two related sets together
|randomized-algorithms|
Say that I am given a graph $H$ and a graph $G$ where the maximum degree of $G$ is known. How can I use BFS to find out if $H$ is an induced subgraph of $G$ in $O(n)$ time? My current take is the following: - Run BFS on $H$ and take note of the layer depth. - Assume I have a function $g(x)$: $H_{nodes}$ -> $G_{no...
The problem is that you have to transform the input for the original machine into a unary input for the unary machine. This cannot be done in polynomial time in the size of the original input, therefore your proposed algorithm is not a $\mathsf{P/poly}$ algorithm.
You can read the details of the analysis of the algorithm [here](https://en.m.wikipedia.org/wiki/Iterative_deepening_depth-first_search). But the idea is that, the target node will be found at depth $d$, with respect to a specified source/root node. Then this node, along with all other nodes with the same depth, wi...
Recently, I’ve been interested in the console of the Source game engine, more specifically, its `alias` command, which allows one command to invoke others. It may allow recursion (i.e. running `alias freeze freeze` will cause inputting `freeze` to freeze the engine), but does not allow parameters (i.e. running "`alias ...
I've been reading the [following paper][1] (open) by Fraenkel and Lichtenstein that shows that the Generalized $n \times n$ Chess problem ($\texttt{CHESS}$) is $\texttt{EXPTIME-complete}$. They start by proving that $\texttt{CHESS}$ is in $\texttt{EXPTIME}$, but I don't understand at all the fragment highlighted in pin...
Why is this proof that CHESS is in EXPTIME correct?
|algorithms|time-complexity|search-algorithms|board-games|
If you keep track of previous computation, then the same configuration appearing multiple times would not require multiple computations. That means that a Min-Max algorithm would require a time complexity linear in the number of configurations times the number of possible moves for a given configuration. This is ind...
null
null
“X is NP hard” means: Any instance of any problem Y in NP can be solved by constructing and solving the right problem in X. “X is NP complete” means that in addition X is in NP. If a subset P’ is NP complete or NP hard, then obviously P is NP hard: Just pick the same instance to solve any instance of an NP problem,...
null
Compute $g = \gcd(z_1,z_2,\dots,z_n)$, where $Z=\{z_1,\dots,z_n\}$. If $g | z$, then you can use the [extended Euclidean algorithm](https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm) to find such a linear combination. Otherwise, there does not exist any solution.
null
null
Program Counter- it is a location where the instruction executed is stored at a current time, and where the next execution is set.
[![enter image description here][1]][1] I'm really confused when it comes to what the difference between bias and threshold is. I have read that they are basically the same thing and that they serve the same purpose. Being on opposite sides of the equation, though, they are "negatively proportional". The equatio...
Draw the decision boundary of an neural network
|machine-learning|artificial-intelligence|neural-networks|perceptron|
null
as the title says Can we solve a decision problem with two identical answers like $false\equiv(\lambda f.\lambda y.y)$ or $0\equiv(\lambda f.\lambda n.n)$? if no why? and if yes then why can't we decide whether a lambda term is in normal form or not? thanks
Can we solve a decision problem with two identical answers like $false\equiv(\lambda f.\lambda y.y)$ or $0\equiv(\lambda f.\lambda n.n)$?
|lambda-calculus|normal-forms|
After accepting the command entered by user,the shell generates a readily executable simple command line by parsing it evaluating variables(if present),performs command substitution,interprets metecharacters like * and ?(if present) and identifies the PATH. Can anyone explain to me in simple terms the parsing par...
If I understand your question, I do not think so. That is, maybe the premise $\mathscr{A}$ is used for multiple things in the proof. Consider the following proof of $\mathscr{B}=(A\rightarrow (B\rightarrow C))\rightarrow (A\wedge B \rightarrow C)$: $$\rightarrow I_2\cfrac{\rightarrow E\cfrac{\rightarrow E \cfrac{\we...
Instructions are not necessarily of length 1 (byte). After an instruction has been read from memory and interpreted*, the address held by program counter is incremented by the appropriate number of bytes (simply using an adder), ready to fetch the next instruction. *In case of variable length instructions, the in...
Someone suggested to me that the halting problem could be solved by a lambda calculus "program", which reduces to $\lambda y.y$ if an input program halts and $\lambda n.n$ if it does not. Therefore it is not possible to extend this into a program that halts if it thinks it doesn't halt. (That's just background, not the...
Are lambda calculus forms with different variable names the same?
|lambda-calculus|
This is a question about Unix and shell programming. When you run a command like `cp dir/* $destination` the shell has to do several things to simplify this command before executing it: * Replace `dir/*` with a list of all the paths matching `dir/*` e.g. `dir/file1 dir/file2 dir/file3` * Replace `$destination` with...
I don't get why SCAN is used when LOOK exists. Why move to the end, when there are no longer any pending requests in that direction? * SCAN: In SCAN algorithm the disk arm moves into a particular direction and services the requests coming in its path and after reaching the end of disk, it reverses its direction and ...
Disk scheduling: Why use (C-)Scan instead of (C-)Look?
|computer-architecture|
|operating-systems|
How decidability/semi-decidability/undecidability has impact on REAL life applications/examples? I understand that it can be used for implementation of various algorithms but what else?
How can decidability/semi-decidability/undecidability have impact on REAL life applications/examples?
|undecidability|semi-decidability|decidability|
Memory is first split into bytes. Bytes are 8 or more bits with 256 or more values. (Octets are 8-bit bytes. Bytes can be larger). Bytes can only be read or written completely. Programming languages and computer hardware use integers larger than 8 bits. For example 64 bit integers. You need eight 8-bit bytes to sto...
You are right and your someone is wrong. Lambda terms that only differ in the names of bound variables are beta equivalent, and considered the same program. If the lambda calculus can't see the difference, this means that this implementation in that system is not a solution to the problem.
null
Recently, I’ve been interested in the console of the Source game engine, more specifically, its `alias` command, which allows one command to invoke others. It may allow recursion (i.e. running `alias freeze freeze` will cause inputting `freeze` to freeze the engine), but does not allow parameters (i.e. running "`alias ...
null
It seems if you have the same number of people wanting a book and having a book then you can have a swap by everyone putting their book on a pile, then everyone picking the book they want. And if you don’t have the same numbers then you can’t swap.
null