instruction
stringlengths
35
29.1k
We are given a simple, undirected, weighted, incomplete graph $G=(V,E)$, where $V$ is the set of vertices, and $E$ is the set of edges. In addition, a collection of sets $S$ is given, which fully partitions $E$. For any two vertices in $V$, I need to find the shortest path between them. The additional caveat is that no...
I have a small question regarding the ECLOSURE of a certain state in an ε-NFA. If we have a transition that has both a and ε transitions, is the ECLOSURE affected? Also is there any rule that in ECLOSURE we should include the states that are accessible only from transitions containing ε?
This paper describes a computable normal number. One property of normal numbers is that, written in binary, the $i^{th}$ bit is equally likely to be 0 or 1 (in the sense that as $n$ gets large, the number of 1-bits and 0-bits before the $n^{th}$ bit are about the same). Doesn't this mean that the algorithm that compute...
Suppose I just invented merge sort, but due to my limited ability was only able to prove that the running time is $O(n^2)$. However, I suspect that the running time is actually better (in reality it's $O(n \log n)$). Technically in my paper I should say “runtime $=O(n^2)$”, but it’s somewhat misleading because people t...
A bipartite graph is planar iff it has no $K_{3, 3}$ or $K_5$ minors. I am looking for a necessary or/and sufficient conditions to allow planar drawings with no edges "going around" sets of vertices. These are drawings satisfying: All vertices of one part are drawn on a single vertical line. Vertices of the other part...
Arden's lemma is applied in cases where we have an equation that looks like this: $$ X_{i}=AX_{i} + B, $$ with the condition that $\epsilon \notin A$. But if I have such situation: $$X_{i}=AX_{i},$$ so there's no B, or simply talking we have $B= \varnothing $, thus by the Lemma, we have $$X_{i}=A^{*}\cdot\varnothing$$ ...
I posted this on MathUnderflow but got no answers, so thought I'd try it here, I am reading Rabin and Fischer's old paper [will post a link when possible] where among other things, the doubly exponential complexity of Presburger arithmetics is proven. The proof relies on the existence of a formula $I_{n}(x)$ informally...
Lossless Data compression (source coding) algorithms heavily rely on repetitive pattern (redundancy). Is there a Lossless Data compression method/algorithm that is independent of repetitive pattern (redundancy)? Note: Most lossless compression programs do two things in sequence: the first step generates a statistical...
I'm designing puzzles by running a MAX-CSP solver, and it works nicely in practice. For concreteness, my problems have the following form (in a pseudo-modeling language): # set up vars & their domains x_1 {1} x_2 {0,1} x_3 {0} x_4 {0,1} # constraints (x_1 != x_2) (x_2 = x_3) (x_3 = x_4) (x_1 != x_4) (x_2 = x_4) The ob...
I'm currently working through some regular expression questions and I've got a solution for one of the problems that I'm not certain is correct. The question has this preface. We only consider languages over the alphabet $\{0, 1, 2\}$. We also view words over this alphabet as ternary numbers. For the language below g...
Here I have created 2 classes , $A$ is the super class of $B$ , i.e , $B$ inherits the features of class $A$. Now I don't know exactly what statement (1) does but I am speculating as follows ,kindly correct me if I am wrong , An object of $B$ is created whose address has been assigned to the variable $ob$ of class $A$...
Say, I have an image of bit depth 1 (i.e. binary matrix) and I cropped the image to form a smaller matrix. From the cropped matrix (of a reasonable size). I need to know the starting coordinates from where the matrix was cropped from. I encoded some lines at regular intervals. The position of the lines follow the equa...
Consider the language of even-length palindromes $L = \{ WW^R \mid W \in \{0,1\}^* \}$. This language is surely context free and I need an NPDA to recognize it. But, what if we replace the stack with a queue which supports insert and delete operations? Can a queue automaton accept $L$?
I wonder if you have an idea over the time complexity of the following problem, or a problem similar to this one (generally a selection problem) [Assuming operations on integers take O(1) time] We are given a set $N$ of $n$ items, that are subject to general precedence constraints (a partial order $E$ on $N$). The prob...
The origin problem is here. Now it is deleted. Suppose I have 3 'available' copies of a, 2 of b, 3 of c, and 4 of d. I want to know the number of different strings with length $l$ using these characters (but no more than the available copies). Is there an efficient (i.e. $o(k)$) algorithm for computing the $k$-th smal...
So far I have learned how to write proofs by induction and it went fine until I got this recursive problem, which I'm not quite sure how to begin and how to prove that with induction. P(2·a,⌊b/2⌋) : b>1 and b is even number P(a,b):= P(2·a,⌊b/2⌋)+a : b>1 and b is odd number a :b=1 to prove i...
It is known that a Turing machine cannot predict the outcome of another Turing machine. Given a machine $M$ less powerful than any Turing machine (i.e. able to decide less languages, i.e. a subset of langauges, than any Turing machine), does there exist a Turing machine $T$ which can always compute $M$ such that $T(M, ...
Let's take this algorithm as an example. $PATH$ = {$G$, s, t | $G$ is a directed graph that has a directed path from s to t }. Prove that $PATH \in P $. Ok, I know the basic algorithm is to start from node s, place a mark on it, and then look over the rest of the edges and place a mark from node s to node x if there ex...
I know that to find an error in signal we have to divide given signal with given polynomial and if 0 remains there is no error. But if I have received signal: 0000 0101 0101 0000 1010 0101 and polynomial 10001000000100001(CRC-CCITT) how do I Xor them: 1010101000010100101 (signal without zeroes) XOR 10001000000100001 ...
Given two polynomials of degree $n$ and $m$ over $\Bbb F_q[x]$ it takes about $O((n+m)\log ((n+m)))$ operations ring operations over $\Bbb F_q[x]$ to multiply them. What is the corresponding bit operations? What is the corresponding ring and bit operation count for remainder operations in $\Bbb F_q[x]$.
Minimize $$\sum_{i=1}^{n}\sum_{j=1}^{m_i}w_{i,j}v_{i,j}$$ subject to $$\sum_{i=1}^{n}\frac{m_i}{m_i+\sum_{j=1}^{m_i}v_{i,j}} < \theta$$ $$v_{i,j}\in\{0,1\}~\forall i,~j$$ where $w_{i,j}$ and $m_i$ are positive integers (constants) $\theta$ is a positive real number (constant) $v_{i,j}$ are 0-1 variables is this pro...
I am given two sets $S, T$ each of $n$ points in $\mathbb{R}^k$, I want to find a bijection $a : S \rightarrow T$, such that $$\sum_{s \in S} d(s, a(s))$$ gets minimized, with $d$ being the Euclidean distance. I am aware that this transportation problem is a special case of the earth mover distance problem, but since ...
I want to denote the class of problems solvable by linear space multi-tape Turing machines. I have seem in many places this class being denoted by $SPACE(n)$. But why is the notation $SPACE(O(n))$ not preferred in this case? In particular, I'm writing a project in which I need to distinguish between problems solvable i...
We need to have a precise definition for what a constraint satisfaction problem (CSP) is to study it formally. Looking at a survey by Libor Barto, titled "The Constraint Satisfaction Problem and Universal Algebra", a definition is given in Definition 2.1. Further, it is claimed this is a "standard formal definition of ...
Currently I'm reading about the Halting problem. $H(\langle M,w\rangle)$ is a machine which will solve the Halting problem, and then using machine $H$ one creates a new machine $D$ and we run $H$ on input $\langle M, \langle M\rangle\rangle$. My question is: What is the significance of giving a description of Turing m...
So I know that scheduling has been covered in other articles, but because my provided values are different and decimals are used, I am having difficulty wrapping my head around it. I have reviewed all of the other posts already but would like clarification on my specific values if possible. What is the average turnar...
I want to ask, consider we want to compute the slope of x-direction of the following step . The slope for it would be $m =\frac{0}{m_2 - m_1} =\frac{0}{5 - 2}$ which is 0. But the derivate for image in x-direction computed with (something like, some symbols aren't existed in my phone so lets just say $\frac{df}{dx}$) $...
Is there a context-free language that can be expressed with an unambiguous grammar but can't be expressed with a grammar that would result in linear-time backtracking recursive descent parsing? The motivation for this question is the fact that backtracking recursive descent parsing has a bad reputation for worst-case e...
I am studying some lecture notes on the complexity of algorithms. The notes give a proof that NP is not a proper subset of coNP. However, they still assert that NP is a subset of coNP (which I agree with). So, in this case, why does it not follow that NP is equal to coNP?
I would like to implement the multi-fragment heuristics algorithm for finding a solution to the traveling salesman problem. The algorithm is described here as follows: This seriation method re-organises the $D$ matrix by iteratively placing the smallest distances in matrix $D$ in the $n-1$ cells contiguous to the diag...
I'm having a difficult time understanding time complexities of algorithm. I know that a polynomial time is of the form O(n^m) where m is a constant. Consider the following case where A is a list of elements: Foo(A) for each element a in A: for each element b in A-a: Polynomial-Time-Algorithm-Bar(A, a, b) I...
can someone provide a proof with induction on why the Russian peasant multiplication work ? if you don't know what that is , here is the algorithm : P(2·a,⌊b/2⌋) : b>1 and b is even number P(a,b):= P(2·a,⌊b/2⌋)+a : b>1 and b is odd number a :b=1
I'm building a chatbot that would respond to text messages. Let's say that my chatbot works for customers of an internet provider and it can respond to the following things: Problems: About payment; About internet connection. General requests: Change user's account e-mail; Call for technical assistance. My ques...
Let $A$ be a regular set. Consider the two sets below. \begin{align*} L_1 &= \{ x \mid \exists{n}\geq 0 , \exists{y} \in A : y =x^{n} \}, \\ L_2 &= \{ x \mid \exists{n}\geq 0 , \exists{y} \in A : x =y^{n} \}. \end{align*} Which of the following is true? $L_1$ and $L_2$ are regular $L_1$ is regular but $L_2$ is not $L_...
I am interested in understanding the DCMST problem, explained in this paper (http://www.dcc.ic.uff.br/~celso/artigos/cpdcmst.pdf). I don't think I understand it as I should. Here is how I understand it, we have a undirected connected graph $G=(V,E)$, a cost $c$ for every edge $e(i,j) \in E$ and a value $d$ we want to f...
I am trying to understand how many states should be there in a Finite Automata which does not accept anything. I thought it to be containing only one non-final state, the starting state, with all transitions going to itself. But one of my teachers mentioned that the set of final states cannot be empty. Does that mean...
I'm just getting started with cs. In school I heard about that modern micro processor are not perfect. So what are the issues? Are does problems related to energy(power draw)/ time /speed(clock speed)? Or is the design faulty? So if you could design the perfect cpu what would it look like?
The pumping lemma states that if we can split a string w (taken from a context-free language L) as uvxyz with conditions |vy|>=1 |vxy|<=p |w|>=p for some p then $uv^ixy^iz$ is in L for any i. However, some context-free languages include the empty string, which has length 0. How can we possibly split the empty string to...
Where does the assembler live in the system? I understand that assembly language gets converted to machine code (binary) and that the processor then follows these instructions. Where does the assembler live? Does it live in some kind of Read Only memory?
Are there any types of distributed databases which allows untrusted peers, like Blockchain? If it exist, can I look its whitepapers and/or implementations?
This is the original problem: And this is 1-in-3-SAT: I am using the 1-in-3-SAT problem (Pc) to reduce from, in order to prove that the original problem (P) is NP-complete. I am stuck at finding a transformation T to prove that Pc <= P, such that every instance X of Pc is transformed into an instance T(X) of P, and ...
I was wondering recently what would happen if we'd allow context-free grammars to have an infinite number of rules. Clearly, if we'd allow arbitrary such infinite sets of rules, every language $L$ over some alphabet $\Sigma$ could be described by a CFG $G = (\{S\},\Sigma,R,S)$ with $R = \{S \rightarrow w \mid w \in L ...
In papers usually Cross-Lingual Information Retrieval (CLIR) and Multi-Lingual Information Retrieval (MLIR) use equivalently or distinctly. I want to know is there any difference between these two terms?
I know that with graph coloring we can build a simple schedule with maybe 9 students and 9 lectures (i.e. these notes) and determine the minimum number of meeting times, but is this feasible in a real world scenario? Say I have 30 professors and 200 students, can we determine a minimum number of meeting times with a gr...
I am in search of a linear-time sorting algorithm that is capable of returning an array B of indices A, sorted on the value of the corresponding element of A. For example: Input = [2, 6, 8, 9, 1, 7, 0] Output = [6, 4, 0, 1, 5, 2, 3] Things I have tried: Storing the index and value in one number, using something like ...
To prove that $L=\{0^m1^n|n \text{ divides } m,\text{ } m,n\gt0\}$ is not a CFG, I applied the pumping lemma. I chose $w=0^{21p}1^{7p}$ for the pumping constant p. By the pumping lemma, $w=xyuvz, |yuv|\leq p, |w|\geq p, |yv|>0, xy^iuv^iz \in L \forall i>0$ Take $i=0$ then consider 3 cases: Case 1:$yuv$ is only a substr...
In all the examples of ALOHA I've seen, the Poisson distribution is used. Theoretically, how could the throughput be calculated if a Binomial distribution was used instead? For example, in the case that the offered load follows a Binomial distribution with probability $p$, I know that the probability of $k$ attempts wi...
This week I read something about network flow from Algorithm Design. But I am confused about some concepts. We say, if a graph G contains some nodes with demands, positive or negative, how to define the min cut for these graphs? If we still use the definition for simple graph, the value of max flow is not equal to the...
I haven't been able to find literature on the efficient solving of the following problem. Given $n$ random points $x_i \in (0, 1)^2$ the unit square, obtain the flat clusters of points, such that two points are in the same cluster if their pairwise distance $d(x_i, x_j) < r$, where $r < 1$ is a fixed parameter of the p...
I was wondering how would I go about constructing a Turing machine that accepts $u < v$ with $u$ and $v$ positive binary numbers: for example $10<100$ is accepted but $11<10$ would not be. (We can assume that the leftmost digit is always a $1$). I was thinking that I should start by changing the $1$s to $X$s but that d...
I'm trying to solve an exercise in which I have to find the strongest post-condition of the two Hoare triples. \begin{gather*} (| a=9 |)\ a=2; b=a+1; a=b*b;\ (| ?? |)\\ (| i=-j |)\ i=i+1; j=j-1;\ (| ?? |) \end{gather*} For the first one, I found post condition as $a > b$. For the second one, I found $j = |i|$....
I'm confused about the intended meaning of the following passage from Bob Harper's Practical Foundations for Programming Languages: A collection of rules is considered to define the strongest judgment form that is closed under, or respects, those rules. The author goes on to explain the italicized words. Is this to b...
We have a normal knapsack problem but we can choose up to $t_i$ of the $i$-th object. How would you solve this problem with complexity less than $O(V(n + \sigma(t_i)))$ where $n$ is number of objects and $V$ is the total volume?
I am given a set $A\triangleq\{1,\ldots,k\}$, an integer $s\leqslant k$, and non-negative integers $a_{ij}$. My problem is to find $s$ disjoint subsets $S_j$ of $\{1,\ldots,k\}$ such that: $\bigcup_{j=1}^s S_j=A$; and $|S_j|\leqslant a_{ij}$ for all $i\in S_j$ and $j=1,\ldots,s$. How to solve this problem? Is it har...
I have a dataset full of 0s and 1s, and when I visualize it with t-SNE, which does dimensionality reduction. There is clearly some structure in it as shown below. Each color corresponds to a particular category. There are 10 categories, and there are roughly 180 data points for each category. Each data point is a 64-di...
I have an odd PDA problem that I cant seem to construct. I haven't come across one like this before. $L = \{w\in\{a,b\}^{*} : 3\#_{a}(w) \leq 5\#_{b}(w) \leq 4\#_{a}(w)\}$ Could I get some pointers on how to tackle such a problem like this so I can be more familiar with the approaches here.
I'm learning the basics of grammars and compilers for a comparative programming languages class, but having a bit of trouble with one aspect of grammar derivation. Here is an example of a grammar derivation in a Youtube lecture I found. I get everything he covers here except that it isn't clear to me how a derivation i...
We have a set of $n$ elements which contains at most $\log n$ different numbers. I want to sort this set faster than $O(n \log n)$. Is it possible? I tried using a hash table to find the set of $\log n$ unique elements, then sort them in $O(\log n \log \log n)$, after that creating a new array of $n$ element with this...
Here's a problem that came up when organizing a party: You need to place $n$ guests in tables of size 10. Each guest has a list of $m$ other guests they'd like to have in their table. Find a seating arrangement so that the number of granted wishes is maximized. As many tables as possible should be full, i.e. at most on...
In multi core architecture, let us say we have M cores and N threads (N > M) and a process once assigned to a core can't migrate to another core's ready queue. We have to design scheduling policy to balance load. I read about this area and found this - 1) Block multithreading, Interleaved multithreading and Simultaneo...
How to construct regular expression for language L which contain all words in which there is a letter 'a' and the letter 'b'? Of course, I understand that it's easy problem but I just start to learn this science? Please, any advices and hints.
Firstly, which of the two diagrams below is the more accurate or more well-explained (if both are accurate) representation of the SSL process (at a beginner's level)? Diagram 1 Diagram 2 Also where does the "pre-master secret" in diagram 1, step 5 come from? I presume it comes from diagram 1, step 2? How is it create...
Given an array, if all the elements are distinct, can we find the count of elements which are lesser than an element and present to the left of that element in linear time if we have to do it for every element. I know this can be solved in O(nlogn) time by using self balancing trees, but I want to know whether we can s...
Does the following program $P$: a = 2 b = a + 3 c = a * b Satisfy the following formula? $$\{ \top \} \; P \; \{ a < (b - 2) + c \}$$ I want to use integers in $P$. The postcondition is satisfied, right?
I don't know how to solve this. The main thing I do know how buffers work but I don't know about display locations and lookup tables. A color frame buffer has 3 bits per display location and 6 bits per entry in three lookup tables. What is total number of colors in the palette from which this frame buffer has to choose...
I am having trouble understanding the proof of the theorem, which states that the greedy scheduling algorithm produces solutions of maximum size for the scheduling problem. The proof that I am referencing is here: Greedy Algorithm Proof I don't understand how the proof tells us to make the the problem smaller and small...
I see so many 8 Puzzle Solvers use a stack instead of a queue. Why is that? If you are looking for the solution with the fewest number of moves, wouldn't the solution be at a shallower point in the tree, meaning that BFS would find it much quicker? Is there some subtlety to the problem that I'm forgetting that makes DF...
I have 1 problem :--> L = { < M > | TM halts on no inputs } I have solved the above problems by reductions given in the book and even there are many links in stackexchange site. I have no problems in the reduction method. But, just trying to be more curious, I tried to solved these problems by using rice theorem. I kn...
While studying, I came across the following statements: A join point is a program point where two branches meet. Available expressions is a forward, must problem. Forward = Data Flow from in to out. Must = At joint point, property must hold on all paths that are joined. I get what joint point, available expression and ...
I was reading the paper _Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials (Philipp Krähenbül and Vladen Koltun, in Proceedings of 25th Annual Conference on Neural Information Processing Systems (NIPS), 2011 pdf), and I didn't understand this equation (eq 5) in the paper: I understand the first...
As Atm is recognizable, its complement cannot be recognizable, due to being so Atm would be decidable. I am trying to clarify if the problem P is the complement to Atm. If so, how could i approach the problem without looking at Atm to prove undecidability? My first thought was: H is a machine which solves P: H halts a...
I have found many proofs online about proving that a greedy algorithm is optimal, specifically within the context of the interval scheduling problem. On the second page of Cornell's Greedy Stays Ahead handout, I don't understand a few things: All of the proofs make the base case seem so trivial (when r=1). I don't und...
Let's say I have an NxN array if integers. I want to continually update it, but also continually query for the sum of an arbitrary sub-section. So example would be as follows: We start with a 3x3 array of all 0s. Operations: update 1,1 to 3 update 1,2 to 1 update 0,0 to 2 update 2,2 to 6 print sub-section starting at ...
The most trivial implementation of BFS would simply store the last frontier (open list), build the new frontier, and then replace the last frontier with the new (like in the example python code below). But almost universally, the first algorithm shown for BFS in textbooks is the queue-based implementation. What's the d...
Is there any way for solving the Knapsack problem when we are limited by several constraints? Let's assume that we have a set of items in which we have value v that we want to maximize and we also have two constraints weight and volume that must be lower or equal than the values W and V respectively. My question is, ca...
The full question is: Construct a Turing machine that recognizes the set $\{0^{2n}1^n \mid n\geq 0\}$. The Turing machine starts with the input on the tape and the head over the leftmost symbol of the input. The symbols to the left of the input are blanks out to infinity, as are the symbols to the right of the input....
I have some very simple doubt in definition of routing table, and would be thankful if anybody could clarify it. The doubt is that can the routing table of any node, say w, be smaller than the degree of w? In other words, to route packet from w to its neighbour, say y, is it required that there should be some entry cor...
In a traditional computer calculations are done with logic gates that check inputs with AND gates etc. But in a quantum computer, are calculations performed differently since the qubit can be in states other than 1 or 0? I understand that qubits can have values other than 1 and 0, however, before it is used as input in...
For an un-directed graph, how do I obtain all possible Minimum spanning trees? A graph is created with set of Vertices V, and set of edges E. In the below graph, we can see that there are two MSTs. I want to obtain all such MSTs (using any algorithm). I have currently tried to solve this using Kruskal's algorithm. But...
I'm reading CH Isomorphism. Let's divide into two stages: Prop corresponds to types. so a proposition A $\wedge$ B corresponds to type A $\times$ B. Proof corresponds to the program. What is the corresponding proof and program in this case ? As far as I can guess the proof is a pair but how we denote program ? Is...
In CH-I what the propositions A , B ranges over too ? An update : From Pfennings notes : "A denotes proposition about the mathematical objects such as integer or a real number." From : Per martin lof "On the meanings of logical constant" pdf cs.cmu.edu/~crary/819-f09/Martin-Lof83.pdf , 17-18 page "We may substitute ...
Shouldn't I post this question on mathematics.stackexchange.com? Let be an airlaine company which has to affect its aircrew to several flights. We group som flights in subset, every flights of a subset have to be realised by the same aircrew according to the actual possibilites and labour regulations. We provide a lis...
I am not sure how to approach this. L1 and L2 are using the same alphabet.
My competitive programming coach told me of a balanced binary tree used by a lot of Chinese competitors that has all the functions of any other balanced binary tree and is fully persistent and runs queries and updates in ${O(log^2N)}.$ What information is there on this tree, and does it go by a different, more popular ...
Preliminary definitions Barendregt [2004] introduces the following two definitions of substitution and their equivalence: Ottamnn variable convention (p. 26) 2.1.13. Ottamnn variable convention. If $M_1, ..., M_n$ occur in a certain mathematical context (e.g. definition, proof), then in these terms all bound variable...
I am working on a project where I need to be able to compute the maximum flow between two nodes in a graph after one of the edge weights has been incremented or decremented by 1. The graph is directed and edge weights are all integers. I can find the maximum flow the first time, by Ford-Fulkerson's algorithm or some va...
Let $R \in REG$. Is it true that if $F\cap R \in REG$ and $F \cap \overline{R} \in REG$ then $F \in REG$? I took $R = \Sigma^{\ast}$ and because $F\cap R \in REG$, $F$ must be regular. Is this the right approach?
I noticed that AND, OR, NOT those three logic gates are Functionally Complete, it means I can represent any trues table only by those three gates. A Turing machine may halt or not in a particular input but a combinational(not sequential) logic circuit always gives an output in a particular input. You may not agree with...
I'm taking online compilers course. It's long ended, so it wouldn't be cheating to ask a question on quiz here. Let $S_i$ be the string consisting of $i$ 0's followed by $2i$ 1's. Define the language $L_n = \{ S_i | 1 \leq i \leq n \}$. For example, $L_3 = \{\, 011,\, 001111,\, 000111111\; \}$ For any given $n$, what ...
If a NFA contains N states, then Equivalent DFA can have atmost $2^N$ states. Is there any method or any concept to know, how many final and non-final states will be there in the equivalent DFA ? Take for example : An NFA has 7 states out of which 3 are final states. Its equivalent DFA can have atmost 128 states. Then ...
I'm trying to prove that there exists an undecidable subset of {1}* by showing a one-to-one correspondence between it and {0, 1}* (which would imply a one-to-one correspondence between their power sets), but I'm struggling with how to do the one-to-one mapping. Isn't it just surjective? That is, there's one unary repre...
I want to build an expert system for analyzing the personality of a number of people and then distribute them in groups , each group will have members with different personalities. I have been reading about ES a lot but I still confused , does rule-based system enough to build the system, or do I have to use matching ...
Given this definitions about Types and Type systems : Types are described by means of a language of type expressions: Basic or primitive types: Bool, Char, Int, ... Type variables: a, b, c, ... Type constructors: → (function), × (tuple), [ ] (list), ... Rules to build type expressions: τ ::= Bool | Char | Int | ···...
Self-play seems to be very important for reinforcement learning algorithms. Can we train reinforcement learning algorithms without self-play (or learn mostly from past experiences)? For example, let's say that I want to build a TRPG AI, which involves natural language and physical interaction between heterogeneous play...
I am reading both recursive and non-recursive using stack methods to implement inorder, preorder and postorder traversal of a binary tree at https://en.wikipedia.org/wiki/Tree_traversal#Depth-first_search_2, which I also copied below. What confuses me most is that I find the non-recursive implementations using stacks...
The tag sampling tells me that, Creating samples from a well-specified population using a probabilistic method and/or producing random numbers from a specified distribution. Now, the question becomes: what is population then? Suppose, I am implementing a classifier. I have a set of training data in the file trai...
The report referred in the title is the following: A Block-sorting Lossless Data Compression Algorithm, by M. Burrows and D.J. Wheeler, SRC Research Report, 1994 The step I do not understand is step D3, on page 4: for each i = 0, ... , N - 1: S[N - 1 - i] = L[T^i[I]] Question is: why does this work, i.e. why does thi...
Well, it's not exactly a queue if it allows for random reads. This question is about a data structure which behaves like a queue for insertions and a sorted dictionary for reads. Imagine an algorithm that maintains a list of elements so that: It reads an element from the list based on its key. It then inserts that ele...
My recent question on Programming Puzzles and Code Golf got some fair attention and showed that not only it is very easy to output $10^{100}$ symbols and halt, but actually quite convenient in many programming languages as well. While posting it I was wondering whether I should ask for $10^{10^{100}}$ instead but decid...
Title pretty much states the question, I was looking for some assistance with the following: You are given a search string and a magazine. You seek to generate all the characters in a search string by cutting them out form the magazine. Give an algorithm to efficiently determine whether a magazine contains all the lett...