instruction stringlengths 0 29.8k ⌀ |
|---|
The function starts by checking for an empty array and returns *false* in that case.
Otherwise, it tests the first element of the array and returns *true* if the condition *cb* is met. Otherwise, it recurses with the array less the first element.
Said differently, the function recursively scans the array until so... |
null |
So we know that LBAs have a finite number of configurations, which makes the task of detecting loops much easier. My proposition is that if a given LBA is constructed to recognize a language, it also decides it since if there was a non-halting instance of the problem, we can detect it and terminate the computation.
Is... |
Is it possible for a Linear bounded automaton to be a recognizer but not a decider? |
|turing-machines|computability| |
Logical gates alone can do little, they can just build combinatorial logical systems.
But as soon as you add a clock, *states* become possible and you can build sequential systems and devices such as Turing machines or any kinds of processors.
|
Toda's theorem says that the polynomial time hierarchy is contained in $P^{\#P}$, the class of problems solvable by polynomial time oracle Turing machines with access to an oracle in \#P, which is the class of functions that return the number of satisfying assignments of nondeterministic machines clocked in polynomial ... |
Toda's theorem without $\oplus P$ |
|complexity-theory|reference-request|polynomial-time-hierarchy| |
What the author means - and is right in thinking so - is that from an analytical point of view, the optimization is arduous. This is because the objective function depending on the three parameters $\theta,c_1,c_2$, also depends on the assignments of the points to $P$ and $Q$, which can be made in $2^m$ ways. |
Clearly, the second expression generates all strings made of $a$ and $b$.
Now, by induction, the first expression can generate
- the empty string $\epsilon$;
- any string it generates, followed by $b$, as one can append $b$, using $(ba^0)$;
- any string it generates, followed by $a$:
- if the string is... |
Here is a suggestion for an algorithm that might satisfy your constraints.
First, we'll come up with an upper bound $M$ for the quotient $a_1a_2\dots a_n/b_1b_2\dots b_m$. There are many acceptable ways to do this: the first way that comes to mind is round each $a_i$ up to the next largest power of two and round eac... |
Consider the following "game".
> There is an ant on a strip of length N. The ant can perform the following actions: move left, move right, and paint the cell he is on with white or black. The ant is also given a target coloring and must paint the strip according to such coloring in the most efficient way possible. The... |
## Question
Consider a system which has logical address is 7 bits, physical address is 6 bits , page size is 8 words, calculate the number of pages and no.of frames, size of page table.
## Answer
## Addressing Scheme in a Paging System
Given the following information:
- Logical Address: 7 bits
- Physical ... |
Size of the page table? |
|operating-systems| |
Size of the page table |
## Question
Consider a system which has logical address is 7 bits, physical address is 6 bits , page size is 8 words, calculate the number of pages and no.of frames, size of page table.
## Answer
## Addressing Scheme in a Paging System
Given the following information:
- Logical Address: 7 bits
- Physical ... |
Clearly, the second expression generates all strings made of $a$ and $b$.
Now, by induction, with the first expression:
- you can generate the empty string $\epsilon$, as $a^0(ba^*)^0$;
- any string generated with this expression can be appended with a $b$, which is $(ba^0)^1$;
- any string generated with t... |
null |
I'm trying to figure out if a predecessor subgraph is always connected, but I'm not sure how to go about proving it (or disproving it). I've read that the predecessor subgraph forms a tree, but it seems that that claim depends on the subgraph being connected (and the number of edges being one less than the number of ve... |
Is a predecessor subgraph always connected? |
|graphs|algorithm-analysis|subgraphs| |
I am looking for literature on abstract models on parallel computing. I am mainly referring to models like Alternating Turing Machine, PRAM or NC-uniform equivalence (Boolean circuits) with some parallelism capability.
I would like to know if there are any recent advances or literature on the subject.
Thank you v... |
Abstract models of parallel computing? |
|complexity-theory|automata|parallel-computing| |
**Overview of Turing Machine decidability starting on the a blank tape (Busy Beaver style)**
For the blank tape input only:
- 4-state machines: [all decided in 1983](https://www.jstor.org/stable/2007539)
- 5-state machines: as of 2023 it is generally believed that all [5-state machines have been decided pending ... |
Given an undirected graph $G$ with non-negative edge weights, how can we prove that the predecessor subgraph $G_{p}$ of $G$ is always connected?
Here's how the predecessor subgraph is defined: for a graph $G = (V, E)$ with source $s$, the **predecessor subgraph** of $G$ is $G_{p} = (V_{p}, E_{p})$, where $V_{p} = \{... |
Let $v_1, \dots, v_n$ be the vertices of your graph in non-decreasing order of distances from $G$.
You can show by induction on $i$ that the graph $G_i$ induced by $\{v_1, \dots v_i\}$ is connected.
The base case is trivial as $G_1$ contains only $v_1=s$.
Consider now $i>1$. We only need to argue that $v_i$ ... |
Let $s$ be your source vertex and let $d(v)$ denote the distance from $s$ to $v$. Let $v_1, \dots, v_n$ be the vertices of your graph in non-decreasing order of distances from $s$.
You can show by induction on $i$ that the subgraph $G_i$ of $G_p$ induced by $\{v_1, \dots v_i\}$ is connected.
The base case is triv... |
Clearly, the second expression generates all strings made of $a$ and $b$.
Now, by induction, with the first expression:
- you can generate the empty string $\epsilon$, as $a^0(ba^*)^0$;
- any string generated with this expression can be appended with a $b$, which is $(ba^0)^1$;
- any string generated with t... |
null |
In order to enumerate such a regular expression, it's clear one can break down the language into the set $s =\{00,01,10,11\}$ and it is clear that we need to enumerate some expression that avoids the following combination of strings:
01, 00+10,00+11, 10+11. I'm just having finding trouble enumerating the regular expre... |
Regular expression for binary string containing no instances of 01 |
|regular-languages|automata|regular-expressions| |
null |
I wanted to learn Operating System on my own. Although I have learned few basic things from here and there, but wanted to know the suggestions (books, any video lecture, etc.) from this community. |
What is the optimal resource to follow to learn Operating System? |
|operating-systems| |
The C++ standard says "The built-in subscript expression `E1[E2]` is exactly identical to the expression `*(E1 + E2)`...". So `3[arr]` is `*(3+arr)` is `*(arr+3)` is `arr[3]`.
https://en.cppreference.com/w/cpp/language/operator_member_access |
null |
So considering this [answer][1] for unconstrained minimization:
> For any $n$, let $f$ be a $\sigma$ strongly convex function, write $$\epsilon = \left\|\nabla f(0) \right\|_2$$ then the ball of radius $\epsilon / \sigma$ around 0 includes the minimum.
> Blockquote
I suppose one could use the [penalty method][2]... |
I need to build a schedule that maps 7 people to 4 groups (3 pairs, 1 single) for each week.
An ideal schedule would be one where each person swaps pairs and groups in a round-robin style. If such a schedule is not possible, an algorithm that creates a schedule that minimizes repetition while being fair over the lon... |
Schedule with fair distribution of pairs and groups |
|scheduling| |
If there is a $0$, it may not be followed by a $1$, so the string is made of "not $0$s" followed by $0$s.
$$1^*0^*$$
|
Chore schedule with fair distribution of pairs and groups |
null |
I am looking for a reference on the most optimal output-sensitive algorithm currently available for listing all maximal cliques in a graph.
I know the [Bron-Kerbosch algorithm](https://en.wikipedia.org/wiki/Bron%E2%80%93Kerbosch_algorithm) is highly utilized, but it is not output sensitive (i.e., the expected runnin... |
Current best output-sensitive algorithm for computing all maximal cliques of a graph |
|algorithms|graphs|reference-request|clique| |
The division algorithm You are trying to understand is basically a recursive description of good old [long division](https://en.wikipedia.org/wiki/Long_division), albeit in binary form. You can think of the following line:
$$ (q,r) = divide(\lfloor x/2\rfloor,y) $$
As moving the divisor $y$ one binary digit to th... |
Instead of directly dividing $x$ by $y$, you divide $x\div 2$ by $y$ and multiply the quotient by $2$. This gives an approximate quotient, and the rest of the computation is a correction to get the true quotient, which may be off by one unit ($x\div y=2( (x\div2)\div y)$ or $2( (x\div2)\div y)+1$). Notice that $x\div2$... |
Since addition is commutative, we can use any accessor method. But in programming, the more code is **human-understandable**, the better it is ranked. And that is why guidelines exist.
In this case, using `arr[3]` is more readable than `3[arr]`. Instead of array, let's think in term of hashmaps: Suppose you are aske... |
null |
null |
**Overview of Turing Machine decidability starting on the a blank tape (Busy Beaver style)**
For the blank tape input only:
- 4-state machines: [all decided in 1983](https://www.jstor.org/stable/2007539)
- 5-state machines: as of 2023 it is generally believed that all [5-state machines have been decided pending ... |
***Disclaimer 1**: I am in no way, shape or form an expert on this topic. I am not even an amateur. All my knowledge on quantum computing comes from reading a single book and implementing a [puny quantum circuit simulator](https://github.com/DirkToewe/QuIPPy). So please take everything I say with a table spoon of salt.... |
null |
This is probably insignificant, but I was messing around with polynomials, and found out that, if we have a number, n = pq that we want to factor, if we expand (k+1)^n -k^n - 1, mod n, the first nonzero term will be a factor of n. This, of course, is just trial division in disguise, since in order to find p, you would ... |
Progress towards a Polynomial time factoring algorithm? |
|complexity-theory|polynomials|factoring| |
This is probably insignificant, but I was messing around with polynomials, and found out that, if we have a number, n = pq that we want to factor, if we expand (k+1)^n -k^n - 1, mod n, the first nonzero term will be a factor of n. This, of course, is just trial division in disguise, since in order to find p, you would ... |
You can use my code. I implemented the ideas from the paper by Overmars and van Leeuwen.
[https://github.com/sumeetshirgure/DynamicPlanarHull/tree/master][1]
[1]: https://github.com/sumeetshirgure/DynamicPlanarHull/tree/master |
Wikipedia states that the time complexity of the [General Number Field Sieve (GNFS)][1] is
$$\exp\left( \left(\sqrt[3]{\frac{64}{9}} + o(1)\right)(\log N)^{\frac{1}{3}}(\log \log N)^{\frac{2}{3}}\right),$$
where $N$ is the number to be factored.
The same site also mentions that [quasi-polynomial time][2] is
$$\mb... |
The authoritative reference on the pragmatic issues behind implementing regex engines is [a series of three blog posts by Russ Cox](http://swtch.com/~rsc/regexp/). As described there, since backreferences make your language non-regular, they are implemented using [_backtracking_](http://en.wikipedia.org/wiki/Backtrack... |
Does the following [highly down-voted answer][3] not answer the question "[Why does Schaefer's theorem not prove that P=NP?][4]"? If not, why not?
> Marek, V. Wiktor. [*Introduction to Mathematics of
> Satisfiability*][1]. Boca Raton; London; New-York: CRC Press, 2009,
> p. 310:
>
> >***THEOREM 13.3 (Schaefer ... |
Does the following down-voted answer not answer the question "Why does Schaefer's theorem not prove that P=NP?"? |
|np-complete|satisfiability|p-vs-np| |
One can prove by induction on $x\ge 0$ that
$$(q,r) =\text{divide}(x,y)\Longrightarrow x=q y + r\text{ and }0\le r\le y-1$$
Indeed this is true when $0=x$ because $0=0.y + 0$. When $1\le x$, first note that $2\le x+[x\text{ odd}]$, where $[\text{ }]$ is Iverson's bracket, hence
$$0\le\left\lfloor\frac{x}{2}\right\... |
One can prove by induction on $x\ge 0$ that
$$(q,r) =\text{divide}(x,y)\Longrightarrow x=q y + r\text{ and }0\le r\le y-1$$
Indeed this is true when $0=x$ because $0=0.y + 0$. When $1\le x$, first note that $2\le x+[x\text{ odd}]$, where $[\text{ }]$ is Iverson's bracket, hence
$$0\le\left\lfloor\frac{x}{2}\right\... |
Yes, you can "break down each segment at each crossing point", and then you'll get a *Planar Subdivision* or [Planar straight-line graph][1]. All the edges of this graph will be **oriented** according to the natural orientation of the original self-intersecting polygon. It's easy to see that all the points, belonging t... |
I am a high schooler who has been programming for about 3 years now. My skill level is above what AP Comp Sci and especially what principles can teach me. What should I be doing to improve myself and prepare for future schools/jobs? What should I be adding to my portfolio? |
What should I look to do in high school to prepare myself for college/jobs |
|education| |
null |
null |
null |
The language is not context free, and indeed Ogden's Lemma can be used to show so. See the answer in the following [duplicate][1].
[1]: https://cs.stackexchange.com/q/162133/162601 |
I am a CS undergrad trying to improve my problem-solving skills. I have noticed that I have a problem with theoretical computer science which I've been trying to fix largely unsuccessfully till now. I have noticed these in Undergrad courses such as *Theory of Computation*, *Algorithm Design*, *Discrete Mathematics*, *G... |
How do I improve my problem-solving and creative thinking kills in Computer Science? |
|education|theory| |
To specify the $\mathit{TotalQueueCustomers}$ operation it helps to know that, in Z (and VDM and B), a sequence is a function from a finite prefix of the positive integers to the element type. Here your element type is $\mathit{Queue}$. To express the sum of the $\mathit{length}$ components of all the $\mathit{Queue}$s... |
How do I improve my problem-solving and creative thinking skills in Computer Science? |
For these algorithms, the time complexity of BFS and DFS is O(E).
I have gone through many websites and even the algorithm books, but I never got a clear idea of why it is O(E). It just says it's O(E) in the flow graph as it considers only edges. What does this mean? |
Why in Edmonds Karp or Ford Fulkerson Algorithm the time complexity of BFS or DFS respectively is O(E) rather than O(V+E)? |
|graphs|time-complexity|network-flow|ford-fulkerson|breadth-first-search| |
I don't actually understand the meaning of $w$$x$ + $b$ = 0
when it is defined in support vector machine.
In my own understanding, in order for the equation to be true, the hyperplane would always need to pass through the origin.
$w$$x$ + $b$ = 0
0 = 0
But when I look at many diagram of SVM hyperplane, it... |
Incompresensible about $w$ $x$+ $b$ = 0 |
|machine-learning|artificial-intelligence|svm| |
null |
Taking an example, say we have Page size = 4KB, Page Table Entry = 4B, Physical Address Space requires 36 bits
In 3-level multi-paging, let's say the number of entries in the level 3 page table is 2^9 (so the size of this page table would be 2^9 * 4B = 2^11 B )
In level 2, there are 2^9 entries as well and finally... |
How is the physical address calculated in Page tables? |
|operating-systems|memory-management|paging| |
Taking an example, say we have Page size = 4KB, Page Table Entry = 4B, Physical Address Space requires 36 bits
In 3-level multi-paging, let's say the number of entries in the level 3 page table is 2^9 (so the size of this page table would be 2^9 * 4B = 2^11 B )
In level 2, there are 2^9 entries as well and finally... |
null |
null |
null |
Yes, they can be employed in a straightforward way. However, the size of the formulas blows up exponentially big.
Let $\ell_{s \to t}$ denote the formula on the NFA transition from $s$ to $t$. For instance, these formulas might look like $\text{ctr} \ge 3$ (require the counter to be at least 3, i.e., the transitio... |
null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.