instruction
stringlengths
0
29.8k
⌀
|information-theory|encoding-scheme|kolmogorov-complexity|
in $\lambda x . f(xx)$, you are correct to say that $x$ is the variable of a lambda abstraction. However, a variable is simply a placeholder for the substitution that happens when the lambda abstraction is applied to some argument. Consider the following application: $$ (\lambda x . f(x\,x))\,y \;\to_\beta\; f(y\, y) ...
Yes. Fix an arbitrary `root` of your tree. Then perform a DFS where you compute for each node, what is the maximum value on its subtree (including itself): ``` function max_value_on_subtree(node, parent = NIL): node.max_value = node.value for neighbor in node.neighbors: if neighbor == pa...
null
I was in an ML talk recently, where the speaker talked about how theory of ML has completely failed to explain much of anything that we do in practice. Take, as one simple example, stochastic gradient descent. Would sampling with or without replacement converge faster? Empirically, the community has known that with...
I was in an ML talk recently, where the speaker talked about how theory of ML has completely failed to explain much of anything that we do in practice. Take, as one simple example, stochastic gradient descent. Would sampling with or without replacement converge faster? Empirically, the community has known that with...
I was in an ML talk recently, where the speaker talked about how theory of ML has completely failed to explain much of anything that we do in practice. Take, as one simple example, stochastic gradient descent. Would sampling with or without replacement converge faster? Empirically, the community has known that with...
The neural network you're building in Tensorflow does not predict categories. The neural network gives predictions on a continuum. It is then up to you to decide what you want to do with those predictions. Often, the predictions are in the range $[0,1]$ and can be interpreted as probabilities of membership in one of th...
I don't think this should be a surprise. You fit your model on the original labels, and while you (probably) did not optimize the ROCAUC in the model training, many measures of model performance are at least roughly associated with ROCAUC. This is to say that the predictions are as good as the model can get for t...
Your assumptions may be a little bit off. Deep learning is largely an engineering field, and it is a young and rapidly moving one. Most "why" questions don't have very good answers. To the extent that there are partial answers to the "why" questions, mostly they are found in research papers, and I'm not sure whether...
null
I am struggling to solve the following excersise: > Design an assignment of a group of n students to m classes. Student i > should take a minimum of $l_i$, and a maximum of $u_i$ within a set C1 > of classes. Class j should be attended by a minimum of $m_j$ and a > maximum of $M_j$ students in order to be activat...
Scheduling classes with lower and upper bounds on students and classes
|algorithms|complexity-theory|algorithm-analysis|network-flow|bipartite-graph|
I am struggling to solve the following excercise: > Design an assignment of a group of n students to m classes. Student i > should take a minimum of $l_i$, and a maximum of $u_i$ within a set C1 > of classes. Class j should be attended by a minimum of $m_j$ and a > maximum of $M_j$ students in order to be activat...
In practice, it seems that many NP-hard problems "usually" lead to easy instances, in the sense that a commercial solver can handle them reasonably. A few past questions on this topic (see [here][1] and [here][2]) have been answered by saying they are not well-posed Here's a shot at a asking a question which might h...
What do we know about the asymptotic proportion of "easy" instances of NP-complete problems
|np-complete|
The neural network you're building in Tensorflow does not predict categories. The neural network gives predictions on a continuum. It is then up to you to decide what you want to do with those predictions. Often, the predictions are in the range $[0,1]$ and can be interpreted as probabilities of membership in one of th...
Unfortunately, I don't think this way of formalizing the problem is going to lead to much insight. The practical experience you are referring to has to be a consequence of something about the distribution of instances seen in practice: that "not-too-hard" instances are common in practice, in the settings where comme...
I'm currently preparing for a final exam in Networks and Internet Systems. I don't have a large background knowledge on the topics, so I'm attempting to use python to approach the majority of question in the exam. I had an original series of code written out but when I try to use it for this question, it runs, but give...
Networks and Internet Systems
|python|
I'm currently preparing for a final exam in Networks and Internet Systems. I don't have a large background knowledge on the topics, so I'm attempting to use python to approach the majority of question in the exam. I had an original series of code written out but when I try to use it for this question, it runs, but give...
null
The resource that helped me the most in understanding the math behind deep learning is the [excellent book "Neural networks and deep learning" by Michael Nielsen][1], which is available online for free (legally). [1]: http://neuralnetworksanddeeplearning.com/index.html
null
null
I am trying to understand the background literature on regular language inference in the TTT paper ("The TTT Algorithm: A Redundancy-Free Approach to Active Automata Learning" by Isberner, Howar and Steffen). In it, they say in *Related Work*, "Maler and Pnueli[22] suggested adding all suffixes of the counter examples ...
In regular language inference, how is the table kept consistent?
|formal-languages|regular-languages|finite-automata|
In regular language inference, how is the observation table kept consistent?
null
I am trying to understand the background literature on regular language inference in the TTT paper ("The TTT Algorithm: A Redundancy-Free Approach to Active Automata Learning" by Isberner, Howar and Steffen). In it, they say in *Related Work*, "Maler and Pnueli[22] suggested adding all suffixes of the counter examples ...
I am trying to understand the background literature on regular language inference in the TTT paper ("The TTT Algorithm: A Redundancy-Free Approach to Active Automata Learning" by Isberner, Howar and Steffen). In it, they say in *Related Work*, "Maler and Pnueli[22] suggested adding all suffixes of the counter examples ...
null
null
null
null
[![enter image description here][1]][1] This is the pseudocode for insertion sort. My question is this: suppose I have the array [5,2,4,6,1,3]. key = 2 and i = 1. Then A[i+1] = A[i] is A[2] = A(1) = 5. So now isn't the new array [5,5,4,6,1,3]? Where in the pseudocode does it write the 2 into the first place...
Insertion sort - how it works
|sorting|
[![enter image description here][1]][1] This is the pseudocode for insertion sort. My question is this: suppose I have the array [5,2,4,6,1,3]. key = 2 and i = 1. Then A[i+1] = A[i] is A[2] = A(1) = 5. So now isn't the new array [5,5,4,6,1,3]? Where in the pseudocode does it write the 2 into the first place...
After "speaking" with ChatGPT, I decided to test __Z Order Curve__. The code interleaves 2D data, then search for range x: [2..4], y: [2..4] Programming code using C/C++ should be as follows: #include <cstdint> auto interleave_bits_2d(uint8_t x, uint8_t y) { using Result = uint16_t; ...
Help understand Z order curve range searching
|algorithms|data-structures|databases|
Unfortunately, I don't think this way of formalizing the problem is going to lead to much insight. The practical experience you are referring to has to be a consequence of something about the distribution of instances seen in practice: that "not-too-hard" instances are common in practice, in the settings where comme...
null
Let $G$ be the CF grammar that has the production rules: $S \to aS | aSbS | c$. Show that $G$ is ambiguous. I thought of proving it by representing the string $aacbc$ but I don't know if it is correct as a solution: $aS \to aaSbS \to aacbS \to aacbc$ $aSbS \to aaSbS \to aacbS \to aacbc$
null
Question ----------------- Prove that the number of comparisons between elements in binary heap build is at most $2n-2$. $n$ is the total number of the nodes. ---------- Pseudocode ----------------- ``` BUILD-MAX-HEAP (A) 1 heap-size [A] < - length[A] 2 for i <- Length[A]/2| downto 1 3 do MAX-HE...
|algorithms|data-structures|algorithm-analysis|binary-trees|heaps|
null
Testing whether a number (N) is prime or not can be made very fast but it will require storage space. If there is a central repository that stores all prime numbers found till now and if there is a webAPI that returns these numbers or one/few number(s) at a time (sequentially) then it will be very fast to test wheth...
null
Does the pumping lemma for context-free languages really require accepting a string with zero levels of nesting?
null
I have an algorithmic problem in which I have a highway that is a straight line of length $n$ and a set of unique respective costs for construction of a radio tower for each mile on the highway. I am trying to use dynamic programming to find a way to minimize the cost of ensuring that each point in the highway is cover...
null
It is $O(n^2)$. Since there are only $256$ possible values, we can use counting sort, a non-comparison sorting algorithm, to count how often each pixel value occurs in $O(n^2)$ time and find the median in $O(1)$ time with at most $256$ steps. Then we can apply the function to each of the $n^2$ pixels in $O(n^2)$.
null
The pseudo code for DFS using recursion would look something like this: ``` def DFS(node): if node is visited: return mark node as visited for each child in node: DFS(child) ``` This recursive method works because every time we call the function it goes as deep as it can into th...
null
Suppose we have the following directed graph. When I click on - say - node $e$, it should make the in-pointing neighbors and out-pointing neighbors of node $e$ red, as shown in the below Expected Result. My purpose is that when I click on any node of a directed graph it should tell me what nodes it is influencing (out-...
null
>Heap just guarantees that elements on higher levels are greater (for max-heap) or smaller (for min-heap) than elements on lower levels, whereas BST guarantees order (from "left" to "right"). If you want sorted elements, go with BST. Source: https://stackoverflow.com/a/6147264/781723 >Heap is better at findMin/...
Let $\Sigma$ be a finite nonempty alphabet. Is the set of all DFAs over $\Sigma$ countable? I know the set of all regular languages is countable, however, it is impossible to build an injection from the DFAs to the regular languages since a regular language isn't necessarily accepted by only a single DFA.
null
Here is the explanation in Sipser's. For step 3, why should we accept only when none of the markers lie on an accept state? If the alphabet of the language is $\Sigma = \{a,b,c\}$, and after the first iteration, let's say $a$ and $b$ lie on the accept state while $c$ doesn't (meaning that c is not in the language). Thu...
null
Let $L_1 = \{ a^{n}b^{m} \mid n > m > 0 \} $. Describe a non-regular language $L_2$ such that $L_3 = L_1 \cup L_2$ is regular and $L_3 ≠ A^{*}$ (where $A = \{ a, b \} $) From the trace, I cannot prove this with the simple language of $L= \{ a^{n}b^{m} \mid n,m > 0 \} $ since it must be different from $A^{*}$. I h...
Proof that a union of two non-regular languages may be regular
null
I know that the regularity condition for master theorem Case#3 stating that [$af(\frac{n}{b}) ≤ cf(n)$ for some constant $c < 1$ and all sufficiently large n] always holds when the $f(n)=n^k$,$f(n)=\Omega(n^{\log_b a+\epsilon})$. However, I have tried to prove this statement, and was unable to do so. The question is...
Why does case 3 regularity condition of master theorem always hold when f(n)=$n^k$ and f(n)=$\Omega(n^{\log_b a+\epsilon})$
null
I have come across a c program like this . ```c int main() { int a,i=4; int z=5; a=--i+ --i+ --z; printf("%d %d",a,i); return 0; } ``` What will be the output? I need some explanation.
null
The problem of finding a solution for functional equations can be defined as: > Let $A_0, A_1, A_2, \dots, A_n, B_0, B_1, B_2, \dots, B_n, X$ be terms of the $\lambda$-calculus, where all terms are known except for $X$. Given a set of $N$ equations in the form $X A_n \to B_n$ (that is, $X$ applied to $A_n$ strongly ...
|algorithms|reductions|satisfiability|lambda-calculus|functional-programming|
null
Show that $ALL_{NFA}$ = {$\langle M\rangle : M$ is $NFA$ and $L(M) = \Sigma^*$} is $\text{PSPACE-complete}$. I've manged to prove that the langauge is in $\text{PSPACE}$. Indeed, it is easy to see that $\overline{ALL_{NFA}}\in \text{NPSPACE}$ (the machine just nondeterministically guess a word rejected by the automa...
ALL_{NFA} is PSPACE-complete
|turing-machines|finite-automata|space-complexity|nondeterminism|
null
In an image processing system, an algorithm processes an $N \times N$ image with each pixel being a number between $0$ and $255$. It finds the median value $M$ in the $N \times N$ image and applies the binary function $f(x)$ to every pixel. $f(x) = \begin{cases} 1 & \text{if $x ≥ M$} \\ 0 & \text{if $x < M$} ...
$N \times N$ Image Processing Time Complexity: Grayscale to Binary using Median Step Function
|algorithms|image-processing|
null
{"Voters":[{"Id":755,"DisplayName":"D.W."}]}
I'm relatively new to computational complexity and am trying to use the time hierarchy theorem to show that $Time(n^7)$ is strictly contained in P. I understand that the time hierarchy theorem says that if the limit as n tends to infinity of $\frac{T_1(n)}{T_2(n)}=0$ then $Time(T_1(n))$ is strictly contained in $Time(T...
Using time hierarchy theorem to show $Time(n^7)$ strictly contained in P
|complexity-theory|time-complexity|complexity-classes|polynomial-time-hierarchy|
Question 1: L = { 0^n 1^n | n > 0 } My answer = S -> 0 S 1 | 10 Question 2: L = { 101^n0^2n | n > 0 } My answer = S -> 101 S 00 | 100 Can anyone correct this if there is any issue with this CFG?[![enter image description here][1]][1] [1]: https://i.stack.imgur.com/FWEcc.jpg
Is this correct Context free grammar(CFG) for these two languages?
|automata|finite-automata|context-free|pushdown-automata|
First one seems correct. Second one is wrong because n > 0 so there must be at least two 1s in the string. The string 100 can't be derived from S.
First one seems correct. Second one is wrong because n > 0 so there must be at least two 1s in the string. The string 100 can't be derived from S. You need to add another non-terminal, say T such that T derives 1T00 and S derives 101T00.
First one seems correct. Second one is wrong because n > 0 so there must be at least two 1s in the string. The string 100 can't be derived from S. You need to add another non-terminal, say T such that T derives 1T00 or the empty string and S derives 101T00.
From the round-robin wikipedia > In the absence of time-sharing, or if the quanta were large relative to the sizes of the jobs, a process that produced large jobs would be favored over other processes. Isn't that obvious? I mean if burst time of $P_1 > P_2$, then $P_1$ will remain in the running $\Longleftrightar...