instruction stringlengths 0 29.8k ⌀ |
|---|
there are three elevators in a building that has twelve floors. find an algorithm that needs to find the the best possible way to stop at any particular floor considering the traffic waiting for the lift on that floor. consider the following constraints
1. there can be infinite people that need to use the lift any a... |
random problem- the three elevator problem |
|algorithms| |
Can we prove that classical search algorithms cannot do better than a binary search algorithm with complexity $O(log(n))$ ?
If so, how do we prove it? |
Time complexity of search algorithms? |
|complexity-theory|search-algorithms|lower-bounds| |
Let $A$ be a comparison-based search algorithm that takes a collection $C$ of $n$ elements and an element $x$ as input and outputs the position of $x$ in $C$, or reports that $x \not\in C$.
Let $c(n)$ be the maximum number of comparisons performed by $A$ over all possible inputs where $C$ has $n$ elements.
Since $A... |
null |
There is an old CPU running a program in which memory operations
currently take 30% of its execution time. Scientists find that adding a cache memory
speeds up 80% of memory operations by a factor of 6. Adding a second level of cache
speeds up half of the remaining 20% by a factor of 3. By how much does the overall ... |
Amdahl's law to determine the overall speed increase using the optimizations |
|computer-architecture| |
null |
These languages families are related by similar names only, both formalisms have their own relation to the concept of counting.
The beauty of regular languages is that they can be defined using (finite) automata, (regular) expressions and (monadic second order) logic. The Myhill-Nerode theorem shows that (minimal d... |
So I'm kind of confused as I'm not that deep into the algebraic theory of languages.
The wikipedia article states:
> Another way to state Schützenberger's theorem is that star-free languages and counter-free languages are the same thing.
What does counter-free languages mean here?
Let's say that $CL$ denot... |
So I'm kind of confused as I'm not that deep into the algebraic theory of languages.
The wikipedia article states:
> Another way to state Schützenberger's theorem is that star-free languages and counter-free languages are the same thing.
What does counter-free languages mean here?
Let's say that $CL$ denot... |
null |
I am exploring several approaches to summing floating point values, such as:
1. Naive summation, for comparison
2. Summing sorted values
3. summing with numpy, again for comparison
4. [Kahan's algorithm][1]
5. [Pairwise summation][2]
6. Kahan's algorithm on the same sequence sorted by absolute value
7. ... |
Comparison of different algorithms for summing floating point numbers |
|floating-point| |
We know that in the case where, L(D1) = L(D2), the problem is undecidable. But what happens when the languages are not equal?
I would assume it's still undecidable, but is it recognizable? And how would we build a recognizer for it? |
If we have two TMs D1 and D2 and the languages of the TMs L(D1) != L(D2), then is this problem decidable/recognizable? |
|turing-machines|automata|undecidability| |
null |
While searching for the structure of the MMU, I found the image below (80386 Internal Architecture).
I have three questions.
**Q1. I'd like to know the roles of 'Adder', 'Page Cache', and 'Control and Attribute PLA'.**
I found some description for 'Control and Attribute PLA' (link below), but I still can't und... |
80386 MMU Internal Architecture |
|operating-systems|memory-management|cpu| |
Roles of 80386 MMU Paging Unit and similarity with modern CPU MMU |
## My Problem ##
I'm currently dealing with an algorithmic problem that involves two input lists:
1. A list of natural numbers $[A_1, A_2, \dots, A_n]$ with $A_1, \dots, A_n \in \mathbb{N}$.
2. A list of triples $[(B_1, C_1, D_1), (B_2, C_2, D_2), \dots, (B_m, C_m, D_m)]$ with $m\geq n$, natural numbers $B_1, ... |
there are three elevators in a building that has twelve floors. find an algorithm that needs to find the the best possible way for the elevators to stop at any particular floor considering the traffic waiting for the lift on that floor. consider the following constraints
1. there can be infinite people that need to ... |
there are three elevators in a building that has twelve floors. find an algorithm that needs to find the the best possible way for the elevators to stop at any particular floor considering the traffic waiting for the lift on that floor. consider the following constraints
1. there can be infinite people that need to ... |
The usual rule on this site is to ask only one question per post, so I'll answer the first question. Specifically, I'll focus on the case where there is only one discount rule, and it can only be applied once. In that case, the problem can be solved with a greedy algorithm:
- Let $n_a := a, n_b := b, n_x := 0... |
null |
I was trying to count the cpu_cycles from an ARM processor 4 core Cortex A78 to be exact) using the PMU registers. Now, at the beginning, I read the cpu cycles counter register, then for test just run one `asm("nop")` and then read the cpu cycles register back. I consistently get the result 7. At this point, if I add u... |
Counting the expected number of CPU cycles for n-number of assembly instructions |
|computer-architecture|performance| |
I am using the JPS algorithm to find the shortest path from start $S$ to goal $G$ on a binary grid where each cell can be eithe 0 (free) or 1 (obstacle). Now, I would like my algorithm to take into account the distance between the path and the obstacles and to find a path that approximates the shortest, while being "sa... |
JPS-like path finding algorithm that keeps a distance from the obstacles? |
|shortest-path| |
That's three questions, but I'll try my best. I looked at [other techincal papers about the i386][1], and this is my best guess.
**1. I'd like to know the roles of 'Adder', 'Page Cache', and 'Control and Attribute PLA'.**
I can't work out why there's an adder in the paging unit. It's not needed in the i386 to cal... |
null |
Given regular $R$ and nonregular $N$ you investigate whether their union $R\cup N$ is regular or not, and you state that you are aware that the outcome depends. Now you consider special cases. Two of these cases consider the intersection $R\cap N$ of both languages.
It turns out that not this intersection, but the s... |
null |
Currently P vs NP is the holy grail of theoretical computer science. And the nature of the problem is as such that if actually P = NP is proved then most of the proofs for mathematical statements would be trivial to find, and on the exact other end if P != NP is proved then one would appreciate the hardship of finding... |
( soft question ) p vs np - is such a situation possible? |
|complexity-theory|np-complete|p-vs-np|open-problem| |
There is an extremely standard proof that IP⊆PSPACE, used for instance [here](https://en.wikipedia.org/wiki/IP_(complexity)#IP_%E2%8A%86_PSPACE), [here](https://cs.brown.edu/courses/gs019/papers/ip.pdf), or [here](https://www.cs.umd.edu/~jkatz/complexity/f11/lecture19.pdf), by the argument that the full protocol is max... |
Easy proof of IP ⊆ PSPACE for private coins |
|complexity-theory|education|interactive-proof-systems| |
null |
I have a question about linear bounded automaton. Is it false that every recursively enumerable language is recognized by a LBA ?
Because LBA has limited tape size so not all recursively enumerable languages can be recognized by an LBA because some of them may require unbounded space for their recognition ? |
every recursively enumerable language is recognized by LBA |
|computability|linear-bounded-automata|recursively-enumerable| |
Yes of course it is possible. Everything is possible. Such situations have been rare in mathematics, so I would not bet on it, but we have no way to rule out such a possibility. We do know that [most of the standard proof techniques we use every day in complexity theory are unlikely to work](https://cs.stackexchange... |
{"OriginalQuestionIds":[139863],"Voters":[{"Id":4287,"DisplayName":"Hendrik Jan"},{"Id":755,"DisplayName":"D.W."}]} |
I have written the following greedy stays ahead proof for the problem of covering an interval with subintervals. Is it correct? I think it is, but this is my first time proving a greedy algorithm.
Suppose you have a set of $n$ subintervals $\{1, 2,...,n\}$, and each subinterval has a left and right end $(l_i, r_i)$... |
Is the following a correct proof for the interval covering problem? |
|algorithms|greedy-algorithms| |
I have written the following greedy stays ahead proof for the problem of covering an interval with subintervals. Is it correct? I think it is, but this is my first time proving a greedy algorithm.
Suppose you have a set of $n$ subintervals $\{1, 2,...,n\}$, and each subinterval has a left and right end $(l_i, r_i)$... |
I have written the following greedy stays ahead proof for the problem of covering an interval with subintervals. Is it correct? I think it is, but this is my first time proving a greedy algorithm.
Suppose you have a set of $n$ subintervals $\{1, 2,...,n\}$, and each subinterval has a left and right end $(l_i, r_i)$... |
I'm trying to determine whether there exists a model for the following logical formula: $(p_1 \to (p_2 \lor p_3)) \land(p_2 \to \neg p_3) \land ((p_1 \lor p_3) \to \neg p_2)$. Here's my understanding of the formula: If p1 is true, then either p2 or p3 must be true, and if p2 is true, then p3 must be false. However, thi... |
Is there a model for the given logical formula, and if not, why? |
|logic|propositional-logic|model-checking| |
I'm pretty sure b and d are ll2 and not one but not 100% sure.
(a) S → aaScc | aaBbc | aaBbb | aBb | ac | Ʌ
B → aBb | Ʌ
(b) S → aaScc | aaBbc | aBb | ac | Ʌ
B → aBb | Ʌ
(c) S → aaScc | aaBbc | B | ac | Ʌ
B → aBb | Ʌ
(d) S → aaScc | aaBbc | B | ac
B → aBb | Ʌ
|
Which one is an LL(2) but not an LL(1) |
|formal-languages|context-free| |
I'm pretty sure b and d are ll2 and not one but not 100% sure.
(a) S → aaScc | aaBbc | aaBbb | aBb | ac | Ʌ
B → aBb | Ʌ
(b) S → aaScc | aaBbc | aBb | ac | Ʌ
B → aBb | Ʌ
(c) S → aaScc | aaBbc | B | ac | Ʌ
B → aBb | Ʌ
(d) S → aaScc | aaBbc | B | ac
B → aBb |... |
null |
Set all variables to false, that way each implication has a false left-hand-side and thus it's satisfied. |
Be lazy: encode your problem in the input language of your favourite SAT solver and feed the resultung term to it. If it answers "SAT" it'll also provide a model. If not, then there's no model. |
null |
I have written the following greedy stays ahead proof for the problem of covering an interval with subintervals. Is it correct? I think it is, but this is my first time proving a greedy algorithm.
Suppose you have a set of $n$ subintervals $\{1, 2,...,n\}$, and each subinterval has a left and right end $(l_i, r_i)$... |
[This video][1] of a group, who simulated (a very simple version of) Minecraft inside Minecraft itself got me thinking about the performance of such setups.
Another example to what I'm referring to, would be [Conway's Game of Life simulating itself][2].
The first example runs through a bunch of modifications at 0... |
Complexity of simulations in simulations |
|complexity-theory|turing-machines|computability|recursion|simulation| |
[This video][1] of a group, who simulated (a very simple version of) Minecraft inside Minecraft itself got me thinking about the performance of such setups.
Another example to what I'm referring to, would be [Conway's Game of Life simulating itself][2].
The first example runs through a bunch of modifications at 0... |
You can build a universal Turing machine with only 7 states, or only 15 states if you require that the tape store binary symbols. See https://en.wikipedia.org/wiki/Universal_Turing_machine#Smallest_machines.
It follows that there is always a way to simulate a Turing machine with N states, using a Turing machine wit... |
null |
That's three questions, but I'll try my best. I looked at [other techincal papers about the i386][1], and this is my best guess.
**1. I'd like to know the roles of 'Adder', 'Page Cache', and 'Control and Attribute PLA'.**
I can't work out why there's an adder in the paging unit. It's not needed in the i386 to cal... |
Two effects:
1. instructions measuring cycles have their own effects and they can't be used for such a small code snippet. they are better used for code running for thousands of cycles
2. Modern CPUs are OoOE and they execute multiple instructions per cycle and in arbitrary order. before trying to measure anything yo... |
null |
I learned about abstract state macines recently, and on first sight they seem somehow reminiscent to TLA formalism. For example both:
1. Are used to research possible state sequence and prove safety/liveliness properties abot them
2. Use notion of refinement
3. Have specification language on top of them
So I wo... |
Are ASM and TLA+ somehow related? |
|computation-models|temporal-logic|tlaplus| |
null |
Given a string length $S$, find a substring length $k$ that has the most occurrences in the given string.
We want $O(S)$ time complexity in an average case.
I think the solution lies in sophisticated use of *Rabin-Karp algorithm*.
I've tried to use the sliding window method, but that results in $O(S * k)$ ti... |
Find a substring length $k$ with maximum occurrences |
|algorithms|data-structures|strings|big-o-notation|hash-tables| |
The [FLP paper][1] provides proof in section "4. Initially Dead Processes" that consensus is possible if majority of processes live and no process dies during the consensus protocol. The proof has 4 main steps:
1. Build G graph in way that each process broadcast it's process number and waits for the message from L... |
> I have no clue about how the values in the other two lemmas are brought up.
The _how_ is this: What are the values $a$ and $b$ such that $ab = n$ and $O(a + b)$ is minimized?
The answer is $\sqrt n$, and that value is _chosen_ in the argument above for that precise reason.
After $\sqrt n$ phases, we know tha... |
> I have no clue about how the values in the other two lemmas are brought up.
The _how_ is this: What are the values $a$ and $b$ such that $ab = n$ and $O(a + b)$ is minimized?
The answer is $\sqrt n$, and that value is _chosen_ in the argument above for that precise reason.
After $\sqrt n$ phases, we know tha... |
Each substring occurrence of your length $k$ pattern is the suffix of a of a substring. As such, a *suffix tree* will provide a fast way to store all possible suffixes and - in particular in your case - all substrings of length $k$, as well as provide a way to detect when you are reading a $k$-substring that has been s... |
What is the expected maximum matching size of a bipartite graph $(A\cup B, V)$ where $\lvert A\rvert = n$ and $\lvert B\rvert = n$ and the probability of a edge existing between $A$ and $B$ is a fixed $p$. If a general formula doesn't exist how about for $p = 0.5$ or some other $p$. |
Expected maximum matching size in a random bipartite graphs |
|algorithms|graphs|bipartite-matching|bipartite-graph| |
Prove that you always know what rule to apply if you know the next two symbols. Then show a sentence where knowing only the next symbol doesn’t determine the next rule. |
Kahan’s algorithm calculates a+b and the exact rounding error if |a| >= |b|. Actually for a slightly larger range of values. So for a sum of array elements, if the sum so far is always absolutely greater than the next array element, then Kahan calculates simultaneously the naive sum, and the naive sum of the exact roun... |
You have board size and one Knight but what is different is that when you move it you have to duplicate the knight and the 2 duplicates have to be in valid position from the knight
This gets repeated until the board is filled with knights just like visited in the original problem but both duplicates can be moved, o... |
Similar problem to Knight's tour |
|recursion|backtracking| |
How do you express the rule $Da\rightarrow aaD$ in terms of valid rules of CSG?
I mean, rules like $\alpha A\beta\rightarrow\alpha\psi\beta$. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.