instruction
stringlengths
35
29.1k
Alongside the OBJ files for each figurine, Nintendo has released the following information about each figurine f: • the filament cost (amount of filament necessary) to print f, denoted fc, in grams, as an integer • the amount that Nintendo will pay for each printed copy of f, denoted fp Find P(N), the maximum profit wh...
I'm having trouble understanding the logic behind Hoare Triples. The question asks for the missing value of the precondition {X} {X} if (b mod 2 <> 0) t = 1 else t = 0 {t = b – 2*(b div 2)} Any help would be amazing!
I am missing something obvious here. Does ACC0 reach a ceiling AC0[m] with m being constant? By another description, ACC0 can use any m, which can trivially test modulus gates from [n/2,n] over all inputs. Any modulus active in that range indicates MAJ returns true, implementable as an OR over the current range of gate...
I'm referring to questions like this one: Mapping reduction to show NeverHalt is undecidable I understand with Turing reductions, you have to use oracle calls of the unknown language you're trying to prove is undecidable to solve a known undecidable language. However, with mapping reductions, am I right in assuming the...
Let $0 \le \alpha \le 1$. The complexity classs $\mathsf{RP}_\alpha$ consists of all languages $L$ for which we can find a probabilistic polynomial time Turing machine which satisfies the following conditions: $w \in L \Rightarrow \Pr[\text{accept}] \geq \alpha$. $w \notin L \Rightarrow \Pr[\text{accept}] = 0$. We de...
I am confused about the purpose/statement of the Acceptance problem: $A_{TM} =\{\langle M\rangle\,s |$ Turing machine $M$ accepts $s\}$ It can be shown that $A_{TM}$ is uncomputable, so we know that, in general, one cannot compute whether an arbitrary Turing machine will accept some input. Common sense tells me that fo...
how to prove that the lower bound of the Huffman coding problem is $\Omega(n \log n)$? Here Huffman coding problem is Huffman encoding. For example, Input: A string with different characters, say “ACCEBFFFFAAXXBLKE” Output: Code for different characters: Data: K, Frequency: 1, Code: 0000 Data: L, Frequency: 1, Code: 00...
How does cache memory take advantage of both temporal locality and spatial locality principles?
Given $n$ elements $x_1,\dots, x_n$, and algorithm $A$ which outputs $(r_1,\dots, r_n)=A(x_1,\dots, x_n)$, we say $A$ is $\epsilon$-sorting the list if $rank(x_i) \in (r_i-n\epsilon, r_i+ n\epsilon) $ for all $i$, where $rank(x_i)$ is the exact rank of $x_i$: $rank(x_i):=\#\{j:x_j\le x_i\}$. Suppose we have a noisy com...
In Scala we can print list val nums = (1 to 10).toList with both nums.filter(_ < 4).foreach(println) and for {n <- nums if n< 4} println(n) Are there any advantages of first syntax except ability to omit variable name in foreach(println)? Can we express evrything with second syntax or there are some things expressin...
The way I think of reducing problem $A$ to problem $B$ in polynomial time, i.e. $A \leqslant_P B$, is that you assume an efficient solution to $B$ which is enough to solve $A$. Now, this is suspiciously similar to $A \in \mathsf{P}^B$. I'm confident that $A \leqslant_P B \implies A \in \mathsf{P}^B$ but is the reverse...
I recently started self-learning about GNNs, and I have trouble understanding the difference between the GNN models. As I understand it, all GNN models apply an aggregation step on each node, and the different models differ in the aggregation function. Is the aggregation for a single node done by aggregating the entir...
I am considering the asymptotic analysis required to convert a polynomial of the shape $$P(x) = \prod_{i = 1}^{n}(1 + x^{s_i})$$ to its "full" representation, for example $$P(x) = 1+x^3+x^5+x^8+x^9+x^{12}+x^{14}+x^{17}.$$ Now, it would appear to me that we perform $n$ repetitions of performing $2^i$ multiplications, as...
Halting problem is not decidable in general, but are there interesting/useful subsets where it IS decidable? Bonus points if that subset is actually helpful. Example: If we know BB(x), then the halting problem for TMs with x states is decidable. The problem is BB(x) is not a computable function, as it basically require...
In his networking textbook, the world-renowned computer science expert Tanenbaum says that e-mail communication is inherently peer-to-peer. Here is the paragraph from the book: Peer-to-peer communication is often used to share music and videos. It really hit the big time around 2000 with a music sharing service called...
The regular languages are known to be closed under the operation "left half": $$ \operatorname{left}(L) = \{ x \in \Sigma^* : xy \in L \text{ for some } y \in \Sigma^* \text{ s.t. } |x|=|y| \} $$ What about the context-free languages?
I have a partially ordered set of numbers, represented as a vector<set<int>> (e.g. if $2 \preceq 4$ in this order, then poset[2] contains 4). Given 2 elements $x$ and $y$, what is an efficient way to find all their minimal upper bounds (that is, those which aren't greater than any other upper bound, but there may be ot...
Book: Parameterized Algorithms by Marek Cygan (free to download legally) Chapter about Multivariate polynomials on Page 353 (In the book not the pdf) Question 10.19: Describe a Monte Carlo $2^{3k}n^{O(1)}$ - time polynomial-space algorithm for the Triangle Packing problem: given a graph $ G $ and a number $ k \in N $,...
I am trying to prove the following statement (from book, page 317): Let $G(A,B,E)$ be a bipartite graph, where $A$ and $B$ are the two disjoint sets of vertices s.t. $|A|=|B|=n$. Let the number of matchings of size $k\le n$, be $m_k$. If $|E|>k$ then there exists an edge $e$, such that $\frac{m_{ne}}{m_k} \ge \frac{1}...
Considering the following recursive algorithm: $ T(n)= T(\frac{n}{2})+c_1(\frac {n}{2})^2+c_2n$. I was able to prove that this algorithm is $O(n^2 logn)$ I was trying to understand whether it is a tight bound or not, yet I was unable to prove that $ T(n)\in \Omega(n^2logn)$ Is it possible or maybe the algorithm's lower...
I need help writing the regular expression over the alphabet (0,1) represent the even numbers in base ten. So basically the regular expression would show represent an even number in binary. (also if you know what the FSA would look for that it would help as well)
I know that filling partial latin square and solving sudoku are NP-hard. But what are the counting versions of these two problems?
All-SAT is the problem of enumerating all satisfying assignments of a boolean formula. All-SAT is different from #SAT, where it suffices to find the number of satisfying assignments without enumerating them. Is the computational complexity of All-SAT known, or is this an open problem? In this CS Theory question, some s...
I am trying to show that $\forall \beta \gt0, \log(n^\alpha) = O(n^\beta)$, however I cannot use the limit definition, as demonstrated in similar questions on the forum. First I show that $\log(n^\alpha) = O(n)$, using the following method: $\log(n^\alpha) = \alpha \cdot \log(n) \leq \alpha \cdot n$ Thus for $c=\alpha^...
I wonder why two phase locking is designed in a way that as long as you release a lock, you cannot acquire any lock anymore, even for a lock on a different database object. Can't the scheme be relaxed to as long as you release the lock for an object, you cannot acquire the same lock again? So you release the lock on an...
I have been trying to understand the solution to the following problem: "Show that if $L_2$ and $L_3$ are Turing recognisable, then so is $L_2L_3 = \{w_1w_2 : w_1 \in L_2,w_2\in L_3\}$: which essentially says to use non-determinism to guess a partition $w$ (say $w=xy$) and run the Turing machines $L_1$ and $L_2$ on $x$...
Is it possible to use regular expression identities to prove or disprove that the RE1=0*(0+1)*0* and RE2=(0+1)* represent the same language?
If a dual core processor have 4 threads, then what will happen if i run an application which uses more than 4 threads? And just to make sure i'm understanding what are threads in a cpu, when an application uses more than one "task" on its main process a single core will switch back and forth between the threads to give...
I want to extend $\alpha$-equivalence to cover substitution. That is, I will implement runSubst_Term : Subst -> Tm -> Tm and prove: Theorem runSubst_Term_main_property (sub : Subst) (tm : Tm) : AlphaSubst sub tm (runSubst_Term sub tm). where the definitions of Subst, Tm, AlphaSubst are below. But I don't sure that A...
I have a time-serie and I fit different HMMs on it, each with a different number of hidden states. Now after sampling from the models , I'd like to compare the results with the ground truth data and find the model that gets closer to the real world data in the original time-serie. For now I simply compared visually the...
I'm currently going through past paper questions and was wondering if I could get some help answering this one? 'Consider a classification model which is applied to a set of records, of which 100 records belong to class A (the positive class) and 900 records to class B. The model correctly predicts the class of 20 reco...
I'm reading proof on Wikipedia that the existence of pseudorandom generators implies the existence of one-way functions. My understanding is that pseudorandom generators are defined as A function $G_l:\{0,1\}^l\to\{0,1\}^m$ is a pseudorandom generator if all of the following hold: a. $l<m$ b. $G_l\in\mathbf P$ c. For ...
I have seen this similar question but I can't seem to apply the same technique for the equation $7j = 5i + 6k$
When we have a universal family of hash functions, it gives us a few useful mathematical guarantees. But, if we pick a specific function from the family and use it all the time it's effectively like the family doesn't exists and we only have this one function. Therefore, the only logical thing seems to be switching a h...
Please, how can I prove that x . y' . z' simplifies to y' . z'? I have tried without success. Below is the context of my question; I am taking a course on Coursera
Suppose a Turing Machine (TM_G) that generates natural numbers following < or, equivalently, it generates words in lexicographical order. Then, that language/set is decidable. Because it is trivial to devise a (halting) TM_R, using TM_G, that recognize/accepts the words/numbers of that language/set. It is also clear (r...
From what I understand, stack and heap grow in opposite directions: However, why is it then the case that the stack is sometimes statically allocated, and generally smaller than the heap? We hear about stack overflows a lot more than heap overflows. For instance, the Linux kernel stack is limited in size, and recommen...
The A* algorithm terminates when the f (distance + heuristic) is less than the f values for all of the nodes that haven't been visited. Dijkstra's algorithm produces the shortest path to every node from a starting point (not just the end node - the goal). Is it possible to modify Dijkstra's algorithm so that when the d...
Consider the graph $G$, which is comprised of 2 vertex disjoint odd cycles ($C_1$, $C_2$) where $|C_1|$ and $|C_2| \geq 5$. $G$ is sub-cubic and connected, with edges in between the cycles. Because $G$ is sub-cubic, each node's degree $\leq 3$ but $\geq 2$. I am interested to know whether the minimum vertex cover of $G...
This is just something I've been wondering just out of curiosity. I apologize if this doesn't fall under the category of this forum, and if so feel free to divert me :) Whenever a computer does anything, it always handles a sequence of bits. My question is: how does it actually measure what bit goes in what place? I'm ...
Consider the following algorithm sketch: Given an edge-weighted directed acyclic graph $G = (V, E, w : E \to \mathbb{N})$, adjoin a temporary source $s$ and sink $t$ to get $G' = (V', E', w')$. $G'$ should have edges pointing from $s$ to all nodes in $G$ that have an empty set of in-neighbors, and edges pointing from a...
Problem Definition: Given a universe set $U = \{1, 2, \dots, n\}$ and a collection of $m$ subsets $S_1, S_2, \dots S_m \subseteq U$, find the minimum collection of subsets that cover $U$. I am specifically trying to find a $k$ polynomial time approximation algorithm for set cover where $k$ is the largest size of the su...
If I have a Lower triangular matrix of order n and I want to store non-null elements of this matrix in 1D array from first row to last row and within a row from left to right. What could be the mapping function to map the index of Lower triangular matrix Aij in 1D.
The negative answer to decidable = non-contracting grammar? suggests the following question: Is there a decidable language that can be recognized only by a space unrestricted Turing Machine (i.e. with infinite tape but in finite time)? This is, are there words, w, in a decidable language for which cannot be determine...
Quoting from Wikipedia: In mathematical logic, the disjunction and existence properties are the "hallmarks" of constructive theories such as Heyting arithmetic and constructive set theories (Rathjen 2005). The disjunction property is satisfied by a theory if, whenever a sentence A ∨ B is a theorem, then either A is a ...
Suppose, we have a two binary sequences, encoded as "recursive repeating sequences" (I don't know exactly how to name them). Each sequence can contain other sequences and has number related to how many times this sequence is repeated, or can contain a bit either 0 or 1. Following image describes it visually: On this i...
I want to know the steps for finding a Formula for Average number of total comparisons in bubble sort. Please look at this example: 4 3 2 1 -> 3 2 1 4 -> 3 comparisons 3 2 1 4 -> 2 1 3 4 -> 2 comparisons 2 1 3 4 -> 1 2 3 4 -> 1 comparisons For ordered and reverse ordered input we have different formula for num...
I'm trying to prove the irregularity of the following language: $$L = \{ a^mb^nb^n \mid nm \ge 3 \} $$ I tried to demonstrate that it doesn't verifies the Pumping Lemma but for all words I tried it seems to accept all of them. Any hints or suggestions?
This is what I've learned from the SHT and the sketch of its proof. I would appreciate pointing out any mistake. The intuition behind the Space Hierarchy Theorem is that "there are Turing Machines using s1 space that can perform computations not posible using s2 < s1 space" s2 < s1 means that s1 uses O(f(n)) space ...
Given the following language: $L = \{ a^ib^j \mid \lvert i - j \rvert \le 2 \} $ I am trying to prove that it is not regular. On the one hand my intuition tells me that the language is non-regular as there is no way of tracking $a^{i's}$ and $b^{j's}$. However, when I try to prove that it is irregular using the pumping...
I know that $\mathsf{P}$ class is only defined for decision problems. Therefore, a problem like "Does there exist an $(s,t)$ path of length $k$ in the graph $G$?" is in $\mathsf{P}$. One can first find the shortest path from $s$ to $t$ in polynomial time and check if it is smaller than $k$ or not. Now, consider the opt...
I'm trying to find a CFG for the following language: $L = \{ a^ib^j \mid \lvert i - j \rvert \le 2 \} $ What I thought about unsuccessfully is the following: $S \rightarrow SASBS \mid SBSAS \mid \epsilon$ $A \rightarrow a \mid aa \mid aaa $ $B \rightarrow b \mid bb \mid bbb $ Which has the following problems: (1) It do...
Using the Fitch application and only Intro and Elim rules (& REIT if necessary), prove that $$\forall x \forall y (P(x) \implies Q(y)) \iff (\exists x P(x) \implies \forall y Q(y))$$ is a logical truth (i.e. prove it from no premises) I am attaching a screenshot of my work so far, please give me feedback and/or assista...
I have a cake with $n$ layers in total. I know that $k$ are vanilla, and at least $n-k$ are not. I dislike all flavors other than vanilla, so I decide to only eat those layers. I can't tell which layer is which flavor, but I can smell the vanilla. For any $m$ with $1\le m\le n$, I can test the top $m$ layers of the ca...
How do we define the term computation / computable function generically across models of computation? Beginning with the textbook definitions of: {Linz, Sipser and Kozen} for "computable function". A function f with domain f is said to be Turing-computable of just computable if there exists some Turing machine M = (Q, ...
Is there an upper bound of the number of induced subgraphs in a tree (i.e., connected acyclic undirected graph)? The bound can be expressed in terms of vertices, edges, etc. For example, consider the following graph $G$ represented as edge list: $\{(S,T),(T,G),(T,B),(B,H),(H,Q)\}$. The number of connected subgraph (i.e...
I have a directed graph $G=(V,E)$ where each vertex is a 4-D coordinate $v: (x, y, z, c)$ representing spatial coordinates $x, y, z \in \mathbb{R}$ and the non-physical parameter colour $c \in (c_{1}, c_{2},... c_{n})$. The edge weights $\omega_{v_{a} \to v_{b}}: f(x, y, z)$ are purely a function of three of the four d...
Construct a pushdown automaton that accepts $$\{a^ib^jc^k \mid (i+j)\bmod 3 = 0, k = i + j\}$$
I'm trying to prove that the following languague is a regular language: $L=\{ w \mid \lvert w \rvert$ is prime $\}$* What I have thought is to divide each word $w \in L$ into subwords of length 2 if the word is even and and if the word is odd end with a suffix of length 3, in this way I would get the following regular ...
I am currently reading a paper on a meta-heuristic called 'Grasshopper Optimization Algorithm'. The main idea of the algorithm is to utilize the social behavior of grasshoppers in a swarm to solve optimization problems. The distance to other grasshoppers in the swarm is used to determine, if a grashopper is repelled (e...
I'm making simulations like Ant colony simulation, boids, and cellular automata in Go (to learn Go), but I believe this can apply to most languages. From what I've read (this), using 1D arrays is generally better, but the post only addresses CPU processing. I want to do my simulations with the GPU and that may have som...
I know this could be a strange question. But was there any algorithm ever found to compute an NP-problem, whether it be hard or complete, in polynomial time. I know this dabbles into the "does P=NP" problem, but I was wondering whether there were any particular instances when people were close to it. I've also heard ab...
I need to cluster $N$ data points. I don't know the number of clusters to be formed. It needs to be found optimally. Also, there is maximum and minimum cluster size constraints, where $C_{\max}$ is the maximum size that one cluster can get and $C_{\min}$ is the minimum size that one cluster must get. The coordinates of...
Please look at this grammar: $$ → \ | \ \ | \ \\ → \ | \ \ | \ \\ → \ | \ d$$ I eliminated B from the grammar and it converted to: $$ S → SAAS \ | SAd \ | \ Ab | \ b \\ A → SAS \ | \ Sd \ | \ a \ | ASS \ | dS $$ But I can't eliminate loop recursion between A and S.Was it a good solution I removed the B...
I am studying computational complexity using Papadimitrious's book: "Computational Complexity". I am trying to solve Problem 9.5.14, about polynomially equivalent minimization-maximization problems in weighted graphs: Consider the following pairs of minimization-maximization problems in weighted graphs: (a) - MINIMUM ...
Given a time-series of data collected from a single running process that takes 8 hours to complete: Minute GB of Disk Space Used 0 0 1 8 2 15 3 22 ...Etc. It is sampled every minute, for 8 hours. The # of GB used jumps up and down a lot, and ends back at 0, like a big spiky mountain shape. I'm ma...
I'm a bit confused as to how they relate to each other. I think I understand them individually but not sure how they would relate.
I'm doing some work with static analysis and need to represent local variables as SMT formulas. In general this is fairly straight forward, depending on the domain of the static analysis. However, my question lies when needing to represent impossible or infeasible values, e.g., divide by zero paths from the static an...
I'd like to create some program that can keep spitting out verification algorithms. My verification algorithms take two inputs: problem instance, and solution (both encoded in binary), and output True or False. Every verification algorithm my program returns needs to satisfy the following criteria: It terminates in po...
I am currently dealing with a problem that I believe to be a network flow related problem, and I am trying to find some similar solved problems to help me formulate my solution. I want to make it clear that I am not searching for a solution here, but asking a community of more experienced individuals if they have exper...
Complement of equality problem of Turing machines is unrecognizable or not-recognizable but How? As per my knowledge it is recognizable if you can decide its accept condition but not reject condition and the opposite is the case with unrecognizable. But in complement-Eq problem of TM if a string/input accepted by one b...
A company has some workers who need to perfrom some jobs. Each job requires workers of a combination of departments and seniority. Departments : HR, Legal, Product, Development Seniority : Junior, Mid Level, Senior For example, a job might have the following minimum requirements. Job1: Total Workers - 8 Atleast 2 work...
I know that the offset is based off of the line size for a cache. I have seen the example: "32-btye line size would use the last 5-bits (i.e. $2^5$) off the address as the offset into the line" but I do not understand the process used to determine this.
A crown in a graph $G$ is a pair $(H, C)$, where $H \subseteq V(G)$ and $C \subseteq V(G)$ with $H ∩ C = ∅$ such that the following conditions hold: (a) The set of neighbors of vertices in $C$ is precisely $H$, i.e. $H = N(C)$, (b) $C = C_m \cup C_u$ is an independent set, and (c) There is a perfect matching between $C...
Let $A$ be an array of n elements. We know that $n - \lfloor \sqrt n \rfloor$ elements are integers in range $\sqrt n$ to $n\sqrt n$ (the other $\lfloor \sqrt n \rfloor$ elements may or may not be in the range). I need to sort the array in $\Theta (n)$. I thought of partitioning the array to 3 subarray: elements small...
Suppose I want to deploy the algorithm for finding connected components in a graph $k$ many times. Now the time complexity for finding connected components in an undirected graph is $O(v+e)$. Then what will be the time complexity, $O(k(v+e))$ or $O(ke)$? Similarly, I have deployed a method $k$ times which requires $O(n...
I need to design an algorithm that given a string $T$ of length $n$, performs $O(n)$ preprocessing, and can then answer queries of the sort "does a string $P$ of length $m$ appear in $T$ before position $k$" in time $O(m)$. The algorithm should use a suffix tree. Unfortunately there are not any good bioinformatics book...
I'm familiar with binary search, but I'm interested in when a collection of numbers can be searched faster than checking them all one by one with any algorithm. Binary search requires sorting to work, which means some knowledge of the structure of the collection, but maybe there is something else.
So using K-maps I was able to simplify xy + (!x)z + yz to xy + (!x)z, and I double-checked that the truth tables are the same. I'm having trouble understanding how I would have used boolean algebra to get this result. I tried my usual tricks of adding zero, letting addition distribute over multiplication, etc., without...
Let $A$ be an array of $n$ integers containing the numbers $\{1, 2, \dots , n\}$ in some arbitrary order. For integers $i$ and $j$ such that $1 ≤ i < j ≤ n$, let $\mathrm{Reverse}(A, i, j)$ be a procedure that reverses the subarray $A[i], A[i + 1], \dots , A[j]$ of the array $A$ while leaving the remaining elements of...
What I need to do is go from a binary image like this: to a segmented structure like this: because I have a program that operates on those separated line contours after. As you see, those contours are not perfect, they might be slightly bent but where they meet it's always pretty much orthogonal, there are no 45 degr...
The algorithmic problem is as follows. The input is the source code of a program accepting an integer as input and outputting a finite binary sequence. This program defines a recursively enumerable formal language. The output is a formal grammar generating this language. How can we solve this problem?
I have a search problem that requires me to find a path from $v_s$ to $v_g$ in the graph $G = (V, E)$ where $v_s, v_g \in V$ are the start and goal vertices in a set of vertices and $E \subset V \times V$ is an undirected set of edges connecting vertices. Both $V$ and $E$ can be infinite. Each edge has an associated co...
Got a problem I'm not sure how to approach. I'm being given a string of text with indeterminate length, around typical "body text" size. The text is a solid color, and the background can be a solid OR a gradient of one or more colors of varying luminance. The goal is to make the text readable across the entire backgrou...
I cannot seem to find an example of an NFA and Turing Machine that both accept the same languages. I am trying to understand how to convert an NFA to its equivalent Turing Machine and I think a simple example would help a lot!
I have an array, [23,12,11,0,5,2,7,8,15,14]. I choose the rightmost element (14) as the pivot and set lo = 23 and hi = 15. Then since lo = 23 > pivot = 14, I don't change the position of lo. However for hi = 15 it is > pivot = 14, so I move one step to the left, which results in hi = 8. Since hi = 8 is < pivot = 14, I ...
How to solve the max contiguous subarray problem, where we have an addition parameter $M$, and the contiguous subarray must include both $A[M]$ and $A[M-1]$? For example, for the zero-indexed array $1, -4, 2, -2, 4, 1, -1, 1$, if $M=1$ then the contiguous subarray must include the first two elements, and so the answer ...
An interesting advantage of bloom filters over hash tables, that they share with bitarrays, is that they support taking unions & intersections of sets by simply doing bitwise or & bitwise and respectively. The union of two bloom filters is the same as the bloom filter generated by the union of the sets, while the inter...
I am trying to sort an array that I know to have a constant number of unsorted elements (elements that are not in their right place). In the solution I looked at they say you can do this in $O(n)$ time: you can find any unsorted element in $O(n)$ and then move it to the right place in $O(n)$ also. I am not seeing how y...
What is the asymptotic rate of growth of the following recurrence relation? $$ f(x) = \begin{cases} 8f(x/2) + Θ(1) & \text{ if } x^2 > M, \\ M & \text{ if } x^2 \leq M. \end{cases} $$ Here $M$ is a constant. I'm not sure how to do it with the condition on $x^2$.
The following theorem is cited in Balcan, M.F., Sandholm, T. and Vitercik, E., 2019. Estimating approximate incentive compatibility which I am currently reading and it is referenced to David Pollard. Convergence of Stochastic Processes. Springer, 1984. However, I have trouble finding the proof. Anyone knows a reference...
So far I've understood that because of the definition of $\Theta$, we have $c_1n^2 \le f(n) \le c_2n^2$. I'm not sure how to proceed from there.
I have a sequence of bytes: https://drive.google.com/file/d/17sfchPgsySi2ilIxLuBb1q-UUqq5lO87 What the data is, is unknown (see NOTE below). I'm pretty sure this data is compressed in some way, due to the ent analysis results: $ ent first-chunk Entropy = 7.997831 bits per byte. Optimum compression would reduce the si...
I'm working on a mini lisp and now I'm wonder about scopes. For my case I'll have this constructs that introduce scopes. lambdas introduce it's arguments let binds and modules The way I worked on this was, a single scope is an associate array, and all scopes are stacked from inner to out. Also I have a global scope t...
Task Consider the following recursively-defined tree structure: const tree = { val: 1, children: [ {val: 2}, { val: 3, children: [ { val: 4, children: [ {val: 5}, {val: 6}, {val: 7} ] } ] } ] }; Here, ...
I'm playing around with C++ and was looking at how to loop through an array of unknown length. The following code was suggested and works perfectly from the little testing I've done: std::string words[5] = {"Lorem ipsum dolor sit amet orci aliquam.", "Hi", "Welcome", "World", "LoopyDoopyDoo"}; for (int i = 0; i < sizeo...
Are there any examples of CNF formulas that are tautologies? Such that every clause contains different variables so phrases like (a or not a) are rejected?
In this set of notes it is claimed that: If there exists a polynomial-time pseudorandom generator $G:\{0,1\}^{O(\log n)}\to\{0,1\}^{O(n)}$ that $1/10$-fools all $n^2$-size circuits, then $\mathbf P=\mathbf{BPP}$. The proof of this is as follows: If a language $L$ is in $\mathbf{BPP}$, then there is a polynomial-time ...
Suppose we have a hallway environment, i.e, $N$ nodes from left to right, and we can either move left or right. Moving left at the leftmost node does nothing and reaching the right most node gives you a $+1$ reward and terminates the game. But every other action has $0$ cost or reward. I'm curious to know how reinforce...
Is the halting problem decidable for TMs that do not write to the tape? Once a read only tape TM repeats a configuration, it will loop forever. Therefore, all we have to do to decide the above is construct a different TM(with read and write tape) that’s takes the read only TM as input and checks for a repeat configurat...