instruction
stringlengths
35
29.1k
[Note: This problem was inspired by Pokemon Go. I will first explain the problem in mathematical terms, then explain the connection to Pokemon Go. My goal is not to cheat in the game. If I wanted to cheat, better information would be available more easily.] Suppose there are $N$ points (the "unknown points") in a plane...
I am working on building a toy automated theorem prover, What I want to do is to efficiently generate sentences in peano arithmetic, that I can attempt to verify as True/False/requires-more-resources in a higher model of logic. My first task I want to work on is to build a tool that can list out statements in PA So my ...
In the Art of Assembly ebook, I have read that 8088 processor require four clock cycle to access memory (in whatever clock speed & memory speed is). How is it calculated? Is it time for processor to prepare for calculate address and put data on the bus?
Consider a weighted undirected graph $G=(V,E)$ with $n$ nodes. We call $G$ a $(\tau,k,n)$-graph if for every node $v \in V$ has at least $k$ neighbors and each edge has weight at least $\tau$. Have these kind of graphs been studied in the literature in any context?
my question is about how to compute a database with initial moves for Connect Four, where each board constellation is classified as leading to a win, draw or lose. John Tromp already has done this for the standard 7x6 sized board (https://tromp.github.io/c4/c4.html) and all board configurations with 8 tiles. Since I'm...
I have an array of $n$ elements. Each element is basically the mean of gamma distribution and the actual value of the element is picked from that distribution. Assume the parameters of distribution (scale and shape) are different for different elements and not known. Now I wish to sort these means so that, after repla...
(from my class's slides) "NP and P/Poly both use an external string for computation. However, for L in NP, any witness is rejected if x $\notin$ L. For L in P/Poly, there can be bad advice!" I'm having a hard time understanding why this is true. My intuition is that if there are indeed 'bad advice', i.e advice that mak...
Suppose I am given a dictionary of words which contains no more than 100 words, and each word has a maximum length of 50 characters. I want to write a program to guess an unknown word, call it S, that is in the dictionary using 2 weighted operators: int getOccurrences(char x): return the frequency of the character 'x'...
In Extended Backus-Naur Form (EBNF) there is one form called a "special sequence" which is surrounded by questions marks ?...? What does this mean?
Given an undirected connected graph $G=(V,E)$ with positive weights, where $|V|>2009$, and each vertex is of degree of at most $10$. Give an efficient algorithm to find the $2009$ closest nodes to a given source vertex $s$ (with respect to edge weight). Is it correct to say that Dijkstra's algorithm with Fibonacci hea...
I will be teaching a data structures course this Fall semester for second year computer science undergraduates. The textbook and syllabus currently used follow the text "Schaum's outlines: Data structures with C" by Lipschutz. I think the Schaum's outlines series are more a supplement to textbooks and that the studen...
Given a sorted array A, the problem is to find a number that minimizes the sum of Manhattan distance to the numbers in the array. I found that the median of A is the solution, but was not able to come up for a proof or explanation for the same ( i.e why its not mean). Any help is highly appreciated.
We have a non directed, not necessarily connected graph $G=(V,E)$, that is represented by a adjacency list, and a weight function $w:E \to R$. All edges have distinct weight. An edge is "heavy" if there exists a simple cycle in $G$ that contains it, and it has the maximal weight in that cycle. The question is to give a...
I am reading this paper Handy AR. As suggested I am adding certain quotes from paper to get basic idea of what is it about : Intro In this paper, we present and evaluate a method to use a user’s bare outstretched hand in the same way a cardboard AR marker would be used, enabling spontaneous tangible user interf...
I am collecting data from a sensor over time, and I'm trying to figure out how to detect "events" in the data - specifically, when a given event begins and ends. The frequency, duration, and amplitude of these events varies. Rather than using some rules-based scheme that proves to be rather ineffective, I want to train...
I want to implement the clique detection algorithm by Nesetril and Poljak described in [1]. However, I can't seem to understand how the auxiliary graph $H$ is to be created and how it can be used to detect a clique. For instance, the paper suggests that to detect a clique of size $3\ell$ in a graph of size $n$, we cons...
I'm having trouble trying to create this machine. I know the answer should go in the way that we always cut in half the number of a's and b's (so the master theorem aplied at $T(n)=T(n/2)+O(n)$ gives us the requiered asymptotic order). But I don't know how to end the algorithm. My machine does this: We start with #aaaa...
Given an e-NFA. It is easy to find a string that is accepted by it. But, how do we find if the given e-NFA accepts "All" the strings over the alphabet. Or if there is a string that is not accepted by it. Of course the usual way is to construct a DFA, or complement the e-NFA but since we are talking about the whole lang...
What is the difference between a faulting and non-faulting software prefetch. I have read some material in Google but can't understand it deeply. How do we know if a software prefetch is faulting or non-faulting in practice?
I know quicksort to have a runtime of $\mathcal{O}(n \log_2 n)$ However trying to solve for it I get something different and I am not sure why that is. Ok, so solving recurrence relations can be done several different ways. The recurrence relation for quicksort is: $$T(n) = 2 T(\frac{n}{2}) + \mathcal{O}(n)$$ Reinserti...
(This exercise is from Computation Complexity: A Conceptual Perspective by Oded Goldreich): For any k $\in \mathbb{N}$, let $w_k$ denote the concatenation of all k-bit long strings (in lexicographic order) separated by *'s (i.e, $w_k = 0^{k-2}00*0^{k-2}01*0^{k-2}10*...*1^k$). Show that the set $S = \{w_k:k\in\mathbb{N}...
So I have a directed graph that looks something like: I'm trying to make an algorithm that can go through all the vertices and tell me whether we have any path from an upper case letter to its lowercase version, or a path from a lowercase letter to its upper case version. In the above example, we have a path from C to...
I'm interested in finding maximal solutions to the problem of finding a subset that "sums" to a specific value. The elements of the set are boolean vectors and the notion of "sum" is point-wise or. Say you had {10, 01, 00} then there are two subsets that sum to 11: {10, 01} and {10, 01, 00}. In particular, I want maxim...
By writing out a number in binary I can arrive at the value of taking the first x number of bits out of it. For example 00001101 (13) taking the first 6 bit would be 3 taking the first 5 bit would be 1 taking the first 4 bit would be 0 etc This results, I can easily ...
I am reading the book Neural Networks and Deep Learning by Micheal Nielsen. In the second chapter of his book, he describes the following algorithm for updating weights and biases for a neural network: In the 2nd step, the algorithm computes the error for a sample and backpropogates it through the layers. This happen...
I've done some other problems by reduction, but I'm quite stuck here. I'm not really sure what to do with $M'$. I know that because $L(M) \nsubseteq L(M')$ there exists $w \in L(M)$ and $w \notin L(M')$ and I'm trying to create the machine that ignores the input and accepts only when M accepts $w$, but I'm kinda stuck...
I'm in need of implementing the algorithm to actually locate the minimal vertex separators set of the whole graph (not just s-t). It is my understanding that this can be done by doing the s-t procedure for all possible vertex pairs and then looking at the minimal sets of vertex independent paths that arise from that. ...
Given a set $S$ of length $n$, I'm looking to map all the $k$-length partitions of $S$ onto the set of integers such that these integers are as close to 0 as possible. Ideally the range would be $\left[0, {n \brace k}\right)$. Ideally this mapping and its inverse would be easy to compute.
What is the height of an AVL Tree? I keep finding contradicting definitions. I found these two on wiki: Height of node: The height of a node is the number of edges on the longest path between that node and a leaf. Height of tree: The height of a tree is the height of its root node. But then I find examples like this: h...
I receive a list of real numbers ( float ) between $0$ and $1$. The list has length $N+1$ and I need to find two numbers on the list which are $\le \frac{1}{N}$ apart. Here is an example test case: [ 0. , 0.31662479, 0.63324958, 0.94987437, 0.26649916, 0.58312395, 0.89974874, 0.21637353, 0.53299832, ...
In A simplified NP-complete MAXSAT problem, a reduction is given from Min Vertex Cover to MAX-2SAT by replacing each each vertex $x_i$ by a single-variable clause, and each edge by a two-variable clause: \begin{align} \Phi = \left(\bigwedge_{i=1}^n x_i\right) \wedge \left(\bigwedge_{\lbrace i,j\rbrace \in E} (\overlin...
I am trying to understand the linear speedup theorem: Let $L$ be a decidable language. Let $X^L$ be the set of all deterministic Turing machines which decide $L$. For a word $x \in \Sigma^*$ define: $t^L(x) := \min_{M \in X^L} t_M(x)$ where $t_M(x)$ is the time of $M$ on input $x$. Now let's choose some machine $M$ whi...
Dynamic programming can only be applied to problems with optimal substructure. The Markov property (e.g. in Markov Decision Processes, MDPs) means that the distribution of one state $x_{k+1}$ only depends on the state directly before ($x_k$, and the action $a_k$), not on more steps before. (commonly expressed as $P(X_{...
I'm solving problem of drawing the finite automata of (1+0)*(10). Which is any string ends with 10. I've drawn the following diagram for this one: But somewhere in solution it is given the following diagram: I can't understand what is the difference between these two? Is my solution is correct? If it is not than what...
The question is stated in the title, I would like to see a counter example if there is any. Thanks.
I have an (undirected) graph isomorphic to $C_n$ with unordered edges/vertices in some data structure (in particular, a list of tuples representing the edges), etc. I was wondering what is the fastest algorithm to compute a path which begins and ends at some given node in the cycle, given this set of nodes? The simples...
Are there any special algorithms for maximum independent set of line graphs? Could this special case be in $\mathsf{P}$?
One of the conditions for A → α | β to be LL(1) grammar states that If β → ε in one or more steps then α doesn't derive any string beginning with a terminal in FOLLOW(A). Likewise If α → ε in one or more steps then β doesn't derive any string beginning with a terminal in FOLLOW(A). I couldn't understand what is the ...
I'm a mathematics undergraduate student (going to start my third year very soon). I'm trying to teach myself computational complexity. Sadly, there are no courses provided in my university on the topic and there are no specialists on it (In fact, it seems that my university has no specialists in theoretical CS at all)....
I would like to understand the ideas behind parity games and their winning conditions. Where do they come from?
I guess this is an implementation question, but I suppose it can be answered for the typical way this algorithm works. So, most ways the algorithm has been explained to me involve going from a source vertex to another vertex so on and so forth. Will any edges going back to the source vertex or any already visited verte...
In an informal context, most programmers might call these two expressions "equal" and no one would be mislead: (a + b) + c a + (b + c) For floating point numbers, we know that these two expressions are not strictly equivalent (in the sense that they evaluate to equal values for any a, b, and c) because floating point ...
I was wondering if, given an arbitrary cycle basis (that's complete, e.g. every cycle in the graph can be expressed as the $\mathbb{Z}/2\mathbb{Z}$ sum of elements from the basis) of some graph $G$, is there some way of sampling all cycles uniformly? I'm not able to find papers on it, and I was wondering if anyone had ...
Suppose I have a NN with one hidden layer, 10 inputs and 5 outputs, intended to be used as a (for example) game-bot AI. Would it make any sense to add, say, 5 (insert any number here) more inputs and outputs, and directly link these outputs from a previous step to these additional inputs of the next? I imagine it could...
I've implemented a lambda calculus evaluator and use the Hindley-Milner algorithm to infer terms types and ensure type correctness without the user having to explicitly annotate types. But now I'd like to add a typeof operator that given a term, it returns the type of the term. So far, what I do is keep a hash map of ...
I have been assigned a homework problem that I cannot figure out: Prove that SAT has a polynomial-time reduction to the language of undirected non-negative weighted graphs with simple cycle of weight less that or equal to w. This bears a resemblance to the all-pairs shortest path problem which has polynomial-time alg...
Show that after all edges are processed by CONNECTED-COMPONENTS, two vertices are in the same connected component if and only if they are in the same set. The CONNECTED-COMPONENTS algorithm is the following: It seems pretty obvious that when we keep adding the vertices of the direct edges of a connected component to a...
Let $X_*^L$ be the set of all deterministic Turing machines $M$ which decide the language $L$ and have the property: $\forall x,y \in \Sigma^*: t_M(xy) \ge t_M(x) + t_M(y)$ (**) where $t_M(w)$ is the time of $M$ on input $w$. Define for all $x,y\in \Sigma^*$: $d(x,y) := \max_{M \in X_*^L} \frac{|t_M(x) - t_M(y)|}{t_M(x...
Consider the following problem. Let $S=\{1,2,\dots,n\}$, and $A_{ij}\subseteq S$ for $i,j\in S$. Does there exist a strict subset $T\subset S$ such that for all $j\not\in T$, there exists $i\in T$ for which $T\subseteq A_{ij}$? (For $T=S$, this is trivially true, so we disallow it.) The problem is in NP: given a se...
Background I'm currently writing some Elixir algorithms that are quite computationally expensive. The most-used datastructure is a multi-set of (finite) integer ranges. Modifying this data structure takes up around 80% of the execution time in insert and remove, so it's time to see if there's something better out there...
Considering a DFA that has an alphabet of {A,B}, and where number of characters A > number of characters B. I don't think such a DFA is possible. Can I proof the impossibility with a Pumping Lemma?
I'm looking for an algorithm that, given a directed bipartite graph, builds another graph (possibly with additional vertices) that has fewer total edges but the same reachability patterns. In particular: The input to the algorithm is a bipartite directed graph $G'=(V,E)$ with all edges directed from $L$ to $R$ (where ...
I am having some confusion about finding the area of union of $n$ axis parallel rectangles in $O(n\log n)$ by the line sweep method. The following pictures are from the book of Shamos and Preparata. In this case one needs to find the total height of the shaded region efficiently. So initially build a segment tree with...
This is an exercice is Rolf Niedermeier's book "Invitation to fixed-parameter algorithms", Chapter 13. Show that the following problem is W[1]-hard: Steiner Tree in Graphs with respect to the parameter "number of non-terminal vertices". The way I understand it, if there are most $k$ non-terminal vertices, then this d...
I implemented an algorithm to find the minimum dominating set of a graph. I want to check the output of the algorithm against some graphs for which the domination number has been determined. Where can I find graphs with a known domination number?
I am looking for graphs which the value of a minimum dominating set is known (Where can I find a data set of graphs with known domination numbers?). So far I have not found anything, so perhaps I missed a search term. Does anybody know if dominating set goes by some other name?
Suppose I have a set of n ordered tuples, all of the same, fixed dimension. The tuples' values are integers, with #s indicating an integer I don't care about. For example: { (1,2,5), (4,2,3), (1,2,#), (#,2,3) } Tuples can be combined so long as they don't disagree about anything. For example, (1,2,#) and (#,2,3) c...
To most computer programs one can assign a "call graph". Is there a formal notion of call graphs of Turing machines? Motivation is, that one could intuitively call a decidable language $L$ "irreducible" if every Turing machine which decides $L$ has a "trivial call graph" (Trivial here intuitively means, that the machin...
I am having a problem with my program of deep neural network using Theano. In my deep neural network, I have several layers of neural network to predict an output given a certain input. Because of an issue when compiling theano, I have to debug my program step-by-step. Since Theano gives me an error when updating weigh...
$PH \subseteq PSPACE$. In order to prove it, one has to show that for a language $A \in \Sigma_k$ (for some $k \in \mathbb{N}$) there exists a turing machine $M_A$ that decides it in polynomial space. I am having a hard time understanding why this is true. I'll try to explain: Let's take for example $L \in\Sigma_2$: by...
I have a DAG with vertices $V$ and edges $E$. If $v,w \in V$ are vertices such that $v$ is not reachable from $w$ and $w$ is not reachable from $v$, I will say that $\langle v,w \rangle$ is an unreachable pair. I want to implement an efficient algorithm which takes this DAG as input, and produces as output a list of s...
A friend needs to find the pool balls in an image of a pool table. Would a Hough transform be a good idea? Why/why not? Would RANSAC be better? The question comes from this study guide (http://www.cc.gatech.edu/~afb/classes/CS4495-Spring2015-OMS/), is not homework, and I am not currently taking this class. What I know:...
Given an $M$x$N$ grid with some predefined sub-rectangles. How to divide the grid into a set of sub-rectangles, which contains the predefined sub-rectangles, so that its the number of elements is minimum and no sub-rectangle is overlapped ? Is there any reference to the problem and it's solutions ? Is the problem NP-Ha...
I have this function int fct (int Y){ int y = 0 ; for ( int i =0; i<Y;++ i ){ for ( int j=i ; j >=0;--j ){ y++; } } return y ; } I want to know the order of this function, I know that the first for loop its O(n), but I confused to ...
The idea is to take a sequence like $\langle 1,2,3,4 \rangle$ and reduce it to something like $\langle 1,2,2,3 \rangle$, or something similar. The key point is that there are fewer distinct values $\{1,2,3\}$ vs $\{1,2,3,4\}$. In the case that the number of distinct values cannot be reduced, i.e. $\langle 0,0,0,0 \rang...
I am trying to get an intuition for Heap's Algorithm which is used to generate permutations of a given set. What I can't understand is why if n is even the letter swapped is i and when n is odd the letter shifted is at position 0. I know it works but what is the intuition behind it ? How come when n is odd there is al...
For the master theorem for recurrences of the form $$T(n) = a\,T\!\left(\tfrac{n}{b}\right) + f(n)\,,$$ what difference would it make if the split was into calls of $\lceil n/b\rceil$ instead of $n/b$? My guess is that this would only allow splits that are natural numbers, and obviously you can't split into a non-integ...
More specifically: for any arbitrary CFG, is there guaranteed to exist two distinct strings such that a leftmost parse of both strings creates the same parse tree? If not, does there exist any CFG that has this property? I know that given a string and a CFG, there may be multiple leftmost parse trees for the same strin...
Inspired by this StackOverflow question, I am wondering if there is an efficient algorithm for the following problem: Assume $n$ items and $n$ boxes, with all boxes numbered numerically and all items labelled alphabetically. Each item has a disallow list: there are certain boxes that item cannot be put into. Generate ...
I want to calculate the order of this function, I calculated but I'm not sure if this right. This is the function int fct (int Y){ int y = 0 ; for ( int i =0; i<Y;++ i ){ for ( int j=i ; j >=0;--j ){ y++; } } return y ; } And this...
I have this practice problem that I was given. I am trying to solve a specific recurrence equation T(n) = 4 when n <= 2 T(n) = 3T(n/3) + 5 when n > 2 how would i go about to solve such a problem since I only really know how to solve Master Theorem and Divide and Conquer using the a and b but don't really know how to...
I want to find a reduction from Zero-One Integer Linear Programming problem to Boolean Satisfiability problem (SAT), that is, to find a polynomial-time transformation $T$, such that: $$IP \leq_P SAT$$ $$IP(in_{IP}) = 1 \iff SAT(T(in_{IP})) = 1$$ where $in_{IP}$ is an input for the IP problem and $T(in_{IP}) = in_{SAT}$...
If we have any arbitrary computer program that can modify its instructions, is it possible to simulate that program with a program that cannot modify its instructions? Edit: I am new to stackexchange so not sure if I'm allowed to ask a NEW question here, but here goes: Ok so the proof that it is possible is actually r...
I am trying to write a data-type not for a tree, but for the spaces in between the leaves of thee tree. In number theory (a part of math) this is known as a topograph does it have a name in CS?
I usually deal with traversal algorithms such as DFS and BFS, and I have to implement them iteratively. However, in case of DFS, one challenge is that the size of stack can be $O(n+m)$ in worst case. I was wondering if there is an iterative implementation of DFS that requires an $O(n)$ size stack instead of heavy $O(n+...
The term lower bound comes from math and applies to more than just complexity theory. What we see is that such and such is "a" lower bound. In complexity theory should this not be phrased as "the" lower bound, or better still the lowest bound. I can see where lower is a relative term, but the complexity of a given prob...
Consider an unrooted tree with integer edge weights. I'm looking for a linear space data structure which allows for constant time distance queries (finding the distance, i.e. the sum of edge weights, between any two vertices). Is this possible? If yes, how? I have an idea that it should be possible using some Lowest-Co...
"Show that if L is a regular language without the empty string, then the language in which the rightmost symbol of every string in is removed is also regular." I tried going by closure properties of regular languages but got nowhere.. I said L' = {x| y is in L and xa = y, for some a in the alphabet} and didn't really k...
When building the partial match table for KMP: void buildBackTable() { int i = 0, j = -1; b[0] = -1; while (i < m) { while (j >= 0 && P[i] != P[j]) j = b[j]; //Why is this a while loop!? i++; j++; b[i] = j; } } How come that second while loop is not a conditional instead? Such...
If I have a function that evaluates every pair of elements in a list, including pairs of an element with itself and with elements it has previously been evaluated against, the complexity of that function is, obviously, $O(n^2)$: for (let i=0; i < n; i++) { for (let j=0; j < n; j++) { // this line will be executed...
I'm trying to understand how the LSH works for Cosine Similarity metric. For instance, let's say you have $\vec{v} \in \mathbb{R}^d$ and the random vectors $\vec{r_{i}} \sim \mathcal{N}(0, 1)^d$ that will be used for the random projection. So, in LSH for Cosine Similarity, the define the hash function $h_i(\vec{v}) = 1...
Are there variants of hash tables that take advantage of the likely distribution of key values? For example, if I'm using utf-8 encoded unicode strings as identifiers in a compiler but expect the majority of them to fit into ASCII, can I optimize for that use case?
Why is it that every integer linear program has optimal solutions that are integers? At least in online text books, they are always integers. Can solutions of ILPs only be integers?
I gone through the Russel's paradox. From Wikipedia : According to naive set theory, any definable collection is a set. Let R be the set of all sets that are not members of themselves. If R is not a member of itself, then its definition dictates that it must contain itself, and if it contains itself, then it contradi...
Consider a problem $X$ can be reduced to 3-partition problem. So, when 3-partition has a solution then $X$ has a solution. But if 3-partition does not have a solution, they $X$ may or may not have a solution. In this case, is it legal to say that the problem $X$ is np-complete?
Given a weighted matroid with positive weights, we can find a independent set with a maximum weight with a greedy algorithm: Start with an empty set (by definition of matroid, it is independent). Add an element with maximum weight among all elements whose addition keeps the current set independent (if there are no suc...
I have Z specification of Banking system, whose fragments are: and I think that the specification is OK, but my professor says that this specifiction is completely wrong, because AddAccount operation allows to change the information about other clients (i.e. the information about accounts of other clients) and inform...
Let $L' \subseteq L \subseteq \Sigma^*$ be decidable languages with deterministic Turing machines $M'$ and $M$ which decide the languages. Typically we have $t_M(w) \le t_{M'}(w)$ for all $w \in \Sigma^*$, where $t_M(w)$ is the time of $M$ on input $w$. Suppose furthermore that $M$ and $M'$ have minimum length when in...
I'm trying to convert the following finite automata (DFA) to its corresponding regular expression using state elimination algorithm. For this I'm following this link. The answer of that question has following example. But in this sample automata, there is no state between the two looping transitions. For example th...
Could somebody please provide a step-through approach to solving the following problem using the Banker's Algorithm? A system contains 10 units of resource class Ru. The resource requirements of three user processes P1, P2 and P3 are as follows | P1 | P2 | P3 | Max Requirement | 8...
Here's Lamport’s fast mutual exclusion algorithm: want[i]:=true fast-lock:=i if slow-lock<>0 then want[i]:=false while (slow-lock<>0) {//busy wait} goto 1 slow-lock:=i if fast-lock <> i then want[i]:=false for j:=1 to n do: while (want[j] = true) {//busy wait} if slow-lock <> i then...
In which stage ( on an ideal 5-stage pipeline ) are branches and hazards handled? How much is the branch penalty for a branch hazard or data hazard. Is there different stages to find data hazards or branch hazards ( meaning for example branch hazards occurs on the 2th stage in the pipeline) or are all hazards detected ...
It seems that the general approach to a dynamic programming problem is to formulate a recurrence relation and then either implement a top down recursive solution or a bottom up iterative solution. But if there's a recurrence relation I think that means we could potentially represent the problem as a state vector and a...
Attributes of an attribute grammar can have a circular dependency. In my compiler construction course I learned, that there are two types of circularity for attribute grammars: full circularity can be checked in exponential time strong circularity can be checked in polynomial time Full circularity implies strong circ...
I hope that this question is clear, and not off-topic: I have been reading about neural networks (in the AI sense), and the textbook said that an artificial neural network can always be described by a single mathematical function (rather than by an "algorithm" in a register-machine, which is the standard way I intuitiv...
Can we use the term "black box" to speak about an algorithm which has a polynomial complexity but for which we don't know exactly how are made the calculations? In fact I would like to explain that we assume that an algorithm cannot be executed incrementally, i.e., having a part of the input, for instance the first 50%...
I'm solving some past job interview problems. I met an embarrassing question about compilers. The question is : Consider the following grammar, with start symbol $E$: \begin{align*} E &\rightarrow E \ast E\\ &\quad \mid E ~/~ E\\ &\quad \mid E + E\\ &\quad \mid E - E\\ &\quad \mid (E)\\ &\quad \mid a \mid b \mi...
I've been trying to solve an interesting problem created by one of my friends. The following is the problem statement: There are $n$ types of chocolates. $\langle a_1,a_2,a_3....a_n \rangle$ are positive integers which represent the number of chocolates of each type. These chocolates must be packed into boxes of capaci...
I was pondering about what are the numbers. It seems like a number is data type. I mean, like Maybe in Haskell. Because, for instance, one on its own means nothing for me. However, one apple tells me about how many apples does one talking about. Thus, numbers are quite abstract. If somebody asks you "how is it going" y...
$L^*$ is the kleene star of L. say we have a def: $L^*$ = $L^0$ U $L^1$ U $L^2$ U ... U $L^K$ then prove that: $L^*$ = $L$ if and only if $L$ = $L$ o $L$ how do i prove this?