instruction
stringlengths
35
29.1k
In wiki, PTM are defined with two transition functions and a fair coin toss which determines which one is used at each step. One can also define them, much like NDTM, using a transition relation where in each step the machine chooses from its next possible configurations using a fair probabilistic choice. My question i...
I want to form data structure for nearby neighbor search for 3D coordinates. What is the best way to do so?
Given that both $P \subset \mathit{NP}\ ?$ and $P^{\mathit{NP}} \subset \mathit{NP}^{\mathit{NP}}\ ?$ are open questions. Is it possible that $P \subset \mathit{NP}$ and $P^{\mathit{NP}} =\mathit{NP}^{\mathit{NP}}$? Or is it the case that $P \subset \mathit{NP}$ iff $P^{\mathit{NP}} \subset \mathit{NP}^{\mathit{NP}}$?
n people named i are invited to a party. They are a(i) years old. We want to position them on some tables by obeying the following criteria: Each guest must sit around a table. Each table should have at least 3 guests around. The sum of age of each two adjacent guests around a table should be a prime number. We need ...
Considering the recent question "Is there an algorithm whose time complexity is between polynomial time and exponential time?", some commenters observed that merely providing a function with growth strictly between polynomial and exponential answers the question, because it is easy to construct an algorithm with the re...
Trying to understand 3-SAT self-subsuming process I've been studying solver theory and am trying to understand some of the basic concepts that I've been reading. In particular, the idea of self-subsuming (if I have the correct terminology here) is confusing me. It appears that it's possible to come to different conclus...
I'm going through Algorithm Design Manual and it didn't take long before I hit a proof I don't understand. Can anyone point me in the right direction? From the book: Problem: Prove that $\sum_{i=1}^n i * i! = (n + 1)! - 1$ by induction. Solution: The inductive paradigm is straightforward. First verify the basis case (...
There is the axiom you should always prefer tail-recursion over regular recursion whenever possible. (I'm not considering tabulation as an alternative in this question). I understand the idea by why is that the case? Is it only because of the compiler can optimize the recursive call in case of tail recursion? if that i...
The Rabin–Karp algorithm uses a rolling hash function to find a substring matching a pattern: $$ H = c_1a^{k-1} + c_2 a^{k-2} + c_3 a^{k-3} + \cdots + c_k a^0, $$ where $a$ is a constant, $c_1\ldots c_k$ are the input characters, and $k$ is the number of characters there are in the pattern we are trying to find in the ...
A linear bounded automaton (LBA) is a restricted TM with finite tape. Let $A_{LBA} = \{\langle M, w \rangle | M$ is an LBA that accepts string $w \}$. It can be shown that $A_{LBA}$ is decidable: since an LBA has only finite number of configurations, therefore an LBA does not halt iff it cycles. A cycling in the comput...
Let $G = (V,E)$ be a directed graph with source $s$ and sink $t$ and $s \neq t$. For each edge $e \in E$, we have $c(e) \in \Bbb N$. After running Ford-Fulkerson algorithm a flow function $f$ returned a max flow. Let $R_f$ be the residual network that represents the max-flow $f$. I would like to prove that if $R_f$ has...
Recently, I find that automata theory is very useful in computer science, it is used in many fields, such as computer network, digital design, computer architecture and operating system, even we can construct KMP algorithm using the theory of automata. I really wonder if there are any books or articles summing up thes...
I'm trying to understand this paper and in Figure 1 page 389 there's a projection in the form of $\pi_{d.id : s.id}$. What does the colon mean? Because usually projections are simply $\pi_{name}(R)$
If $\sf{P} \ne \sf{NP}$ and $\sf{NP} \ne \sf{coNP}$ are both true then $\sf{P}$, $\sf{NP}$ and $\sf{coNP}$ are three separate complexity classes. In other words, verifying a solution, finding a solution and proving there is no solution to a formula are three separate tasks. However, if $\sf{P} \ne \sf{NP}$ then both $\...
In-place Acceptance Problem (InAP) Instance: A deterministic Turing Machine M and a w input for it. Question: Does M accept the input w without going through cell (|w|+1)? Show that InAP is PSPACE-complete. I am having problems in finding information about InAP and I have no idea how I can show that it is PSPACE-comp...
Recently, I was having a debate with a friend about what it would mean to create a machine that ZKSnarks (proves) itself. I tossed the word pure machine out there while describing what I hypothesized would be the manner of state transition for such a machine, alluding to the notion of a pure function. I didn't really k...
I try to understand algorithm from this Wikipedia article. Initially it is talking about some function f. I specifically getting problem in that part. Below is the paragraph which is quite mathematical. Can anyone explain me that? For any function $f$ that maps a finite set $S$ to itself, and any initial value $x_0$ i...
Assuming (the unlikely scenario) that the Polynomial Hierarchy collapses to second level. Thus, $\Sigma_2^p=PSPACE$. How significant this result would be (broad consensus) as compared to the other open problems in TCS (the most important two being $P$ vs $NP$ and $NP$ vs $coNP$). Most of the sources rightly point to th...
I watched a video on why the RSA algorithm works and it said that $(M^e \bmod N)^d \mod N = M^{ed} \bmod N$ which makes sense if $M^e$ is smaller than $N$. Would $M^e$ not be smaller than $N$, the decryption wouldn't work(I know why but there's no reason to explain it here). So why do we say that the ciphertext is $M^e...
Generalized chess is EXPTIME complete[1]. Generalized chess is also PSPACE complete[2]. Therefore $EXPTIME = PSPACE$. This implies that $P \neq PSPACE$ This proof is probably wrong. I want to know what I did wrong. They are probably referring to different problems regarding chess. But here are my sources. I can't say i...
Consider g a function of n: $g(n)$. Knowing that the function $f(n) \in Θ(g(n))$ and the function $h(n) \notin O(g(n))$, could we conclude anything, related to it's asymptotic behaviour, about $f(n) + h(n)$ with respect to $g(n)$? Given that $f(n)$ is $Θ(g(n))$, I have that $f(n)$ grows the same way as $g(n)$. Given th...
I was looking at the wikipedia page for the Travelling Salesman Problem and found a reference to another exact algorithm besides Held-Karp that's also $O(2^nn^2)$. Specifically: "This bound has also been reached by Exclusion-Inclusion in an attempt preceding the dynamic programming approach." Can you explain how that a...
Consider a circuit belonging to the class $\text{NC}^i$, as defined here. From my understanding, the circuit consists of AND, OR ar NOT gates, each of bounded fan in --- without loss of generality, let the fan in be $2$ --- with $\log^{i} n$ depth and polynomial size. Now, let's say we define a different circuit class,...
I need to compute the time and space complexity in Big O notation for this algorithm I constructed for binary multiplication. mul(a, b) = - 0 if a = 0 or b = 0 - (b + p) if lowest(a) != 0 - p if lowest(a) = 0 where p = join(mul(higher(a), b), 0) lowest(a) returns the lowest order bit of a binary numeral a e.g...
A binary decision tree (DT) is a binary tree whose internal nodes are labelled by boolean variables (with repetitions), and whose leaves are labelled either $0$ or $1$. The size of a decision tree is the number of branches (or equivalently the number of leaves). A DT determines a unique Boolean function of the variable...
Consider simple tabulation algorithm firstly for Fibonacci numbers. We will use the dictionary as a cache (and Python as example PL): def fib_tab(n): tab_dict = {1: 1, 2: 1} for ind in range(3, n + 1): tab_dict[ind] = tab_dict[ind - 1] + tab_dict[ind - 2] return tab_dict[n] Notice that for n < 1 fi...
Given is the modified definition of a TM where everything is equal except for one change: $\Gamma=\Sigma\cup \mathbb{N}\cup\{\square\}$ How do I prove that there is a TM $M$ for any language $L\subseteq\Sigma^*$ while $\Sigma=\{a,b\}$ and $\Sigma\cap\mathbb{N}=\emptyset$ so that $T(M)=L$?
It is seldom considered that floating points are not evenly distributed in the real number line. I've been working with interval arithmetic and noticed when bisecting $[a,b]$ on the real number line into $[a,(a+b)/2]$ and $[(a+b)/2,b]$ starting from $[-1.3552646593344489*10^{308} ,0]$ until $a,b$ are neighboring floats...
Git seems to use the two most significant hex digits of a content hash as a directory name for content-addressable objects. The same two digits are left out of normal file names. I'm assuming the intent is to limit the size of directory listings, while maintaining a relationship between names and content. objects ├── 0...
Finding a loop in a linked list is a classic algorithm but I found an off-by one case that is making me question my sanity, this first solution works: def findLoop(head): def p(s, f): print(f'slow: {s.value}, fast: {f.value}') slow = head.next fast = head.next.next while slow is no...
Imagine you loop n times, and every iteration you create a string of space n with scope only within that iteration (thus it is no longer accessible in the next iteration). I would look and say that I use O(n^2) space because, for n iterations, I use n space. However, logically, if every loop you destroy the previous it...
Given two unrelated languages $L_0$ and $L_1$ contained in some complexity class $C$. Is the language $L_x=L_0\times L_1= \{(x,y)|x\in L_0, y\in L_1\}$ always contained in $C$? And if that is the case, can we just extend this recursively and create a single language $(L_{All})$ from all other languages contained in $C$...
Most computation theory textbooks just mention the equivalence of PDAs and Context Free Grammars. I'm able to construct a PDA from a given CFG, but find it very difficult to write an algo to check if a PDA accepts a string or not. Some would recommend the CYK algorithm, but that's for a CFG in CNF, not for a PDA. If th...
Is there a programming language with named return values? I imagine something like in the following (syntax to be workshopped): def f(a, b): export c = a * b d = 3*c export e = c + d and then from f(4, b=5) import * print(c, e) This would obviate the need to repeat variable names (now done by defining out...
Problem statement: You are in a 2D grid where you can move in any of the 4 directions, no obstacles. You start at position (0, 0). We say that you partially cover a point $(x,y)$ if your position has the same abscissa or the same ordinate (or both). You are given an ordered sequence of n points $(x_1,y_1), ..., (x_n,y_...
I'm trying to understand what is necessary to guarantee that a problem has a greedy algorithm that always produces optimal solutions. In multiple places I find that a greedy algorithm can be constructed to find the optimal solution if the problem has two properties: Optimal substructure Greedy choice There is one thi...
Given a directed weighted graph $G = (V, E, w)$, we refer to the max flow when $x$ is the source and $y$ is the sink in the flow network of the graph $G$ as $f_{x,y}$. I'm searching for a formal proof for the following inequality: $$f_{a,c} \ge \min (f_{a,b},\,f_{b,c}).$$ I'm pretty sure that the proof relies on the ma...
I discovered this issue last night & can't make sense of it. Numerical biases programming sounds ridiculous but the code is the same, only changing the denominator from 4 to 5 and changing the corresponding values and outputs. Why does the 4 denominator work but the 5 doesn't? #include using namespace std; double main...
I have a question regarding the theory behing solving Lasso's optimization problem via ADMM. Let's look at this pdf https://candes.su.domains/teaching/math301/Lectures/Consensus.pdf. First rewrite the problem (26.1) as (26.2), by adding the variable $z$, this is clear. What is $y$ in the augmented Lagrangian (just one ...
I'm a mathematician and the following came up in my research: Fix some positive integers $a_0,...,a_n$ and $N$. Consider subsets $A_i \subset \{0,...,N\}$ where $|A_i|=a_i$, subject to some fixed conditions of the form: $A_{i_0}=A_{j_0}\sqcup A_{j_1}\sqcup ... \sqcup A_{j_t}$. (See an example below). I want to code an...
The question is quite short. Let $k$ be a given number. What is the maximal length of $k$-CNF formulae can we compute, over the set of binary variables $\left\{ x_1 ,\ldots, x_n \right\}$? The way I see it, if we ignore the $k$ for a minute, we have $2^n$ different binary sequences, each sequence is a $1-1$ representat...
The fastest algorithm I could find that finds the chromatic number of an undirected simple graph exactly in only polynomial-space is "Faster Graph Coloring in Polynomial Space" by Gaspers and Lee (DOI: 10.1007/978-3-319-62389-4_31). It's running time is $O(2.2356^n)$. However that's from 2016/2017, so I'm wondering whe...
For my programming project I need to implement a local search algorithm. The generic local search algorithm is easy to understand but the thing I am most struggling with is how to deal with the neighbourhood. It seems that when you implement such an algorithm, you don't explicitly state the neighbourhood but you declar...
Recently I came upon the Johnson's algorithm to find "elementary circuits" on a directed graph, which is really cool to me. I'm just implementing it from scratch in C++ following the original Johnson's paper I have a couple of doubts before going on. In the paper it's clear to me what $A_k$ about adjacency, but in the ...
Let $m$ and $n$ be two integers, where $m \leq n$. Suppose you are given $m^2$ matrices $W^{i,j} \in \mathbb{R}^{n \times n}$ for $i, j \in \{1, \dots, m\}$. The goal is to find a sequence $a$ of $m$ integers $a_i \in \{1, \dots, n\}$ minimizing $$ \min_a \sum_{i=1}^m \sum_{j=1}^m W^{i,j}_{a_i, a_j} $$ Does this proble...
Not problems like chess. I'm thinking problems that would be very useful to be able to solve in sub-exponential time. These would be problems not known to be EXPTIME complete. Edit I mean problems that are not known to be in NP and assuming $NP \neq EXP$, Problems that are thought in EXP but there could hypothetically ...
I am trying to describe the above automaton in English. The pattern that I can see is that it accepts any input that starts with $1$ or $0$ with an exact one occurrence of $00$ and ends with 1 or 10. How can I also phrase that it also may end with 00?
The following question is from the MIT 6.034 2006 Final Exam paper. In answering part 6.5, I wasn't certain why the radial basis kernel would produce the same decision boundary as a linear kernel (when considering the data set shown in part 6.4). I've searched the internet for some pointers, but no dice. I was wonderin...
Given $R$=($A,B,C,D,E,G$), And $F_c$={$A$$\rightarrow$$E$ ,$E$$\rightarrow$$ACD$ ,$BD$$\rightarrow$$E$, $CD$$\rightarrow$$B$} Candidate keys are: $GA, GE, GDB, GCD$ Lets say I pick the FD $A$$\rightarrow$$E$ that violates BCNF (1) should the decomposition looks like that: $R_2$=$(A,G)$, $R_1$=$(A,E,C,D,B)$ // [$R_1$...
I'm trying to solve this but I'm confused with different answers. I'm getting 4 but the answer written is 7. Please guide me.
I'm implementing the toy fb-lang from the principles of programming language book. It's a small interpreted language that uses eval(uate) expression function and sub(stitute) variable with value function to process expressions. The most challenging construct is the let rec in construct which makes it possible to define...
I remember in high school we did this thing where we were given a bunch of numbers in a row that had a pattern. We were asked to work out what the next number in the pattern would be. It was very easy stuff and they taught as a formula that i can't remember. Basically the patterns looked like this: 2 4 6 8 _ They form...
Suppose I have a graph's chromatic number. Give a faster-than-brute-force polynomial-space algorithm for finding an optimal coloring. If such an algorithm isn't known, please tell me so. This question is not a duplicate, contrary to what the title may suggest: Using the chromatic number to compute an optimal coloring T...
I would want to start learning reverse engineering (Software and Hardware Projects), but I don't know from where to start. Will be grateful for online resources and/or books. Thanks.
How can I efficiently find all lattice points in the cubic lattice $Z^3$ (that is to say, all integer points in a 3-space) that lay in a closed ball of radius $R$ centred at the origin? Essentially, Let $dist(p)$ be a function denoting the euclidean distance between a point in n-space and the origin point of that space...
These would be problems known to be in exp where there could hypothetically be a P or NP algorithm, but none have been discovered yet if one is possible.
In one of my undergrad theory or algorithms classes, I remember a professor sharing a quip that went something like In practice, $\log(\log(N))$ is at most 9. ...the idea being that even though the function $f(N) = \log(\log(N))$ technically grows without bound, it's tiny for any value of $N$ that's remotely plausibl...
I have two images of two objects that are suppose to be exactly the same. I use one for reference and one as my model. I want to find an algorithm that will help me find on which areas these images vary? and return a binary map (the size of the image), that indicates of the variation. Its an easy task when we don't tak...
What are the time complexities of finding kth element from beginning and kth element from end in a doubly linked list? Assume n > k, where k is a constant and n is a total number of nodes in the linked list. O(1) and O(n) O(1) and O(1) O(n) and O(1) O(n) and O(n)
We're Given a directed graph $G = (V, E)$ and a weight function $\omega : E \rightarrow \mathbb{Z}$. Each edge is colored with one of these colors: Red, Green, Blue. Given two vertices $s,t \in V$, Find an efficient algorithm that gives the weight of the lightest path from $s$ to $t$ that satisfies these conditions: I...
We say that a non-deterministic Turing machine is nice if for every input x the following holds: • Every computation path returns either ’accept’, ’reject’ or ’quit’. • There is at least one non-quit path. • All non-quit paths have the same value. Let NICE be the class of all languages L that are accepted by some nice ...
The following question is taken from the book titled "Probability models for Computer Science" written by Sheldon M. Ross. Question: A particle moves along n + 1 vertices that are situated on a circle in the following manner. At each stage the particle moves one step that is either in the clockwise direction with prob...
I am trying to understand if NL is closed under complement or not. By NL i mean the non-deterministic-logspace complexity. I suppose that the answer is linked to the fact that we don't even know if L = NL so scientifically speaking we cannot determinate if NL is closed or not on complement, for now. I've searched on th...
Given a directed tree $T = (V, E)$, we need to find a set of vertices $A \subseteq V$ such that for every two vertices $v,u \in A$ either there is no path between them or the path between them is of length at least 3. Furthermore, $A$ should contain the maximum number of vertices. The above is an exercise in my homewor...
As I am currently teaching regular languages and pumping lemma, I was searching for nice examples of languages, regular or not, for exercises. $L_1 = \{vv\mid v\in \Sigma^*\}$ is a classic example, as it can be proven to be non regular for $|\Sigma|\geqslant 2$ using the pumping lemma; $L_2 = \{ uvv\mid u,v\in\Sigma^*...
Let's just say that some person discovered that $P = NP$ implies $P \neq NP$ and $P \neq NP$ implies $P = NP$, and we don't know what is causing this contradiction, And this was a valid proof that was accepted. What would the consequences of this be? This would probably be the least likely outcome of the P vs NP questi...
Problem statement There is a number of towns $\{T_1 \dots T_n\}$, a number of items $\{I_1 \dots I_n\}$ and a number of lorries $\{L_1 \dots L_n\}$. Each town $T_n$ has a market which offers a quantity $Q_{i}$ of items $\{I_{m < n}\}$ for buying (always a subset of $I_n$), but any item $I_n$ can be sold there at the ...
Question The convolution $a*b=\left(c_{0},c_{1},\ldots,c_{n+m-2}\right)$ of two vectors $\left(a_{0},\ldots,a_{n-1}\right)$ and $\left(b_{0},\ldots,b_{m-1}\right)$ is defined as follows: $$ \left(a*b\right)_{i}=c_{i}=\sum_{j=0}^{i}a_{j}b_{i-j} $$ Given that by using the $FFT$ algorithm the convolution can be calculated...
I was trying to solve a problem "Write a function bestSum(targetSum, numbers)` that takes in a targetSum and an array of numbers as arguments. The function should return an array containing the shortest combination of numbers that add up to exactly the targetSum." import java.util.ArrayList; import java.util.HashMap; ...
Let $x_1,x_2,x_3,\dots,x_n$ be n points on the unit segment $[0,1]$.Mathematically it can be shown that there always exists a point $\in[0,1]$ such that $$ \frac1n \sum_1^n|x-x_i|=\frac12$$. Given $x_1,x_2,x_3,\dots,x_n$, how do we find(numerically) $x$ satisfying the above relation to given level of accuracy?In othe...
Take, for example: $$S=\{1,2,3\}\to k=3$$ $$n=4$$ The desired output for this would be: [1 1 2 3] [1 1 3 2] [1 2 1 3] [1 2 2 3] [1 2 3 1] [1 2 3 2] [1 2 3 3] [1 3 1 2] [1 3 2 1] [1 3 2 2] [1 3 2 3] [1 3 3 2] [2 1 1 3] [2 1 2 3] [2 1 3 1] [2 1 3 2] [2 1 3 3] [2 2 1 3] [2 2 3 1] [2 3 1 1] [2 3 1 2] [2 3 1 3] [2 3 2 1] [2...
I got a two points A and B with their respective x and y coordinates. Point B determines the direction of the vector AB, and I know that -10^9 <= x,y <= 10^9. My goal is to scale that vector until the x or y coordinate of B hit either bound. Basically I need the vector AB, where B is moved to the edge without changing ...
I have following inputs: $X$, where each $x_j$ is float and $1 \le j \le n$ $Y$, where each $y_j$ is int and $1 \le j \le n$ $a$ is a float scalar I want to allocate/split $a$ in $n$ parts towards each $x_j$ in $X$ where $1 \le j \le n$. The allocation from $a$ should be proportional to both $X$ and $Y$ (see example ...
It is my belief that addition in one's complement is done the same way as unsigned addition except that if there is a carry out in the most significant bit then that carry is added to the last significant bit of the answer. If I am wrong about this, please tell me. I am going to work in 4 bits. My claim is that $-1$ is...
I am trying to build a min-max heap tree, here's an example of the tree structure: The tree is a complete binary tree The index in the array of the tree root is 0 and it contains no element. The left subtree is a min-heap and the right subtree is a max-heap. When I am trying to implement the insertion, I meet a prob...
I recently studied about this construction of a spanning graph for a set of points in $\mathbb{R}^2$ and I feel like I'm not really understanding why this construction should work. First there are some required definitions: Two sets $A,B$ are said to be well seperated w.r.t to $s>0$, if there exists some $r\in \mathbb...
Here is a very bad algorithm that computes $4n$ for an integer input. # Original algorithm function fourtimes(n) two = 1 + 1 res = 0 for i in 1:n res += two res += two end return res end Here is one way of improving the algorithm (speedup A). # Speedup A function fourtimes(n) ...
How to multiply in CBN strategy? mul = \m.\n.\f. m(n f) two = \f.\x. f (f x) mul two two = (\m.\n.\f. m(n f)) (\f.\x. f (f x)) (\f.\x. f (f x)) = = \f. (\f0.\x0. f0 (f0 x0)) ((\f1.\x1. f1 (f1 x1)) f) As I understand, after that, calculations in the CBN strategy stop, because in CBN no reduce under abstractions. is i...
The optimization variant of TSP is NP-hard, hence, finding an optimal tour takes $2^n$ steps for $n$ cities. According to Wikipedia, the largest instance solved so far consists of $n=85,900$ cities and that it only took 1.5 years in 2006 to solve it. How can that be? In complexity text books, it usually motivates the t...
The problem of Orthogonality: gives $n$ vectors of dimension $k$ and another set of same, can a pair be found with inner product = $0$? The problem of max product: likewise two sets each $n$ vectors (I forgot to mention in both cases values are binary). We want to find maximal inner product (one vector from set $A$ and...
Suppose given $n$ pair of points $P=\{(p_1,q_1),\dots,(p_n,q_n)\}$ in the plane that each pair $(p_i,q_i)\in \mathbb{R}^2$ can't belong to the same group. We want to partition points into $K$ groups such that we minimize function $f:x\rightarrow \mathbb{R}$. So we try to find an efficient algorithm. We want a running t...
I'm confused about the figures in a Berkeley tutorial on Fibonacci trees, which depicts fibtree(2) as and fibtree(3) as I thought fibtree(3) looks like the following (the figure is adapted from another StackOverflow post). Do I misunderstand something? Or is the Berkeley tutorial misusing the figures?
I'm looking for a way to help my users more easily compare the output of a fingerprinting algorithm (which is a very large number/byte array). So instead of showing something like "8c0db1f40b6e4c1e268a5f3e2405278f" as the fingerprint, I'd rather show something like 'AT-BAD-HONEY-CAR-MOUSE' (obviously the underlying num...
What are common primary mechanisms to "re-map" between physical memory in RAM, and the addresses used in a program before it is loaded into RAM? In image below for example, the LOAD 12 operation at address 01, must when program is running be loading the address 12 addresses from the "0 address" of the program (that in ...
Suppose I have a directed graph, where one of the nodes is selected to be the "initial" node. What algorithms should I consider using to to find all the nodes that have a path from the initial node to itself have a path from itself to the initial node For example, in the below graph with node A as the initial node,...
From Introduction to Algorithms by CLRS: 15.2-4 Describe the subproblem graph for matrix-chain multiplication with an input chain of length n. How many vertices does it have? How many edges does it have, and which edges are they? I've figured out everything except for the number of edges. I've looked at several solut...
Many years ago someone told me about a historical SMP operating system (or program?) that had been all but proven to be bug free (or something close to this). But yet turned out to have bugs that were discovered as CPUs with more cores, than initially tested/developed on, came out. Can anyone provide a source of this?
I am working through "Understanding Machine Learning Theory" by Shai Shalev-Schwartz. In the chapter "Online learning" I came across the halving algorithm, the author uses the following algorithmic pseudo-code for the algorithm I am having difficulty understanding authors intention from the highlighted portion. Here $...
Consider $\Sigma = \{a,b\}$. Now $\Sigma^*$ represents the collection of all possible strings over alphabet $\Sigma = \{a,b\}$. As there exists an enumeration procedure for $\Sigma^*$, it is countably infinite. As $\Sigma^*$ consists of strings of all lengths, it also consists of strings of infinite length. Let us cons...
So I have a point cloud, of a 3D object, as an input which I received from a 3D scanner. I would like to generate a path which covers the entire object, meaning I would like to come up with a complete area coverage of the point cloud. When I say path, I mean an array of points which according to a given dimension of a ...
Consider the grammar $$S →Aa∣b$$ $$A →Ac∣Sd∣ϵ$$ Construct an equivalent grammar with no left recursion and with minimum number of production rules. $\tag {GATE-CS-1998}$ While solving this question, based on the term "minimum number of production rules", I tried as follows: First removed indirect left recursion and ...
I haven't thought about how to go about proving it or finding a counterexample (I probably don't have the right background), but it seems intuitive to me that, given some representation of a Boolean function, say sum of products, the minimal SOP expression is somehow related to the Kolmogorov Complexity of the binary s...
I want to know how I can calculate/find out which SPACE a language has, because I don't get it. I have this definition Definition: Fix a function $f: \mathbb N → \mathbb N$. We say that a language $A$ is contained in $\text{SPACE}(f(n))$ if there is a Turing Machine (TM) that decides $x\in A$ vs $x\not\in A$ based on ...
A complete binary tree is defined as a tree where each node has either 2 or 0 children. For a complete binary tree with $n$ leaves, there can be different arrangements of nodes, let's define the maximum depth of such a tree as $d$, it's clear that $d \ge \log_2n$. The quantity I'm interested in is, the sum of depth of ...
A hash map that maps keys of type $K$ into values of type $V$, is essentially equivalent to "extending" this type $K$ to also contain an Option<V> field. Implementing this in practice (apart from the bad habits of adding more fields that are irrelevant most of the time), shouldn't the "extension" of $K$ be faster in pr...
For a $\Sigma$ with characters $0,1,$#$,\sigma_1,...,\sigma_m$. I have any $M$ that is a deterministic turing machine. Fix a $n$ (natural). i look at the following graph constructed from the turing machine $M$ (and the graph denoted by $G(M)$): $V$ is all possible (binary) strings of length $n$ from characters $0,1$. S...
I apologize in advance, as I don't have a clue to which stackexchange to post this question! I beg you to not delete this question, as I have chronic pain and it is very important to me!!! I actually written this hours, a lot of effort went into this question... How does one determine runtime of a theoretical program?...
Show that if $L$ is CFL and $R$ is a regular language such that they both share the same input alphabet $\Sigma$, then $C = \{w \in \Sigma^*\mid xw \in L$ for some $x \in R\}$ is context free. Hi I've been struggling quite a lot with this question. There's a similar quesion already answered here (Closure of CFL agains...
I've been trying to search for a problem which I think could be similar to Subset Sum. The definition of the problem would be as follows: Given k $\in$ $\mathbb{Z}$ and S = {$s_1$,...,$s_n$} s.t. $s_i \in \mathbb{Z}$, how many subsets $S' \subseteq S$ exist s.t. $\sum S' \geq k$. I don't know if this problem has been s...
Let f(P,Q,R) be the truth-function defined as follows. f(P,Q,R)=1 if and only if Q and R have different truth-values; or P and R have the same truth-values. Choose all formulas that are in conjunctive normal form (CNF) and represent the truth-function f. (P ∨ ¬Q ∨ ¬R) ∧ (¬P ∨ Q ∨ R) (¬P ∨ Q) ∧ (¬Q ∨ R) (Q ∧ R) ∨ (¬Q ∧ ...