instruction stringlengths 0 29.8k ⌀ |
|---|
Consider signed integers with common addition and multiplication.
Reassociation of expression is another equivalent form.
Say expressions:
a * b + a * c + c * b
a * (b + c) + c * b
a * b + c * (a + b)
Are all reassociations of each other.
Lets call optimal reassociation one with minimal mul... |
Did I correctly rank these functions by order of growth? I ranked them from smallest to largest (left to right). I have to eventually prove this ranking, so just looking to make sure that I have the right understanding.
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/NO9qX.png |
Ranking functions by order of growth |
|big-o-notation| |
null |
I believe that it is obvious that linearizability is not satisfied here, because real time order of operations is not preserved. In linerizable system, once Client 1 set the balance, Client 2 must have been immediately seen this on his next read.
With sequential consistency it is a bit more tricky. For sequentiall... |
null |
null |
Did I correctly rank these functions by order of growth? I ranked them from smallest to largest (left to right). I have to eventually prove this ranking, so just looking to make sure that I have the right understanding.
$n^{\sqrt{\frac{2}{\log_2 n}}}, \quad 10^{\log_2 (\log_2 n)}, \quad 2^{\sqrt{2 \log_2 (n)}}, \qua... |
null |
I don't see why not.
A* is heuristic based, if your heuristic is completely wrong the algorithm can end up preferring the search in a wrong direction in the solutions space. You could even design a heuristic that only ever brings the algorithm to a place in the solutions space without ever bringing it closer to the ac... |
In the paper titled *Quake Heaps:A Simple Alternative to Fibonacci Heaps*, by Timothy Chan He mentions that:
> The tournament trees require a linear number of extra nodes, but more space- efficient representations are possible where each element is stored in only one node. One option is to transform each tournament tr... |
Quake Heaps with Heap-Ordered Trees instead of Tournament Trees |
|algorithms|data-structures| |
In the paper titled *Quake Heaps:A Simple Alternative to Fibonacci Heaps*, by Timothy Chan He mentions that:
> The tournament trees require a linear number of extra nodes, but more space- efficient representations are possible where each element is stored in only one node. One option is to transform each tournament tr... |
In the paper titled [*Quake Heaps:A Simple Alternative to Fibonacci Heaps*][1], by Timothy Chan He mentions that:
> The tournament trees require a linear number of extra nodes, but more space- efficient representations are possible where each element is stored in only one node. One option is to transform each tourname... |
null |
It depends on the device and, specifically, how much data needs to be buffered.
Some devices, such as GPIO or SMBus (used for things like temperature sensors on the motherboard), have such a low bandwidth that the maximum amount of data that needs to be "buffered" is a small number of bytes. A hardware register or t... |
null |
Full disclosure, my understanding is kind of vague, and I don't have access to the book you mentioned, so my graph based variant is probably a little different from yours. But I spent several days trying to find out how the different variants of this algorithm relate to each other, and a post like this would have reall... |
null |
I am facing the following problem in a script I am trying to develop:
Given a string and a set of tokens, where the tokens are known and are overlapping (the set can contain the tokens 'a', 'b' and 'ab'), I need to split the string into a list of tokens from the set. I know there can be multiple ones, I don't need a... |
Problem identification: splitting string into tokens taken from a given, possible overlapping set |
|algorithms|strings|substrings| |
I've begun reading the paper "Random Walks in a Convex Body and an Improved Volume Algorithm" by Lovász-Simonovits ('93). Although the paper for the most part is pretty self-contained and easy to read, the proof of the Localization lemma seems to be rather obtuse to me. Importantly there are certain statements that I'm... |
Detailed exposition for proof of Localization Lemma in paper "Random Walks in a Convex Body and an Improved Volume Algorithm" |
|computational-geometry|convex-hull| |
Well-known example of divergent expression in lambda calculus is big-Omega combinator, defined as `(λf. f f)(λf. f f)`. Although big-Omega is divergent expression, it's size became stable and always equal `(λf. f f)(λf. f f)` . Big-Omega combinator can be extended to provide more growth speed, for instance, expression ... |
Expression with fastest growth in lambda-calculus |
|computability|lambda-calculus| |
Does anyone have any examples of NP-hard graph problems which stay NP-hard on cycles, or is this class somehow not able to have NP-hard problems?
I found a similar post concerning trees [here][1] which answers affirmatively, but by using the fact that any $n$-size input can be encoded as a tree of order $n$. Cycles ... |
Can a graph problem remain NP-hard when restricted to cycle graphs? |
|graphs|np-hard| |
Assuming the problem instance is defined solely by the cycle itself (no labels or weights on the nodes, etc., no other inputs to the algorithm), then no, you should not expect any such problem to be NP-hard.
Any language containing just cycles is a [sparse language](https://en.wikipedia.org/wiki/Sparse_language). In... |
I have been studying the structure of a hardwired control unit and at 8:57 of [this video][1]
[1]: https://www.youtube.com/watch?v=WLgXUPOjKEc
we get a basic block diagram.What does the sequence counter do exactly? |
Sequence counter in a hardwired control unit |
|computer-architecture|cpu| |
Given the following theorem and definitions from *Introduction to Algorithms* 3rd edition by CLRS:
**Theorem 22.5: (Correctness of breadth-first search**)
Let $G = (V, E)$ be a directed or undirected graph, and suppose that $BFS$ is run on $G$ from a given source vertex $s \in V$. Then, during its execution, $BF... |
Question about implication in proof that predecessor subgraph is a breadth-first tree |
|algorithm-analysis|graph-traversal| |
null |
null |
This problem is often called the Word Break problem and is a classic exercise for dynamic programming.
Base case: if you don't have a string, it's a yes instance.
For every token, if the string ends with that token, remove that suffix from the string and recurse.
If no token is a suffix of your (non-empty) str... |
The C standard carves out room for implementations which have padding bits in their integer types. Padding bits affect the size of an integer but not the number of possible values they can contain. I understand the purpose of padding bits/bytes in structs to ensure that they are properly aligned but including padding b... |
What is the purpose of padding bits in primitive integer types? |
|integers|c|numeral-representations| |
null |
> You have 27 coins, 1 of which is a different weight. Using a balance scale with 2 pans, how can you determine which coin is different in only 4 weighings?
>
> Generalize this to N coins.
## My Solution
***Hint:***
>! My solution was to number the coins in trinary and weigh them as follows:
***Solution:***... |
How to prove a minimum number of queries needed to determine a piece of information |
|logic|information-theory|lower-bounds|entropy|karnaugh-map| |
> You have 27 coins, 1 of which is a different weight. Using a balance scale with 2 pans, how can you determine which coin is different in only 4 weighings?
>
> Generalize this to N coins.
### Hint
>! My solution was to number the coins in trinary and weigh them as follows:
### Solution
>! <ol>
>! <li>If the... |
> You have 27 coins, 1 of which is a different weight. Using a balance scale with 2 pans, how can you determine which coin is different in only 4 weighings?
>
> Generalize this to N coins.
### Hint
>! My solution was to number the coins in trinary and weigh them as follows:
### Solution
>! <ol>
>! <li>Coins ... |
null |
This problem is often called the Word Break problem and is a classic exercise for dynamic programming.
Base case: if you don't have a string, it's a yes instance.
For every token, if the string ends with that token, remove that suffix from the string and recurse.
If no token is a suffix of your (non-empty) str... |
For a basic cpu each instruction takes multiple clock cycles to execute. For example you could have steps that
1. first read the instruction into the instruction register,
2. then it reads operand 1 into the execution unit input register, and
3. then it reads operand 2 into the execution unit input register, an... |
I am facing the following problem in a script I am trying to develop:
Given a string and a set of tokens, where the tokens are known and are overlapping (the set can contain the tokens 'a', 'b' and 'ab'), I need to split the string into a list of tokens from the set. I know there can be multiple ones, I don't need a... |
I am creating a timetabling software for a school, which given parameters for teachers/class sizes will output a timetable. There will be a list of classrooms per subject and a list of teachers per subject and I'll divide the students between the teachers.
The main focus is creating timetables for teachers, as oppos... |
Should I use linear programming for my timetable generator? |
|algorithms|optimization|linear-programming|scheduling| |
IIRC, Crays had a 23 bits integer type. This was really just their 32 bits floating point type with the exponent set to zero/ignored. If this idea sounds outdated, AVX-512 recently introduced a 52 bits Integer Fused Multiply & Add (IFMA). Same idea: ignore the exponent of a larger FP type. |
|terminology|parallel-computing|history|computer-graphics| |
Linear Programming is a technique to model continuous optimization problems. Since a student cannot be divided in half (or a classroom shared by two half teachers at a time), this problem is not continuous and modelling it as a Linear Program does not appear possible.
What you might consider is modelling this proble... |
lets talk of each case one by one:
(**finding from the start**)
since question has asked us to find the element from the start and has to reach particulary to a place that is 8 th from the start . actually many of us becomes that we have to traverse the link list a long but actually we dont have to because **since it... |
null |
I am currently trying to figure out whether a flavor of the bin packing problem, which I call the "flexible bin packing problem" (F-BPP), is NP-complete.
I know that the original bin packing problem (BPP) is NP-complete, so I prove that F-BPP is NP-complete via reduction from BPP to F-BPP. I have provided my proof ... |
Is the flexible bin packing problem NP-complete? |
|complexity-theory|np-complete|np-hard|packing| |
I want to formally show that a computational system $\mathcal M$ is *computationally universal* by showing it is *computationally equivalent* to some already known universal system, i.e. some UTM.
To show that by system $\mathcal M$ is *computationally equivalent* I need to prove something along the lines of this fo... |
How to formally show computational equivalence or universality using encodings? |
|turing-machines|computability|automata|computation-models|encoding-scheme| |
I am facing the following problem in a script I am trying to develop:
Given a string and a set of tokens, where the tokens are known and are overlapping (the set can contain the tokens 'a', 'b' and 'ab'), I need to split the string into a list of tokens from the set. I know there can be multiple ones, I don't need a... |
Excellent question. I'm not aware of any formal way to define this, to my knowledge. Instead, as far as I'm aware, in cases where computational equivalence comes up in practice, usually this issue doesn't arise, as the encoding are so obviously weak compared to the notion of computational power we care about, that it... |
I was watching a [talk][1] by Anand Natarajan on $\text{NEEXP} \subseteq \text{MIP*}$, and he uses $\text{3-coloring}$ as an example problem for $\text{NEXP} = \text{MIP}$ (timestamp 3:50). He mentioned that a two-prover interactive system could solve an exponential-sized graph's $\text{3-coloring}$ problem. I have two... |
Exponential sized graph 3-coloring is in MIP |
|graphs|interactive-proof-systems| |
So I am trying to create a Q-learning algorithm to solve simple games, starting with tic-tac-toe.
I would like to do so without completely eating away my memory, but all the examples online create a 2 dimensionnal array of dimensions [number_states, number_actions]. But just for tic-tac-toe we have 3^9 possible stat... |
Q-learning table efficiency |
|optimization|machine-learning| |
{"Voters":[{"Id":163411,"DisplayName":"kjkjkjkjkj"}],"DeleteType":1} |
{"Voters":[{"Id":163411,"DisplayName":"kjkjkjkjkj"}],"DeleteType":1} |
The dominating set problem asks us to find a set of nodes $S$ such that for a graph $(V, E), \forall v \in V$, $v$ has a neighbor in $S$ or is in $S$ itself.
I'm looking for an algorithm which finds $S$ such that any $v$ has at least *two* neighbors in $S$ instead. It doesn't have to be optimal, as I'm using this a... |
Efficient solution for dominating set with two neighbors instead of one |
|graphs| |
null |
Given the following theorem and definitions from *Introduction to Algorithms* 3rd edition by CLRS:
**Theorem 22.5: (Correctness of breadth-first search**)
Let $G = (V, E)$ be a directed or undirected graph, and suppose that $BFS$ is run on $G$ from a given source vertex $s \in V$. Then, during its execution, $BF... |
|algorithm-analysis|graph-traversal|check-my-answer| |
Given the following theorem and definitions from *Introduction to Algorithms* 3rd edition by CLRS:
**Theorem 22.5: (Correctness of breadth-first search**)
Let $G = (V, E)$ be a directed or undirected graph, and suppose that $BFS$ is run on $G$ from a given source vertex $s \in V$. Then, during its execution, $BF... |
I went about this problem as follows:
Find the centroid of the point set as well as the largest distance from the centroid to any of the points.
This yields a circle, compute a triangle that fully contains the circle (and thus fully contains the point set).
When testing for the Delaunay criterion to decide if... |
I am currently trying to figure out whether a flavor of the bin packing problem, which I call the "flexible bin packing problem" (F-BPP), is NP-complete.
I know that the original bin packing problem (BPP) is NP-complete, so I prove that F-BPP is NP-complete via reduction from BPP to F-BPP. I have provided my proof ... |
null |
I am an engineer learning about the complexity class DP, and I am looking at a number of sources that mention that UNIQUE-SAT and CRITICAL-SAT are both in DP. Is there a proof of this fact somewhere that I can learn from? |
Unique SAT is in DP |
|complexity-theory| |
They are defined and proved to be in $D^P$ in the original article by Papadimitriou and Yannakakis, _The complexity of facets (and some facets of complexity)_ published in JCSS in 1984 ([Volume 28, Issue 2, April 1984, Pages 244-259](https://www.sciencedirect.com/science/article/pii/0022000084900680)). |
They are defined and proved to be in $D^P$ in the original article by Papadimitriou and Yannakakis, _The complexity of facets (and some facets of complexity)_ published in JCSS in 1984 ([Volume 28, Issue 2, April 1984, Pages 244-259](https://www.sciencedirect.com/science/article/pii/0022000084900680)).
Critical-SAT ... |
They are defined and proved to be in $D^P$ in the original article by Papadimitriou and Yannakakis, _The complexity of facets (and some facets of complexity)_ published in JCSS in 1984 ([Volume 28, Issue 2, April 1984, Pages 244-259](https://www.sciencedirect.com/science/article/pii/0022000084900680)).
Critical-SAT ... |
null |
In _Parameterized Complexity for Domination Problems on Degenerate Graphs_, Golovach and Villanger give an algorithm for the Dominating Threshold et problem, which is defined as follows:
**Dominating Threshold Set** <br />
**Input:** A graph $G$, and two integers $k$ and $r$<br />
**Question:** Does there exist a ... |
2. This is meant to use a *succinct encoding* of the graph. That is, a graph on $2^n$ vertices $V=\{0,1\}^n$ with an edge set $E\subseteq\{0,1\}^n\times\{0,1\}^n$ is represented by a Boolean circuit $C$ in $2n$ variables such that
$$(\vec a,\vec b)\in E\iff C(\vec a,\vec b)=1$$
for all $\vec a,\vec b\in\{0,1\}^n$. Id... |
The dominating set problem asks us to find a set of nodes $S$ such that for a graph $(V, E), \forall v \in V$, $v$ has a neighbor in $S$ or is in $S$ itself.
I'm looking for an algorithm which finds $S$ such that any $v$ has at least *two* neighbors in $S$ instead. It doesn't have to be optimal, as I'm using this a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.