instruction stringlengths 0 29.8k ⌀ |
|---|
{"Voters":[{"Id":79440,"DisplayName":"Nathaniel"}]} |
Let $S$ be language $$\{\langle M\rangle \mid(\forall x \in \Sigma^*)[x \in L(M) \iff x^R \in L(M)]\}.$$
How can I show that $L_U \le_m S$ and $L_U \le_m \bar S$ where $L_U$ is universal language and $\le_m$ means it is m-reducible (or simply reducible)? Can it be done via Rice's theorem? |
|turing-machines|reductions| |
So I found another discussion regarding this, but the answers did not fully separate the differenced between SID and ML. Hopefully a discussion here can shed some light on some larger differences both in design and use case situations between the two.
SID and ML seem very similar. They both use known input and outpu... |
System Identification vs Machine Learning for dynamic system modelling |
|machine-learning|modelling| |
How do I prove the runtime of an algorithm with Big O notation? I don't know much about O notation, I just I know how to compare sets of functions with each other and I'm also familiar with the master theorem.
But how do I do this? Is it just $O(n^2)$ because there are 2 loops? That doesn't sound right. The loop in... |
Big O analysis of algorithm |
|algorithms|time-complexity|algorithm-analysis| |
#### Show $L_U \le_m S$
Let $v=\langle T, w\rangle$, where $T$ is a Turing machine and $w$ is an input string to $T$. Fix two different input symbols $a$ and $b$. Construct Turing machine $M_v$ that upon input $x$, check whether $x$ is $aww^Rb$.
- If it is, accept.
- Otherwise, check whether $x$ is $bww^Ra$... |
At a high level, conceptually, they are very similar.
When one gets into the details, they come different communities and were initially designed to solve different tasks, so there are many differences in the specifics.
One difference is that system identification is often most concerned with the particular model... |
How do I prove the runtime of an algorithm with Big O notation? I don't know much about O notation, I just I know how to compare sets of functions with each other and I'm also familiar with the master theorem.
But how do I do this? Is it just $O(n + n) = O(n)$ because there are 2 loops? That doesn't sound right. Th... |
How do I prove the runtime of an algorithm with Big O notation? I don't know much about O notation, I just I know how to compare sets of functions with each other and I'm also familiar with the master theorem.
But how do I do this? Is it just $O(n^2)$ because there are 2 loops? That doesn't sound right. The loop in... |
I found following statements in [6.4.16. Arbitrary-rank polymorphism](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/rank_polymorphism.html) of ghc document.
> GHC uses an algorithm proposed by Odersky and Laufer (“Putting type annotations to work”, POPL‘96) to get a decidable algorithm by requiring some he... |
At a high level, conceptually, they are very similar.
When one gets into the details, they come from different communities and were initially designed to solve different tasks, so there are many differences in the specifics.
One difference is that system identification is often most concerned with the particular ... |
I am stuck on an exercise that ask the approximation factor of a MAX-SAT approximated algorithm generalized from a MAX-3SAT algorithm
MAX-3SAT:
1. set every variable with a random value ($0$ or $1$ each with probability $\frac12$)
2. check how many clauses are satisfied
This algorithm has a $\frac78$-ap... |
|satisfiability|approximation|decision-problem|3-sat|maxsat| |
null |
You are right in your analysis: this algorithm has a $\left(1-\frac{1}{2^N}\right)$ approximation factor only when each clause has at least $N$ independant litterals (independant means on different variables).
In the general case, you could have some clauses with exactly one litteral. But that means that the approxi... |
null |
null |
### $T$ as the union of subintervals ###
Let $U = [1,n-1]$. In your problem, you can think of $S$ as elements removed from $U$. Removing an element splits $U$ into several smaller subintervals. The union of all these subintervals generates $T$.
Let $S' = S \cup \{0,n\}$. Working with $S'$ instead of $S$ will make s... |
I've been studying closely about the **List** abstract data type - As I understand it can be implemented with linked-list and/or arrays, and really maybe with any other data types as well.
But to satisfy a list, it means to have methods:
1. that allow for insertion at desire 'position'.
2. removal at desired 'po... |
Is returning pointers to nodes for a list (doubly linked list) implementation a leaky abstraction? and is it bad? |
|algorithms|complexity-theory|data-structures|linked-lists| |
Suppose you have a dependency graph of "packages" registered in the ecosystem of a given programming language. We can model each package as a tuple `(name, version)` where `name` is the package name (like `Plots`) and `version` is a semantic version number (like `1.2.3`).
Each package has a set of dependencies, whi... |
I've been studying closely about the **List** abstract data type - As I understand it can be implemented with linked-list and/or arrays, and really maybe with any other data types as well.
But to satisfy a list, it means to have methods:
1. that allow for insertion at desire 'position'.
2. removal at desired 'po... |
Returning a pointer is not leaky, and is generally prefered, as it always permits more operations: access to the corresponding value, insertion at position and deletion in $\mathcal{O}(1)$.
Considering that a linear complexity is ok because the language is higher level is also wrong: lower complexity is better (unle... |
I am recently studying the operating system, and I found the paging system a little bit confusing, for example, what will happen when there is a 52-bit virtual address and a 40-bit physical address, with 4KiB page size, so there are 2^40 pages and 2^28 frames, how pages are mapped in this case (the pages are more than ... |
What is the relationship between virtual address and physical address? |
|operating-systems|memory-management|virtual-memory|paging| |
Looking online I found two different definitions for euler trail. I am wondering if one of them just implicitly assumed what the other definition explicitly stated or whether one is not generally accepted and if so which the general accepted one is:
**All edges exactly once, all vertices at least once**
Source: h... |
Can an unconnected graph contain a euler trail? |
|graphs| |
null |
The definition I often use is the second one: a disconnected graph could contain an euler path.
However, that does not mean that the first definition is wrong.
Unfortunately, Computer Science is a young field (in comparison to maths/physics/other sciences), and its vocabulary is still not well defined. The same... |
The definition I often use is the second one: a disconnected graph could contain an euler path.
However, that does not mean that the first definition is wrong.
Unfortunately, Computer Science is a young field (in comparison to maths/physics/other sciences), and its vocabulary is still not well defined. The same... |
Given something similar to this.
[![enter image description here][1]][1]
Where you have **blocks** (the squares) and **entries** (the circles). Each block has a rating (the number inside the blocks) and is connected to other blocks. This topology is always fixed and **cannot** change, the ratings neither.
An ... |
The runtime to find a min element in max heap is $O(1)$. It takes $O(\log n)$ time to delete an element and $O(\log n)$ time to insert a new element in the heap.
Does there exists a data structure in which max element can be found in $o(\log n)$ and still the time to delete is $o(\log n)$ and $o(\log n)$ time to ins... |
Maximum, delete and insert fastest data structure |
|algorithms|data-structures| |
null |
I have the following problem formulated as a linear integer program:
\begin{align}
& \text{minimize} && \sum_{i \in n} x_i\\
& \text{subject to} && \sum_{i \in n}{a_i}x_i \ge \theta_1, \\
& && \sum_{i \in n}{b_i}x_i \ge \theta_2, \\
& && a_i \ge 0 \quad \forall i \in n , \\
& && b_i \ge 0 \quad \forall i ... |
minimum number of 2d elements whose sums across both dimensions satisfy some threshold |
|sorting|integer-programming| |
I need to determine the maximum number of external nodes in an *improper* binary tree.
My intuition is that, in general, a binary tree has a maximum number of external nodes when it has at most one node with a single child. Consequently, my first step is to prove that assumption by induction.
**Proposition**: A ... |
Improper binary tree: maximum number of external nodes |
|data-structures|binary-trees| |
I have the following problem formulated as a linear integer program:
\begin{align}
& \text{minimize} && \sum_{i \in n} x_i\\
& \text{subject to} && \sum_{i \in n}{a_i}x_i \ge \theta_1, \\
& && \sum_{i \in n}{b_i}x_i \ge \theta_2, \\
& && a_i \ge 0 \quad \forall i \in n , \\
& && b_i \ge 0 \quad \forall i ... |
You cannot create a data structure that guarantee $o(\log n)$ time for insertion AND $o(\log n)$ for maximum extraction, be it worst, amortized or average case.
The reason is that such a data structure would allow comparison sorting in $o(n \log n)$, which is theoretically not possible. |
A binary tree shall be called proper if each node has either zero or two children. If it is not proper, it shall be called improper.
I need to determine the maximum number of external nodes in an *improper* binary tree.
My intuition is that, in general, a binary tree has a maximum number of external nodes when it h... |
I am wondering whether every Euler graph is also traversable. I.e. are Euler circuits Euler paths? Therefore I am asking the question above. |
Do Euler paths have to start and end at different vertices? |
|graphs| |
Physical addresses refer to existing RAM memory. At any time, virtual pages can be mapped to physical pages (frames), or be swapped out on disk. Usually, just a subset of the virtual space is mapped (the rest being completely ignored by the process). That part is mapped to frames as long as they are available (possibly... |
The big-$O$ analysis of an algorithm consists of two part in practice.
- A quick and rough estimate, which works often.
- Rigorous analysis as well as refinement when necessary.
------
We assume that the algorithm works. That means on any valid input (i.e., no duplicate numbers), it returns the correct result i... |
How do I prove the runtime of an algorithm with Big O notation? I don't know much about O notation, I just I know how to compare sets of functions with each other and I'm also familiar with the master theorem.
But how do I do this? Is it just $O(n^2)$ because there are $2$ loops? That doesn't sound right. The loop ... |
|algorithms|time-complexity|algorithm-analysis|loops| |
Big O analysis of a sorting algorithm that counts smaller elements |
Let's say that the expected time a message takes in transit is $t$, and typically $ t \leq 100\;\text{ms}$.
Your group has $n$ members. When a new member enters the group, each existing member draws an integer $w_i$ at random from $[1, q \cdot n]$ for some $q \geq 1$.
Then each member waits for $t \cdot w_i \; \te... |
I was trying to do this exercise, but I don't know how to solve this problem is NP-complete, what reduction to do.
There is a network N of n people, in which every person i is associated with a subset of people Fi ⊆ N . For every i∈N,itholdsthati∈Fi,andifpersonjisinFi,thenitmustbethatiisinFj aswell. Yourgoalistoadve... |
How to prove that it is NP-complete? |
|algorithms|np-complete|reductions|3-sat| |
Because of Kolmogorov/Levin complexity considerations, most $N$-long bit strings require $N+\log N+o(\log N)$ bits to store, since we also need to specify where the sequence ends.
I wonder what is the most efficient way something like this can be realized on a real computer. What is the optimal way of storing an $N$-l... |
Storing N bits on the smallest possible space in a real computer |
|computation-models|data-compression|kolmogorov-complexity| |
null |
Well, I have to say that the question is rather complicated. I also spent considerable time investigating this issue. Other SE questions (see [here][1], [here][2] and [here][3]) are strongly related to this one and specially [this answer is very enlightening][4] but, at least for me, not completely satisfactory. Also b... |
Well, I have to say that the question is rather complicated. I also spent considerable time investigating this issue. Other SE questions (see [here][1], [here][2] and [here][3]) are strongly related to this one and specially [this answer is very enlightening][4] but, at least for me, not completely satisfactory. Also b... |
With the idea, I approached it as thus:
An example below is used to show why Dijkstra's algorithm doesn't work in this case. The figure describes a directed graph that shows why Dijkstra’s algorithm does not work when the graph contains negative edges.
[![enter image description here][1]][1]
$\textbf{N.B:}$ The... |
I was trying to do this exercise, but I don't know how to solve this problem is NP-complete, what reduction to do.
There is a network N of n people, in which every person i is associated with a subset of people Fi ⊆ N . For every i∈N, it holds that i∈Fi, and if person j is in Fi, then it must be that i is in Fj as w... |
Since we don’t know if P = NP, we would like to have a way of saying “This problem is in NP and is really hard unless P = NP.”
This is made more formal by the notion of NP-completeness.
Therefore, we say a problem A is NP-complete if
(a) it is in NP, and (b) every problem B in NP is polynomial-time reducible t... |
Showing NP-Completeness |
|complexity-theory|np-complete|np| |
I just newly started looking into computational complexity.
Since we don’t know if P = NP, we would like to have a way of saying “This problem is in NP and is really hard unless P = NP.”
This is made more formal by the notion of NP-completeness.
Therefore, we say a problem A is NP-complete if
(a) it is in N... |
There is no known efficient way to determine whether or not there is a Hamiltonian cycle that includes $e$. That is a NP-complete problem. (If you could determine that, you could use that as a subroutine to test whether the graph contains any Hamiltonian cycle, and even to find a Hamiltonian cycle if one exists; so i... |
{"Voters":[{"Id":155618,"DisplayName":"kim120"}]} |
{"Voters":[{"Id":155618,"DisplayName":"kim120"}]} |
{"Voters":[{"Id":155618,"DisplayName":"kim120"}]} |
This is exactly [vertex cover](https://en.wikipedia.org/wiki/Vertex_cover). |
I recommend reading Pollack's [How to believe a machine-checked proof](https://tidsskrift.dk/brics/article/view/18945/16584). It explains how proof assistants are designed to minimize the amount of critical code.
There are many levels of formal verification (that's the phrase you're looking for in place of "proven")... |
null |
I've been working on this question for a few hours now and I've been trying to figure out the question above. My biggest problem is that I don't know what to do with the $>$ and $\geq$ symbols when determining the language. My current work is below. Also, if you have any resources on how to adequately learn pumping lem... |
Prove that $L = \{a^rb^qc^q\}$ where $q > 0$, $r \geq 0$ is not a regular language |
null |
I just want to know whether there exists a horn formula that is equisatisfiable to $(p\lor q)$. I would also be interested to learn if there exists an equivalent as well. |
Is there any horn formula equisatisfiable to the clause that is a disjunction of two literals? Does an equivalent also exist? |
null |
Given $A$ a countable set and $\min$ the function returning the minimum of a set (if exists).
Is $\min(A)$ computable? My first try is thinking $A$ as infinite list $A = [a_0, a_1, a_2,...]$ such that $a_i < a_j$ for every $i < j$ and write a simple while program $P$ such that $P(A) = a_0$. Is that correct? If so I wo... |
Be $A$ a countable set. Is $\min(A)$ function computable? |
|computability|mu-recursion| |
null |
Given $A$ a countable set of numbers and $\min$ the function returning the minimum of a set (if exists).
Is $\min(A)$ computable? My first try is thinking $A$ as infinite list $A = [a_0, a_1, a_2,...]$ such that $a_i < a_j$ for every $i < j$ and write a simple while program $P$ such that $P(A) = a_0$. Is that correct?... |
Is the function that computes the minimum of a countable set computable? |
I am wondering whether every Euler trails is also traversable. I.e. are Euler circuits Euler paths? Therefore I am asking the question above.
I am explicitly asking "euler circuit ⇒ euler path?". I also feel like "euler cycle" would be a better way of phrasing it |
Do Euler trails have to start and end at different vertices? |
Represent the string $x$ using the following encoding:
$$0, x_k, \dots, 0, x_2, 0, x_1, 1, x_0$$
where $x_0 = x$, $x_{i+1} = \text{len}(x_i)$ is a binary representation of the length of $x_i$ in bits (namely, $\text{len}(x_i)=\lceil \lg x_i \rceil$, for $i\ge 1$), and $k$ is the smallest $k$ such that $x_k \le 3$... |
Assume a tower with $n$ floors.
Each floor contains $C_i$ boxes such that $C_i>0$ for all $i\le n $
Moving $C_i$ boxes from floor $i$ to floor $j $ costs $C_i\cdot(i-j)$ and we can only move all the boxes at once,and they all go to the same floor.
Given $C_i$ for all $i\le n$ and integer $M$,find a partition of ... |
Finding minimal moves to move boxes into m floors |
|algorithms|dynamic-programming| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.