instruction
stringlengths
0
29.8k
⌀
I've invented an abstract structure to represent a comparison-based sorting algorithm, which I will call a *comparison tree* (similar to the decision tree of a comparative sorting algorithm). Specifically, a comparison tree is a full binary tree rooted at $s$ where each non-leaf node is labeled with an ordered pair $(...
|algorithms|data-structures|sorting|combinatorics|decision-tree|
A process can receive two kinds of signals classified based on the source and reason. - Synchronous are the one that are generated by illegal memory access or division by zero. - Asynchronous are the one that are generated by another process like SIGKILL and etc. In the both cases, the signal must be handled eit...
How synchronous and asynchronous signals are different?
|operating-systems|
Mitchell specifies a set data type: ie, an algebraic specification for set. He then asks to prove that the equation *union s s' = union s' s [s, s': set]* does not hold in the initial algebra. He suggests that we use the following result: two terms are provably equal iff they reduce to a common term. Here are th...
Mitchell FPL 3.6.2 (Show that equation does not hold in initial algebra)
|semantics|operational-semantics|
According to Section 2.1 in the paper provided: > Loops are normalized and split in two categories: loops from 0 to some bound expression with an integer stride, called `do` loops; other kinds of loops, referred to as `while` loops. A *static control part* (SCoP) is a maximal set of consecutive statements without `...
null
If all you need to show is that `union a b = union b a` is not provable, where `a` and `b` are variables, it suffices to find one particular instance where the equation does not hold, so how about: ``` union (insert 42 empty) (insert 13 empty) = union (insert 13 empty) (insert 42 empty) ``` The left-hand side rewri...
There are $n$ sticks of lengths $1$ to $n$. Upon permuting them randomly, we may calculate the average number of peaks when viewed from left. A peak is a stick such that all sticks to its left are shorter than it. For example, suppose there are $3$ sticks. The permutations and numbers of peaks are ``` 123 3 132 2...
null
There are $n$ sticks of lengths $1$ to $n$ in a row. Upon permuting them randomly, we may calculate the average number of peaks viewed from left. A peak is a stick such that all sticks to its left are shorter than it. For example, suppose there are $3$ sticks. The permutations and numbers of peaks are: ``` 123 3 ...
Growth of the average numbers of peaks for the permutations of $n$ sticks
There are $n$ sticks of lengths $1$ to $n$ in a row. Upon permuting them randomly, we may calculate the average number of peaks viewed from left. A peak is a stick such that all sticks to its left are shorter than it. For example, suppose there are $3$ sticks. The permutations and numbers of peaks are: ``` 123 3 ...
null
The usage of "within" is a bit confusing, but I think it means the space complexity is never smaller than the time complexity divided by a factor of $b$. The space complexity of an algorithm is always smaller than its running time (since allocating/using $x$ space requires at least $c\cdot x$ time for some constant $c$...
Here is an algorithm to consider https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8982863/
null
null
null
I was referring to the textbook Artificial Intelligence: A modern approach 3rd by Stuart Russell and Peter Norvig. what to prove about the general "graph search": (Here I assume "within a factor of b" means multiplier $b$ instead of [addition $\pm b$][2] based on the complexity context. So if time complexity is $O(b...
null
There are $n$ sticks of lengths $1$ to $n$ in a row. Upon permuting them randomly, we may calculate the average number of peaks viewed from left. A peak is a stick such that all sticks to its left are shorter than it. For example, suppose there are $3$ sticks. The permutations and numbers of peaks are: ``` 123 3 ...
I'm wondering where (how? why?) my reasoning (by imagining the recursion tree) deviates from the application of the Master Theorem (Case 1) to this recurrence. The Master Theorem gives $\Theta(n^{\log_{5}4})$, whereas reasoning from the recursion tree gives me $\Omega({\log n})$ and $O(\log^{2}n)$. My rationale: ...
Evaluating $T(n) = 4T(\frac{n}{5} + \log n$: Master Theorem vs. Recursion Tree
|recurrence-relation|master-theorem|
Evaluating $T(n) = 4T(\frac{n}{5}) + \log n$: Master Theorem vs. Recursion Tree
null
null
We can directly approach this problem using the recurrence tree method. Let us now denote $1-\alpha$ as $\beta$ for notational clarity. For any constant $l\ge2$ we have, $\alpha^l+\beta^l < 1$. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb...
Here you want to obtain a lower bound (big-omega) for your sum expression. The idea is to carefully split the summation into two parts so that it leads to your desired result, which is $\Omega(n)$ in this case. Here, they have split the sum into two halves. For the first half, they have replaced all entries with 0, whi...
Observe that $n^5+n^7 > n^7 \ge n^5, ~~\forall n \ge 1$. Then clearly, the 'largest lower bound' is $n^7$. Therefore, $n^5+n^7 = \Omega(n^7)$ as well as $n^5+n^7 = \Omega(n^5)$ and also $n^5+n^7 = \Omega(1)$, but we generally choose the one that is largest and more tight.
The usage of "within" is a bit confusing, but I think it means the space complexity is never smaller than the time complexity divided by a factor of $b$. The space complexity of an algorithm is always smaller than its running time (since allocating/using $x$ space requires at least $c\cdot x$ time for some constant $c$...
A process can receive two kinds of signals classified based on the source and reason. - Synchronous are the one that are generated by illegal memory access or division by zero. - Asynchronous are the one that are generated by another process like SIGKILL and etc. In the both cases, the signal must be handled eit...
$ Fin = \{ L \in \Sigma^* : |L| $ is finite and greater than 0 $ \} $ Proof or disproof Fin = Fin-Complete Where Fin-Complete means that for every $ L_1,L_2 \in Fin $ there exist a valid reduction $ L_1 \leq L_2 $ my trial: Consider two languages $ L_1 $ and $ L_2 $ where $ L_1 $ contains a single string ...
Proof or disproof Fin = Fin-Complete $ Fin = \{ L \in \Sigma^* : |L| $ is finite and greater than 0 $ \} $
|formal-languages|turing-machines|
A process can receive two kinds of signals classified based on the source and reason. - Synchronous are the one that are generated by illegal memory access or division by zero. - Asynchronous are the one that are generated by another process like SIGKILL and etc. Quoting from the 9e OSC Book by Prof. Galvin, top...
null
Are languages generated from a statically typed language statically typed? So say, generating Python from C++. *to generate a language from another language:* You write a *transpiler* in a static language $L_s$ so that it can produce the equivalent program in language $L_{sORd}$. --- Issues: - The st...
The usage of "within" is a bit confusing, but I think it means the space complexity is never smaller than the time complexity divided by a factor of $b$. The space complexity of an algorithm is always smaller than its running time (since allocating/using $x$ space requires at least $c\cdot x$ time for some constant $c$...
Are languages generated from a statically typed language statically typed? So say, generating Python from C++. *to generate a language from another language:* You write a *transpiler* in a static language $L_s$ so that it can produce the equivalent program in language $L_{sORd}$. --- Issues: - The st...
The claim is correct. To see why, note that every language in $L\in Fin$ is non-trivial and regular. Indeed, $L$ is not empty, by the definition of $Fin$, and does not equal $\Sigma^*$ as then $L$ would be infinite. Now the claim follows from the fact that every regular language is decidable, and the fact that every ...
The claim is correct. To see why, note that every language in $L\in Fin$ is non-trivial and regular. Indeed, $L$ is not empty, by the definition of $Fin$, and does not equal $\Sigma^*$ as then it would be infinite. Now the claim follows from the fact that [every regular language is decidable][1], and the fact that [e...
How can I estimate the probability that the sum $S_n$ of $n$ uniform random 48-bit signed integers overflows a 64-bit signed integer? Since this is a normal distribution, I guess that the cumulative sums more or less oscillate around zero, and that the probability that they ever exceed 64 bits is vanishingly small. ...
Probability of overflow in a summation of fixed-size signed integers
|probability-theory|integers|
The usage of "within" is a bit confusing, but I think it means the space complexity is never smaller than the time complexity divided by a factor of $b$. The space complexity of an algorithm is always smaller than its running time (since allocating/using $x$ space requires at least $c\cdot x$ time for some constant $c$...
I have a direct graph with unweighted edges between the vertices, and possible cycles. I want an algorithm that I can pass in the graph and a number N, and have it spit out a set of N clusters each containing some of the vertices, such that: 1. Each vertex can only belong to one cluster 2. The total number of or...
Algorithm for "Clustering" a directed graph
|algorithms|graphs|optimization|clustering|
I have a direct graph with unweighted edges between the vertices, and possible cycles. I want an algorithm that I can pass in the graph and a number N, and have it spit out a set of N clusters each containing some of the vertices, such that: 1. Each vertex can only belong to one cluster 2. The total number of or...
I have a direct graph with unweighted edges between the vertices, and possible cycles. I want an algorithm that I can pass in the graph and a number N, and have it spit out a set of N clusters each containing some of the vertices, such that: 1. Each vertex can only belong to one cluster 2. The total number of or...
Why is the time complexity Log n base k? For the following code: for (int i=0; i<n; i++){ i*=k; }
null
Proof or Disproof Exists infinite languages that are RE-Complete attempt: Let L be an RE-Complete language. Define a padded version of L, denoted $ L' $ as follows : $$ L'= \{ x@^k | x \in L , k \in N \} $$ where @ is a new symbol not in the alphabet of L, and k represents the number of times the symbol is ...
Proof or Disproof Exists infinite languages that are RE-Complete
|formal-languages|turing-machines|
Proof or Disproof Exists infinite languages that are RE-Complete attempt: proof Let L be an RE-Complete language. Define a padded version of L, denoted $ L' $ as follows : $$ L'= \{ x@^k | x \in L , k \in N \} $$ where @ is a new symbol not in the alphabet of L, and k represents the number of times the sym...
Proof or Disproof Exists infinite languages that are RE-Complete attempt: proof Let L be an RE-Complete language. Define a padded version of L, denoted $ L' $ as follows : $$ L'= \{ x@^k | x \in L , k \in N \} $$ where @ is a new symbol not in the alphabet of L, and k represents the number of times the sym...
I've recently been reasoning about this algorithm as well. I think its both. You pointed out the starvation case. Here is the author's definition of deadlock as given on page 24 > **Freedom from Deadlock** If some thread attempts to acquire the lock, then some thread will succeed in acquiring the lock. If thread A c...
I've recently been reasoning about this algorithm as well. I think its both. You pointed out the starvation case. Here is the author's definition of deadlock as given on page 24: > **Freedom from Deadlock** If some thread attempts to acquire the lock, then some thread will succeed in acquiring the lock. If thread A ...
null
I would like to prove or disporove: there exists infinitely many languagess that are RE-Complete. Here is my attempt of the proof. Let $L$ be any RE-complete language. Define a padded version of $L$, denoted $L'$ as follows, where $k \in \mathbb{N}$ is a fixed number: $$L' = \{x@^k \mid x \in L\}.$$ where $@$ i...
Do there exist infinitely man languages that are RE-complete?
While reading the example given in [1]., I couldn't understand how the authors set up the logic to compute the weakest preconditions (*wp*) in their car example in section 4.2. The dynamics of the problem are given by - $x' = x + 0.1v$ $v' = v + 0.1a + \epsilon$ I don't see the authors working on the form...
How did the authors of Spice apply weakest precondition rule on their example car problem?
|machine-learning|programming-languages|formal-methods|
Calculate the average and variance of choosing a single signed 48 bit variable. Multiply by n to get the average and variance of choosing n 48 bit variables. The standard variation is roughly the square root of the variance. Calculate how many standard deviations away from the average you need to be for an overflow...
null
Let's say a Language ***L*** is **NON-semi decidable** and **undecidable**. Let's also take the Halting problem ***H***, which is a **semi decidable** and **undecidable** language. Is it possible to reduce ***L*** to ***H*** in a **many-one reduction**? I know that both are undecidable languages, and we can reduce...
I'm trying to prove the correctness of an interpreter for a simple extension of untyped lambda-calculus. The interpreter is *bounded*, i.e. in order to ensure its finiteness it has an additional parameter $n \in \mathbb N$ that decreases with each recursive call. The function returns $\bot$ when $n = 0$. This is the...
Closures break induction in correctness proof of interpreter
|lambda-calculus|correctness-proof|software-verification|interpreters|
Calculate the average and variance of choosing a single signed 48 bit variable. Multiply by n to get the average and variance of choosing n 48 bit variables. The standard variation is roughly the square root of the variance. Calculate how many standard deviations away from the average you need to be for an overflow...
null
I have a directed graph with unweighted edges between the vertices, and possible cycles. I want an algorithm that I can pass in the graph and a number N, and have it spit out a set of N clusters each containing some of the vertices, such that: 1. Each vertex can only belong to one cluster 2. The total number of ...
null
I'm trying to prove the correctness of an interpreter for a simple extension of untyped lambda-calculus with De Bruijn indices. The interpreter is *bounded*, i.e. in order to ensure its finiteness it has an additional parameter $n \in \mathbb N$ that decreases with each recursive call. The function returns $\bot$ when ...
null
Our problem is similar to [this](https://cs.stackexchange.com/questions/93959/optimal-flow-in-a-network-with-non-constant-edges-weights), but it details various approaches we can make. The problem also was formulated [operation research](https://or.stackexchange.com/questions/11603/numerical-infeasibility-for-movi...
null
I have exam next week about automata theory, languages and computation. I struggle with reductions (Undecidability). For example for this two problems, and need to check first if the language is recursive, RE but no recursive or NOT-RE. After that to prove with reduction, okay for proving is easy I think, but to check ...
Turing Machine language, Undecidable, reductions
|turing-machines|undecidability|
public static void sort(int[] A, int i, int j) { if (i >= j) return; int m = (i + j) / 2; // Division durch 2 abgerundet sort(A, i, m); sort(A, m + 1, j); if (A[m] > A[j]) { // swap A[j] and A[m] int temp = A[j]; A[j] = A[...
i am trying to find out the complexity of this recursive function
|algorithms|recursion|big-o-notation|
public static void sort(int[] A, int i, int j) { if (i >= j) return; int m = (i + j) / 2; sort(A, i, m); sort(A, m + 1, j); if (A[m] > A[j]) { // swap A[j] and A[m] int temp = A[j]; A[j] = A[m]; A[m] = temp; ...
The [Green500][1] is a biannual ranking of the world's most energy-efficient supercomputers. It was first measured in millions of floating-point operations per second per watt of power consumed, and is now measured in billions of FLOPs/watt instead due to advances in distributed computing. For instance, the Simons Foun...
The Green500 ranks supercomputer energy efficiency. Is there such a ranking of energy efficiency for data centers?
|databases|
Suppose the 48-bit signed integers are drawn uniformly randomly from $[-2^{47}, 2^{47}-1]$. To overflow, there must be at least $n = 2^{63}/2^{47} = 2^{16}$ integers drawn, so $n$ is large enough for the [Central Limit Theorem to apply](https://math.stackexchange.com/questions/357442/distribution-of-sum-of-discrete-uni...
Suppose the 48-bit signed integers are drawn uniformly randomly from $[-2^{47}, 2^{47}-1]$. To overflow, there must be at least $n = 2^{63}/2^{47} = 2^{16}$ integers drawn, so $n$ is large enough for the [Central Limit Theorem to apply](https://math.stackexchange.com/questions/357442/distribution-of-sum-of-discrete-uni...
public static void sort(int[] A, int i, int j) { if (i >= j) return; int m = (i + j) / 2; sort(A, i, m); sort(A, m + 1, j); if (A[m] > A[j]) { // swap A[j] and A[m] int temp = A[j]; A[j] = A[m]; A[m] = temp; ...
null
{"Voters":[{"Id":19799,"DisplayName":"qwr"}],"DeleteType":1}
public static void sort(int[] A, int i, int j) { if (i >= j) return; int m = (i + j) / 2; sort(A, i, m); sort(A, m + 1, j); if (A[m] > A[j]) { // swap A[j] and A[m] int temp = A[j]; A[j] = A[m]; A[m] = temp; ...