instruction stringlengths 0 29.8k ⌀ |
|---|
null |
null |
If the table is round, then this problem is a variant of the famous Travelling Salesman Problem and any of the many solutions in published literature can be consulted for solving it. |
I have recently discovered a [greedy algorithm](http://debruijnsequence.org/db/greedy) to construct [De Bruijin Sequence](https://en.wikipedia.org/wiki/De_Bruijn_sequence).
The greedy approach (prefer-largest specifically) works like the following:
1. Start with a sequence of all 0's of length n - 1 where n is the or... |
Why does greedy approach of constructing De Bruijin Sequence work? |
|graphs|hamiltonian-path|eulerian-paths| |
null |
null |
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 NOT polynomial time computable. Define a language L ={(x,y) | *f*(x)<y}. Show that this language L is in NP.
I start with contracting a polynomial time... |
How to show a language is in NP? |
|complexity-theory|np-complete|np-hard|np| |
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 NOT polynomial time computable but the inverse function $f$ is polynomial time computable. Define a language $L =\{(x,y) | f(x)<y\}$. Show that thi... |
I am currently working on **parameterized complexity**, especially on the hard proofs. There is a problem $P$ and a parameter $x$, I recently discovered that there is no parameterized reduction for $P$ w.r.t the parameter $x$ from any *W*-class. I have tried to give a reduction from a *W*[2]-hard, Dominating set proble... |
No parameterised reduction for the problem indicates FPT or not? |
|np-hard|parameterized-complexity| |
I am going to story data in a growable persistent storage. I need to implement allocation/deallocation (like malloc/free and possibly realloc but in Rust) of continuous regions of memory on this storage.
Allocation should never fail, but the storage grow if out of allocated storage.
Priorities:
- Should do alloc... |
Memory allocation algorithm over a growing storage |
|algorithms|data-structures|memory-allocation|storage| |
null |
I am currently working on **parameterized complexity**, especially on the hard proofs. There is a problem that I am currently working on, denoted by $P$ and a parameter $x$, I discovered that there is no parameterized reduction for $P$ w.r.t the parameter $x$ from any *W*-class. I have tried to give a reduction from a ... |
Proving that there is no such reduction would only establish that the problem is not $W[2]$-hard. But that just means that the problem is not complicated in one particular fashion, it doesn't mean that the problem is easy. There are problems that are not $W[1]$-hard but are far, far from being FPT.
However, it woul... |
The value $f(x)$ is a polynomial length certificate for the language, since it has the same size as $x$, and can be checked in polynomial time by verifying that $f^{-1}(f(x)) = x$ and that $f(x) < y$. |
Is the answer O(h) or Ω(h) for **f+g?**
My professor says its Ω(h), but I can't get it.
|
If f = O(h) and g = Ω(h) then f+g is? |
|algorithms|big-o-notation|omega-automata| |
As a reminder, in an A* algorithm, vertices in the priority queue are sorted according to their priority $f = g + h$, where $g$ is the cost of getting to this vertex from the start vertex, and $h$ is an estimation on remaining cost to get from this vertex to the destination vertex. In my specific A* path finding algori... |
How to avoid costly square root operations in A* algorithm? |
|algorithms|program-optimization|a-star-search| |
As a reminder, in an A* algorithm, vertices in the priority queue are sorted according to their priority $f = g + h$, where $g$ is the cost of getting to this vertex from the start vertex, and $h$ is an estimation on remaining cost to get from this vertex to the destination vertex. In my specific A* path finding algori... |
I'm going to assume that $f(n)$ is non-negative.
From $g(n) \in \Omega(h(n))$ you know that there is some $n_0$ and some $c$ such that, for all $n \ge n_0$, $$g(n) \ge c \cdot h(n).$$ Then:
$$f(n) + g(n) \ge g(n) \ge c \cdot h(n) \quad \text{ for all } n \ge n_0.$$ Therefore $f(n)+g(n) \in \Omega(h(n))$. |
null |
Originally posted on [SO](https://stackoverflow.com/questions/75574000/find-maximum-in-arbitrary-expression-tree?noredirect=1#comment133352829_75574000).
I have a very simple language that gets compiled to an Expression tree, and then evaluated. Users can define mathematical operations, use variables and control flo... |
find maximum in arbitrary expression tree |
|optimization|trees|syntax-trees|symbolic-execution| |
As a reminder, in an A* algorithm, vertices in the priority queue are sorted according to their priority $f = g + h$, where $g$ is the cost of getting to this vertex from the start vertex, and $h$ is an estimation on remaining cost to get from this vertex to the destination vertex. In my specific A* path finding algori... |
null |
null |
The Motorola 68,000 processors used to come with a co-processor for floating-point arithmetic, but also for things like logarithm, sine, cosine etc.
On the 68040 processor, the co-processor was integrated into the CPU, with the complex functions removed. The reason given was that an implementation using standard fl... |
null |
There is [this Rust allocator](https://github.com/zakarumych/blink-alloc) described as "blazingly fast".
It remains to rewrite it with I/O functions instead of direct memory access. |
Is the following language recognizable by a visibly pushdown automaton? |
In lambda calculus (I will use untyped) if a term containing a redex is beta-reduced to another term, then for some reason they are considered "beta-equal". But the lambda calculus only works one way!
Assume that 3 conditions are met:
1. The original term is finite (for simplicity: it consists of a finite number of... |
Why use the term "beta equality"? |
|lambda-calculus| |
**tl;dr** The accessibility relation needs to be the reflexive transitive closure of what you had in mind.
Details:
Let $P$ be a set of atomic proposition. Write $\Sigma$ for $P$'s powerset. Write $T$ for $\Sigma^{\mathbb{N}}$ (infinite traces).
A Kripke frame $\langle W, R\rangle$ where the meaning of formulas ... |
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 NOT polynomial time computable but the inverse function $f$ is polynomial time computable. Define a language $L =\{(x,y) | f(x)<y\}$. Show that thi... |
In what paper(s), textbook(s), and/or classnote(s) can I find a detailed proof of the completeness of PLTL, i.e. Propositional Linear Temporal Logic? |
A proof of the completeness of PLTL (Propositional Linear Temporal Logic) |
|reference-request|linear-temporal-logic| |
(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 ... |
It seems you are mixing up beta *reducibility* and beta *equality*.
Beta contraction (here: from $P_1$ to $P_2$) is a single redex simplification step:
```
P1
>
P2
```
Beta reducibility (here: from $P_1$ to $P_5$) is the existence of a series where each step is a beta contraction or alpha conversio... |
It seems you are mixing up beta *reducibility* and beta *equality*.
Beta contraction (here: from $P_1$ to $P_2$) is a single redex collapsing step:
```
P1
>
P2
```
Beta reducibility (here: from $P_1$ to $P_5$) is the existence of a series where each step is a beta contraction (collapsing of a redex... |
If you can use square root with limited precision, then you may try this approach:
1. use g^2 + 2gh + H formula, so you have exact value of H
2. compute leading zeroes in H so you can represent H=x*2^n
3. shift H so only 10 bits remain: H2 = H >> (n-10)
4. compute sqrtH2 = sqrt_table[H2]
5. now h = sqrtH2 * 32 * 2... |
null |
_(Disclaimer: I'm not a computer scientist and have not read most of these books. I wish more people would address this interesting question.)_
CS courses usually provide an introduction to the field which may be supported by corresponding textbooks, for which various options exist out there. Many of them have title... |
null |
Does 2^n describe a class of problems or is it considered polynomial? |
Why is exponential time 2^n^k and not 2^n |
|time-complexity| |
null |
It seems you are mixing up beta *reducibility* and beta *equality*.
Beta contraction (here: from $P_1$ to $P_2$) is a single redex collapsing step:
```
P1
>
P2
```
Beta reducibility (here: from $P_1$ to $P_5$) is the existence of a series where each step is a beta contraction (collapsing of a redex... |
It seems you are mixing up beta *reducibility* and beta *equality*.
Beta contraction (here: from $P_1$ to $P_2$) is a single redex collapsing step:
```
P1
>
P2
```
Beta reducibility (here: from $P_1$ to $P_5$) is the existence of a series where each step is a beta contraction (collapsing of a redex... |
null |
null |
When it comes to defining the memory address structure given the RAM size, cache size, and other parameters such as the cache block size..., we can have the following generalization:
$$Address = TAG|Index|offset$$
We then have: $size(offset) = log_2(word \ count \ per \ block)$
For the index, we will have: $$size(... |
How is the memory address structured when the number of blocks per cache set is not a power of 2? |
|computer-architecture|memory-management|cpu-cache|memory-hardware| |
6-time associativity means one cache line can be stored in six different locations. So the hardware identifies six locations where the data _might_ be stored and checks all six.
The description assumes associativity is a power of two, there is no need for that. Just assume you had six caches with no associativity a... |
null |
6-time associativity means one cache line can be stored in six different locations. So the hardware identifies six locations where the data _might_ be stored and checks all six.
The description assumes associativity is a power of two, there is no need for that. Just assume you had six caches with no associativity a... |
Is there a reduction between a decidable language $L$ and $\Sigma^*$? |
Reduction between a decidable language $L$ to $\Sigma^*$ |
|turing-machines|reductions| |
Reduction between a decidable language $L$ and $\Sigma^*$ |
The general solution is to use [symbolic execution](https://en.wikipedia.org/wiki/Symbolic_execution).
Let me start by explaining how to solve this if you have straight-line code, with no conditional statements (no if's). First, for each program variable `x` (or intermediate value/expression), you introduce a mathe... |
For al of CS, I'm not so sure. For instance, I'm imagining that you don't want to do programming. So you might have luck looking into CS's different parts, trying books not so much aimed at practitioners as at those who are just interested. Along that line, perhaps for just the Theory part, *The Golden Ticket: P, NP... |
Let $L \in RE$. Then $L$ might be finite or infinite.
I assume this is also true for $coRE$.
But, if I have a language $L \notin RE$, it necessarily means that $L$ is infinite, am I correct?
Also, if $L \notin coRE$ then $L$ is infinite, right?
Thanks a lot! |
About infinite languages in RE and coRE |
|complexity-theory|formal-languages| |
Let $p_1,p_2 \dots p_n$ be $n$ points in 2D such that $p_i= ( x_i,y_i) $
Let $d(p_i,p_j)= \max (|x_i-x_j|,|y_i-y_j|)$, or better known as Chebyshev distance.
Find a point $p_i$ such that the distance to it's kth closest point is minimal among all $i$ in $\mathcal{O} ( n\log ^2 n) $.
I tried calculating all possi... |
Finding 2 points that are k'th closest and their distance is minimal among such points with Chebyshev distance |
|computational-geometry| |
Complexity class P/poly includes languages, which cannot be calculated by means of classic Turing machine, including unary halting problem
However, class NP is relatively simple, can be calculated via Turing machine and is placed on lowest level in polynomial hierarhy
So every NP-complete problem, which can be ... |
Why NP is not strictly included in P/poly? |
|complexity-theory|np-complete|computation-models| |
For all of CS, I'm not so sure. For instance, I'm imagining that you don't want to do programming. So you might have luck looking into CS's different parts, trying books not so much aimed at practitioners as at those who are just interested. Along that line, perhaps for just the Theory part, *The Golden Ticket: P, N... |
Anyone would agree that assembly languages ("threshold languages") have some abstraction but is it true to say that also machine languages have some degree of abstraction? |
Is it true to say that machine languages have some degree of abstraction? |
|computation-models|abstract-data-types| |
I think anyone would agree that assembly languages ("threshold languages") have some very little abstraction but is it true to say that also machine languages have some degree of abstraction? |
Depends on what you consider the most non-abstracted.
Memory addresses get translated from the virtual address space to physical RAM address space through the page table.
The instruction set can address a number of registers, however in many CPUs there are more register locations available in the register file th... |
null |
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 ... |
$n$ students want to exchange books among themselves |
|algorithms| |
Let $p_1,p_2 \dots p_n$ be $n$ points in 2D such that $p_i= ( x_i,y_i) $
Let $d(p_i,p_j)= \max (|x_i-x_j|,|y_i-y_j|)$, or better known as Chebyshev distance.
Find a point $p_i$ such that the distance to it's kth closest point is minimal among all $i$ in $\mathcal{O} ( n\log ^2 n) $.
Edit: $ 1 \le k \le n$
I t... |
null |
Why NP is not certain subset in P/poly? |
I have a practical programming problem that I am struggling to find an optimal algorithm for, in part because I don't know what to call it. The problem concerns [vectored I/O](https://en.wikipedia.org/wiki/Vectored_I%2FO) (scatter/gather).
Consider a server *s* and a set of connected clients *C*. The server maintain... |
k-compact vectored I/O |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.