instruction
stringlengths
35
29.1k
How can I create a context free grammar for the language $\{p^2q^mpr^nq^{2n+m}| m,n \ge 0\}$, where $\Sigma = \{p,q,r\}$?
for every j != i in {0,....,n-1} How to interpret this for loop? I never seen this type of definition of for loop. Is it like - j=0 to n-1; j !=i ; ++j
Below is a question I was asked in an Interview What is the best case time complexity to find the height of a Binary Search Tree? I answered it explaining using the below algorithm $\mathrm{height}(v)$ if $v$ is a leaf, return 0 otherwise, return $\max(\mathrm{height}(v.\mathit{left}), \mathrm{height}(v.\mathit{right}...
The typical workflow in topological data analysis is from point cloud data to filtration to a list of bar codes corresponding to each dimension. A filtration is a sequence of simplicial complexes, each one a subset of the next; where a simplicial complex is a gluing of many simplices such that the intersection of any t...
This is a naïve and, therefore, possibly malformed question, so apologies in advance! My view is that a Turing Machine can be seen as the computational basis for procedural/imperative programming languages. Similarly, the lambda calculus is the foundation for functional programming languages. I have recently learnt tha...
We're developing a mobile application where one of it's functions is tracking user driving route. The app simply pushes GPS-coordinates to the server, which stores them into a route. Then we need to display that route gracefully on a map. There are 2 problems: Too many points to draw it all. I solve this by applying m...
How can an efficient modulus operator be implemented? Here's a naive way of defining A % B: given $(a,b) \in \mathbb{Z}$ (represented as int) while $a > b$ : $(a,b) \mapsto (a-b,b)$ return $a$ This could be very slow. E.g. $(a,b) = (10^7, 13)$. I could be subtracting 13's for a long time. One more possibility is t...
I'm currently working on implementing an algorithm to solve a real-world problem I'm encountering in a lab, but with little background in algorithms, I'm struggling to create an ideal solution. I work in a protein lab and using a mass spectrometer I can get the mass of a protein of interest. Each protein is made up of ...
Credit assignment is the process of assigning credit (or blame) to a particular move in a sequence of moves (temporal credit assignment) or to a particular node (structural credit assignment) among many nodes, for example, in a network. My question is somewhat philosophical: Does it even make sense to speak of credit a...
Since it's called a trap I consider it caused by software, so why it's called a hardware trap? And how does it work?
This may not be the right place to ask this kind of question and it also sound a bit stupid, but please help me understand better. I am not able to to see why on page 192 "which imposes another constrain x2 +3 x3<= 600" come up? With the fact that Nuit and Luxe require the same packing machinery. Please take sometimes ...
I'm asking this, because in every exercise I check if I can relate it to one of the things I know, like:$A_{TM}$, $\overline{A_{TM}}$, ${HALT_{TM}}$,$\overline{HALT_{TM}}$, $E_{TM}$, $\overline{E_{TM}}$, $ALL_{TM}$ But in many cases I can not find the connection and then get stuck with the question. For example:$$L = ...
I need to prove that the following problem is NP-complete: We have $n$ diplomats from $n$ countries and we need to seat them around a round table. We also get a list of diplomats who don't get along with each other, and we can't seat them next to each other. I thought about a reduction from the $n$-color graph problem ...
Given that I have a simplified Bison BNF grammar: %token T_EXP '^' %token T_NOT '!' %right T_NOT %right T_EXP %right T_FAC %nonassoc T_LPAREN T_RPAREN T_NUMBER %type expr %% expr: T_NOT expr # logical not, e.g. !a | expr T_EXP expr # exponent, e.g. 2 ^ 3 | expr T_NOT %prec T_FAC # factorial, e.g 3! | T_LPAREN ex...
In the picture above e is an empty string, and a is a symbol from an alphabet. Every book or professor I have heard from, says than when we make transitions in the NFA, the NFA must guess which state to go to next. In the example above, the NFA must guess whether it should go left or right. Why do they use the word gu...
I've google around and have been unsuccessful in finding a name for a data-structure consisting of a list whose elements are unique. I've seen "unique sorted lists", but I'm looking into the more general, not necessarily sorted, case. Does anyone know a name and a source for such things? --e.g., a one word name for the...
Given a graph where each edge has a capacity, is there an efficient algorithm to find the longest path in the graph which does not pass through an edge more times than its capacity? The exact problem I'm trying to solve is given a list of words, find the longest chain of words such that the last letter of the $n^{th}$ ...
We have $n$ numbers lying on a circle, where $n$ is even. We want to compute the maximum of any $n/2$ consecutive numbers (so, we should get $n$ values in total). One algorithm is to compute the maximum of every $n/2$ consecutive numbers separately. This leads to an $O(n^2)$ algorithm. Can we do better? Perhaps using ...
I am looking for a thread safe data structure where an element can be searched in $O(\log n)$, for any value, $x$, the number of elements greater than (or less than) can be estimated in $O(\log n)$, an element can be inserted in $O(\log n)$, and an element can be removed in $O(\log n)$. Can a skip list or some mo...
If $\overline{M}$ is recursively enumerable and $A$ is recursive, what could we say about $A \cap M$? I think that as we know nothin about $M$, in general case we can't determine wherther a random element $m$ belongs to $M$, so we coundn't say anything about $A \cap M$. Am I right?
I have been given the question "Is the language 010 ∪ 101 regular? Justify your answer." It is regular and as it can be accepted by an NFA (Draw NFA). Is this correct?
I remember reading about Tom Ray's Tierra and how amazing the results it obtained were. However as far as I know, the only "evolution" based computer technology we use now is ML, which is very limited in its abilities. Why haven't we used artificial evolution perhaps similar to Tierra for practical purposes? Is it too ...
Short version: What is the most space-efficient lossy dictionary (with given false positive and false negative rates)? Long version: A lossy dictionary is a data structure $D$ that encodes a set $S$ of $n$ key-value pairs $(k_i, v_i)$, assorted with a query operation. Let $K = \{k_1,\dots{},k_n\}$. The query operation ...
Context: I am looking at a modified version of the sieve of Eratosthenes. I started by generalising Eratosthenes' sieve, like so: Choose some starting "root", $n_0\in\mathbb{N}$, a sieve limit (the highest number to sieve), $l\in\mathbb{N}$, and $f:\mathbb{N}^2\to\mathbb{N}^2$ such that $\forall a,b\in\mathbb{N}:f(a,b...
I have seen attribute grammars for a small handful of tasks: Parsing simple arithmetical expressions Type checking Checking that a variable is initialized anbncn (seems to be a favorite toy example)... and that's about it. What are some practical uses of attribute grammars outside of the field of compilers? I've s...
In looking for a programming function to validate an IP address within a subnet, I had to calculate the subnet mask from a given CIDR bitmask value ie. 192.168.0.0/24, the value 24 in this example. The first step is to convert the bitmask value (24) into an unsigned 32bit integer. I found this on the internet (specifi...
I'm trying to prove $EXP \subset E^E$ (strictly). I believe I need to construct my own $A \in E^E$ and show that $A \notin EXP$, but I cannot think of a smart way of doing that. Thanks.
For the example below, I am trying to understand how Haskell type classes, type class instances, and data types relate to the concept of initial algebra. There are two Haskell data types sharing a pair of operations for equality and addition. From my, perhaps incorrect, understanding the instances, which include the da...
Consider Peterson's algorithm for mutual exclusion between two concurrent processes i and j. The program executed by process is shown below. repeat flag[i] = true; turn = j; while (P) do no-op; Enter critical section, perform actions, then exit critical section Flag[i] = false; Perform other non-critical section action...
If we have an equation with N variables of the form x1 + x2 + x3 +...+ xN with sum S, and upper and lower bounds for each of the N variables, is it possible to find the number of integer solutions (ways) to solve the problem ? For eg :- if S=5, N=3 and the bounds for variables are 1<=X<=3, then combinations possible ar...
Say I have a system that is $n$ differential equations that are all coupled together, over a time interval $[a,b]$ with timestep $t$. Is there a straightforward time complexity for MATLAB's built in differential equation solvers ode45, ode23, ode15s? Particularly I am interested in how ode15s grows as the size of $n$ i...
Given a context free grammar, both the algorithm for determining whether a given string is grammatical and the algorithm for producing a grammatical string in that language are well understood. To produce a grammatical string, just keep replacing non-terminals with one of their right-hand-side productions until you ha...
I had a simple probability question: suppose we have two coins, coin 1 is heads with probability $= 10\epsilon$ and coin 2 is heads with probability $=\epsilon/10$. Given an unknown coin, how many times do I need to flip the coin to decide which coin I have been given? I feel the right answer is $\Theta(1/\epsilon^2)$,...
write a Turing machine that accepts L = {a^nb^2n:n ≥ 0} where there are double the amount of b's in comparisons to the amount of a's. So aabbbb would be accepted but aabbaabb would not. I am unsure of how to check that there are twice as many b's then a's. So far i have a change it to an A move to state 1. Then check i...
I was reading an article on Longest Arithmetic Progression. The solution given has S(n)=$O(n^2)$. Can't I solve it in $O(1)$ space? To find the three elements, we first fix an element as middle element and search for other two (one smaller and one greater). When we found them we still keep on decreasing left and right ...
I have a collection of people who need to be assigned to one of 10 dates. Each person is in a specific department. The departments have vastly varying amounts of people (from ten to thousands). Each date can accomodate a set amount of people, let's say 5000. My task is to assign each person to a date such that the amou...
I'm working on an application where the user can add 'calculation' fields to a page. Every calculation field is dependent on x amount of 'number' fields and 'calculation' fields. If calculation field A has field B as one of it's components, field B cannot be dependent on field A, as that would introduce circular depend...
I'm reading Steven Skiena's "The Algorithm Design Manual", and in one of his War Stories on page 155 he states: Efficiency is a great challenge in Mathematica, due to its applicative model of computation (it does not support constant-time write operations to arrays) and the overhead of interpretation (as opposed t...
A large body of work looks at the computational complexity of games. In particular, identifying a forced win from a given position. Is this problem equivalent under polynomial-time reduction to identifying the best forced outcome of a game, where that outcome might not be a win? If necessary, assume that it’s a two pla...
Motivation: Following this discussion about using asymptotic expansions (i.e. polynomial power series) for numerically solving partial differential and algebraic equations (PDAE), I couldn't find any implementation of the method. So I'm thinking of implementing a SymPy function similar to Mathematica's AsymptoticDSolve...
I am going through machine learning course on coursera. While going through the section on neural networks I came across the cost function for multi - classification problem using neural networks ( ignoring the regularization term ): $$\begin{gather*} J(\Theta) = - \frac{1}{m} \sum_{i=1}^m \sum_{k=1}^K \left[y^{(i)}_k ...
If I apply Dijkstra's ,BFS or Bellman-ford algorithm on a disconnected Graph then will the output be a tree or a disconnected Graph only because even if we have a disconnected Graph and we run Dijkstra's algorithm on it then it will return shortest path in the connected component only , but we maintain a predecessor ar...
$$\{ a^{k}b^{j} : k = 2j , k \geq 0\}$$ I'm trying to wrap my head around CFG's but I am having trouble. From this language, there should be twice as many a's than b's. Here is my attempt. $$S \to aSb \ | \ a Sa \ | \ \epsilon $$ $$S \Rightarrow aSb \Rightarrow aaSbb \Rightarrow aaaSabb \Rightarrow aaaabb $$ But, I can...
I've been using multiprocessing and parallelisation for the first time this week on a very large data set using 32 CPUs. I decided to explore it for a smaller task just to see if I could learn anything, just on the 4 CPUs of my Mac. I created a task to add 100 to every element in a 500,000 element list. To my surprise,...
Given an array A, we should partition A into two subarrays whose sums are equal, and that maximizes this sum. We are free to omit items from the subarrays. For example, [7,2,5,7,12] can be divided as the following: [5,2][7] = 7 [5,7][12] = 12 [7,7][2,12] = 14 We need the final answer as 14 because the max possible s...
I'm curious if somebody has already figured this out. Is there an efficient algorithm that will generate (in $\mathbb{R}^2$) a sequence of points in such a way that the solution to the travelling salesmen problem is known a priori, and such that we have a uniform distribution on the set of points? For example, I can t...
I have been looking into the history of programming, and everybody and their grandmothers begin the subject with a claim more or less similar to the following: At first, programmers used machine code. Later, there were assemblers. Then, pseudo code, and finally Fortran came. With some Google-fu I can very easily find...
Let $T$ and $P$ be respectively two sequences $t_1, · · · , t_n$ and $p_1, · · · , p_k$ of characters such that $k ≤ n$. The characters range over a finite alphabet Σ. With each position of $T$, we associate a non-negative value. Let $v(i)$ denote the value for the i-th position in $T$ for $1 ≤ i ≤ n$. Find a matching ...
There is a well-known problem in CS of finding the maximum sum of non-consecutive integers in a list. There is even an SO post about how to solve it: https://stackoverflow.com/questions/4487438/maximum-sum-of-non-consecutive-elements That said, I have read this post many times, and many other posts online about how to ...
In DFA, is two arrows on each state necessary? Or it depend on language alphabets? I mean if there is $\Sigma = \{a\}$ then there should be one arrows on each state. OR if there are $\Sigma = \{a , b\}$ then there should be two arrows on each state. OR if there are $\Sigma = \{a , b , c\}$ then there should be three...
Let $R =\mathbb{Z}/N \mathbb{Z}$. Let $f:R\to \mathbb{R}$, $\rho:R\to \lbrack 0,1\rbrack$. We assume that it takes trivial time to compute any given value $f(m)$ or $\rho(m)$. Define $$S(\delta,m) = \sum_{n\in R: \rho(n)\geq \delta} f(n+m).$$ Is it possible to compute $S(\delta,m)$ efficiently? To be precise: say we a...
I tried to solve it as the following: $$\overline{L}=\big\{\langle M_1,M_2\rangle\mid M_1, M_2\text{ are TM and } L(M_1)\cup L(M_1)\neq\Sigma^* \big\}$$ I'll show that $\overline{L}\not\in RE$ by reduction from $$\overline{A_{TM}} = \big\{ \langle M, w \rangle \mid M \text{ is TM and }M \text{ rejects } w \big\}$$ I be...
Given a unbalanced k-ary tree base (with internal nodes that represent operators and leafs representing values) from the space of all unbalanced k-ary trees T a distance function delta(t, t') = number of edit operations to transform t into t' the edit operations add(t) (adding a random leaf), remove(t) (removing a ran...
I tried solving past exam question but there is this one that I haven't been able to solve. The question states that a suitable precondition should be found for the statement. $$ a= i +2; i++\{(a = 7)\land(i = 5)\} $$ Here's my solution and where I got stuck: $$ wp(a= i +2; i++,(a = 7 \land i = 5) \\ =wp(a= i +2, wp(i...
I have a couple of questions based on how SAT solvers work. I understand that SAT solvers may employ any/all of the following techniques: Randomness Heuristics Backtracking SAT is just one example of an NP-complete problem. Is it common to use such techniques in conjunction to solve intractable problems? I normally s...
Lets say we have $L_1$ which contains all binary numbers divisivle by 2 but not by 4. I would say this language contains all words with a 10 at the end. Ive found a regular grammar $G$ with $L(G) = L_1$ so that $L_1$ must be regular. Now I have the problem that my teacher told me that $L_2 = \{ww| w \in \{0,1\}*$ and ...
There is some thing i dont understand about Hough Transform in polar coordinates. From wikipedia article: "The simplest case of Hough transform is detecting straight lines. In general, the straight line y = mx + b can be represented as a point (b, m) in the parameter space. However, vertical lines pose a problem. They ...
I've only implemented the HM algorithm on a small academic language with a few primitive types and functions. In that case, the unification algorithm would return a type error if two different primitive types were given. For example, if statements unify their condition with primitive type bool, producing the following ...
How to prove using pumping lemma {0^n OR 1^2n OR 2^3n | n >= 0} is not context free This isnt the same language as {0^n1^2n2^3n | n >= 0} as this language the numbers need to be in order.
I was wondering if there is a complexity class for problems that can be solved efficiently by a quantum computer such that it always gives the right answer? For example the Deutsch-Josza algorithm never fails. Another way of asking would be: is there a class (call it Q) such that Q is to P what BQP is to BPP? I guess c...
Suppose that I have two lists of numbers (which represent IDs for rows in a database): list1 = [1, 4, 7, 8] list2 = [2, 3, 5, 6, 7] I would like to write an algorithm to pair each number in the larger of the two lists with a number in the smaller list such that: Every item must appear in at least one pairing No item ...
We are given a sequence of $n$ numbers called $\alpha$ and an arbitrary number $x$. Give an algorithm to find a permutation $\pi$ of size $n$ such that $\sum_{i=1}^n{\alpha_i.\pi_i} = x$ or tell if there is none. Well I wasn't able to solve it in polynomial time and I'm not sure whether it's possible. So if it's NP w...
My question is simple but I don't know if the answer is. If you have two strings of length 10 million each, is there an algorithm that would allow you in practice to compute their edit distance (Levenshtein) if you are told it is at most 100?
In a rewriting system, suppose the production rule S→xAyAz (or <S>:=x<A>y<A>z, in BNF), where S and A are nonterminal symbols and x, y, z are any string. This rule produces the string xa1ya2z, where a1 and a2 are strings substituted by the nonterminal symbol A. The substitutions a1 and a2 may be equal or different stri...
I am attempting to understand the growth of the following algorithm, which is described as $n^2$ growth in the book I am reading: "... performs of the order of $n^2$ steps on a sequence of length $n$." Could someone please explain how this is calculated in the following code, which is also taken from the book? If I pri...
Is it possible to define a 《chess language》: language={alphabet = {(chess pieces, squares of chess board)}, grammar={rules of movement of pieces over the board}}? I looked online but I cannot find a way to define the grammar. Every way I can think of, is either stupidly long and complicated, or does not cover all the r...
Consider a tree structured task list where intermediate nodes define sub-groupings of tasks but are not tasks themselves, and the leaves represent the actual tasks. I want to traverse this type of tree giving equal opportunity/priority/time(?) for each group with respect to its parent. For example, if the root have 3 s...
I've taken intro to graphics and am interested in diving deeper into the subject. My understanding is that the field depends a lot on geometry, but I'm having trouble figuring out exactly what geometry I should learn now that I've tackled the basics. I found https://www.springer.com/us/book/9781852338343, but it basic...
Consider a 2,3,4 tree like so, 53 / \ / \ / \ 46 60 | 70 / \ / \ \ / \ / \ \ / \ / \ \ 41 48 55|59 65|68 73|75|79 How to delete 41 from the tree from here ? I would like to know the in...
I have the the following problem. Say we have a graph $G = (V,E)$ where all $e \in E$ have positive weight, and $E$ can be separated in to two disjoint sets $E = A \cup B$. We have to find a spanning tree such that we minimize total weight but also we can only use a maximum of $c$ edges in $B$. I feel like this is just...
As far as I know, Breadth-First-Search [BFS] theory traditionally requires a Queue to process a given level of a graph (i.e: wiki seems to assume so). But does BFS really actually require a Queue, rather than just any type of Collection? A Queue is a Collection A Set is also a Collection, for example Wiki states that...
My textbook says, "Instead, it is far better to use a hexadecimal representation for documentation purposes. Whether or not a code represents a binary number, it can be treated as such and converted to the corresponding hexadecimal number. This makes the representation more compact and, as a result,...
I've been struggling with a particular constraint satisfaction problem, that appears like it should have an easy solution. In fact, I need a very fast solution. The problem is: I am making a card-playing AI, and at some point I need to guess a plausible solution to the other players hands. Given the history of the gam...
I'm wondering why if I increase the number of step in a set of simulation of a random walk on a grid the distance from the origin is higher. If I can move on the grid in 4 directions, there are 0.5 chance of getting closer to origin and 0.5 of getting farther. This is a simple javascript example (well, here maybe I mad...
If you have a back edge in a directed graph, then you may have a cycle or must have a cycle?
Student asked me this question. During lectures on algorithm complexity I've shown similar picture (source): After I've explained and gave examples for each category, a student asked: "Which of these represent a majority of algorithms?" I guess that the question is not right in a sense that we are creating new algorit...
I read that a fully polynomial time approximation scheme (FPTAS) has time complexity polynomial in the input size and also polynomial in $1/\epsilon$. However, this leaves some ambiguity. For example, $T(n,1/\epsilon)=\min(n^{1/\epsilon},(1/\epsilon)^n)$ is both polynomial in $n$ (when holding $1/\epsilon$ constant) an...
If consecutive natural numbers 1 .. n^2 are placed in a n*n grid so that sum of numbers in each column and in each row is a constant then we call it a magic square. I would like to generate magic squares of size 16x16 and 256x256 for not skewed byte mapping. Maps arranged as magic squares tend to have better distributi...
Solve by using the substitution method $T(n)=T(n-1)+2T(n-2)+3$ Given $T(0)=3$ and $T(1)=5$ I kind of understand it with only one given and one recurrence call by expanding the call using what is inside. ex. if it was $T(n)=T(n-1)+3$ Given $T(1)=5$ I would take the $n-1$ and plug it into the the first equation $T(n)=T...
This problem involves the time-complexity of determining set intersections, and the algorithm must give output on all possible inputs (as described below). Problem 1: The input is a positive integer $m$, and two unordered subsets $A$ and $B$ of $\{1,\dots,n\}$. The size of the input is $n+ |A| +|B|$. Output: The ...
How can I prove this identity of languages? My aproach is the following: Let A, B and C to be languages, and let x to be an arbitrary string. (A ∪ B) ⇒ x ∈ A ∨ x ∈ B How do you proceed?
Whenever we try to get space in heap(using malloc or new) we can get out of heap space error if it exceeds the limit. But, we have virtual memory so why can't OS allocate that much space and then do swapping when I need some part of it or not?
I study Huffman Coding tree from "Data Structures and Algorithm Analysis" of Shaffer and it says that Huffman Coding tree is an opportunity to experience a search trie. However, the code implements it with a heap class. As a result, I wonder if Huffman Coding tree is actually a heap or a trie? If it is a heap, is it a ...
I am trying to implement the algorithm described in the paper A quantum-inspired classical algorithm for recommendation systems. This is the algorithm: These are the necessary definitions for mathematical notations used in the algorithm to understand the algorithm. The distribution is defined as, for a nonzero vecto...
Hypercomputation is a "cheat" that extends the capability of a Turing machine or quantum computer or cellular automaton by adding extra abilities. A standard method is "Oracle machines", Turing machines with an extra black box device that can be queried and give an output that normally would be uncomputable. For exampl...
The Space Hierarchy Theorem states that If $f(n)$ is space contructible, then for any $g(n) \in o(f(n))$ we have $SPACE(f(n)) \neq SPACE(g(n))$ An example of a SHT proof can be found here or here but they are generally based on the same idea differing only in technical details. We would like to find a language $L$ su...
I want to show the reduction $HC \leq HP$. Let $G=(V,E)$ be my undirected graph. My idea is: For each edge $e=(u,v) \in E$ check whether $(V,E\backslash\{e\})$ has a Hamiltonian Path. If this is true for all edges, we have a Hamiltonian circuit in $G$. It is pretty trivial to proof the first direction (when we have a ...
I was solving this problem and end up learning two ways to solve this problem. One is two pass method and the other is considering peak and valleys (candies - interviewstreet). Both of these are O(n) solutions. Now, I was thinking about the generalized problem which consider k neighbors(i.e. for the ith child we have t...
I am stuck on how to progress with this proof; i cannot see my next move. The task is to show $S \to \exists x Q(x) \vdash \exists x (S \to Q(x))$ using natural deduction for predicate logic. My first attempt was the following; 1: $S \to \exists x Q(x) \space \space \space \space \space \space premise$ 2: $x_{0} \space...
I'm going through an algorithms text book. One of the questions asks: True or false? $n + 2n^2 + 10n^4$ is $O(n^5)$. This is marked as true. Shouldn't it be $O(n^4)$? What am I missing here?
Let $U=\{1,2,3\cdots m-1\}$ and some $n$ keys from $U$. Is it possible to sort these $n$ keys in $O(n \log \log n)$ time using $O(n)$ space? Model of computation is RAM.
These questions is about one of my research. As I am not a computer scientist, formal answering is difficult to me. I have a special search algorithm which the explanation here will take a lot of time. However I can explain it shortly by some notations. Assume that we have an array of somethings (in my real research ...
We have given array $V$ of $N$ integers, we want to count the number of subarrays of the array such that each elements in the subarray either doesn't occur at all, or it occurs odd number of times. Subarray is subset of array that is contiguous part of the array. For example $N = 4, V = \{1, 1, 1, 2\}$. The result is $...
I had review feedbacks regarding my recent publications and reviewers argued that the improvements are not significant over the baselines. I tried my classification algorithm on some image datasets such as Extended Yale, and in the literature (other papers) i noticed the same amount of improvements in the results was a...
Both AlphaGo and AlphaGo Zero include prior board states as input features (the "Turns Since" planes for AlphaGo, and the repeated 8-step history planes for AlphaGo Zero). What is the purpose of including this history information in the input to the neural networks? If we ignore the ko rule, the best move at a position...
Say I have $n$ numbers in an array and I have to compute the sum of those numbers. Is the complexity considered as $O(1)$ or $O(n)$? Clarification Say I have 10 constants, I could precompute the total and claim that overall, the complexity is $O(1)$. Yet, if I have 10 assigned variables, I would have to perform 10 addi...
Suppose we have a formula $F(x_1,x_2,x_3) = x_1 \vee (x_2 \land x_3)$. $F$ outputs 1 when it has a satisfying assignment and 0 otherwise. How can I convert the above formula(or any formula like this in general)to a branching program(constant width)?
Let $A\subseteq \{1\ldots n\}$ with $|A|=\alpha n, 0<\alpha\leq1$. Now we start generating random sets $B_i \subseteq \{1\ldots n\}$ with $|B_i|=\beta n$ where $0<\beta\leq\alpha$. How many $B_i$ do we have to generate, so that there exists a $j: B_j\subseteq A$ with decent probability (constant or overwhelming in $n$...
I have been reading the chapter 6.2.2 in Knuth's book about lower and upper bound on the average path length in binary search tree. And I have problems with understanding small details of Theorem M (page 445, second edition) about an upper bound on the average cost of the search. Here is the theorem: Given $n$ keys and...
The classic $k$-center with outliers problem is NP-hard and there exist approximation algorithms to solve it. However, what if we assume that the input point are on a line, rather than in an arbitrary metric space? Does the problem become polytime solvable? Can someone link me to reading on this topic?