instruction
stringlengths
35
29.1k
I've been thinking about pi and Kolmogorov complexity (Kc). As the digits of pi are randomly distributed (and infinite) , they can't be compressed with a typical compression program. Through the prism of Kc, it would seem that a generating program (e.g. Gauss-Legendre algorithm) is much smaller than the output seque...
I'm curious on how to type a dependent pattern matching in a functional language. What should the rule for typing match e with | C_1 a_1_1 a_1_2 ... a_1_n1 -> e_1 | C_2 a_2_1 a_2_2 ... a_2_n1 -> e_2 | ... | C_m a_m_1 a_m_2 ... a_m_nm -> e_m end be, where e is of type T, which has constructors C_i for each i. I think t...
I have a human body point cloud taken through a Kinect (v1). Now, I want to segment the point cloud into different parts, namely hands, lower arms, upper arms, torso, upper legs, lower legs, feet and head. Here's the method I'm currently using: I get the approximate skeleton from the point cloud using OpenNI I take t...
The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently. P1() { C = B - 1; B = 2 * C; } P2(){ D = 2 * B; B = D - 1; } The set of distinct values that B can possibly take is ? My understanding: Say P1 executes first , then B=2, after that ...
I'm currently studying fast-forward multi-layer neural networks with back propagation, in the book I see that all query and target vectors are binary-encoded, this makes me believe that this is the only allowed encoding, yet all other neurons in the hidden layers and output layer can take on any real value between 0 an...
I had an interview question once which asked for an algorithm to ensure a Roomba vacuum cleaner visited/vacuumed every "cell" in an unknown shape/size room with unknown obstacles. Depth first search can do this, but I was left wondering if you could minimize the backtracking. I looked into how it's actually done for Ro...
We have two sorted arrays of integers. Without using additional memory we need to merge these two arrays such that the smallest numbers are in the 1st array and the remaining numbers are in the second array. For instance, if your two arrays are $A=[1,3,9,14]$ and $B=[2,4,15]$, the result should be $A=[1,2,3,4], B=[9,1...
A subnet mask in class C can have _______ 1s with the remaining bits 0s. MyApproach: Class C subnet is 255.255.255.0.So, accordingly it has 9 1s on first byte,9 1s on second byte and 9 1s on third byte.etcSo total 27 1s but the Ans is 25 @Edit For 255 it has 8 1s on first byte,8 1s on second and 8 1s on third.=24 Ho...
Polynomial identity testing is the standard example of a problem known to be in co-RP but not known to be in P. Over arithmetic circuits, it does indeed seem hard, since the degree of the polynomial can be made exponentially large by repeated squaring. This question addresses the issue of how to work around this and ke...
Our college would like to determine if a transcript contains classes that satisfy every general education requirement. What makes this nontrivial is that while a single class may in theory satisfy multiple graduation requirements (e.g., writing, quantitative literacy, and art), each class may only count for up to two g...
I have a $2 \times n$ matrix of positive integers, where the elements are denoted by $a_{ij}$ for all $i$ in the set $\{1,2\}$ and for all $j$ in the set $\{1,\ldots,n\}$. I would like to select a subset $S$ of the columns that maximizes the ratio $$\left(\sum_{j\in S}a_{1j}\right) / \left(\sum_{j\in S}a_{2j}\right)\,....
Every single online resource I've looked up on Akra-Bazzi method appears to skip over the same step: They say you have to solve for $p$ without explaining how. If you look up the various PDFs and webpages online, they all basically say "Here's the equation. Solve for $p$. It equals (whatever). Moving on now to the inte...
I'm currently studying for an AI computer-science course. One thing is difficult for me to grasp and somewhat vaguely explained in my course-material: I understand that with search-methods like e.g. beam search, hill-climbing... you can search based on a certain knowledge about the problem which can tell you in each st...
If two people are lost in a maze, is there an algorithm that they can both use to find each other without having previously agreed what algorithm they will be using? I think there are some characteristics that this algorithm will have: Each person must be able to derive it using logic that makes no assumptions about w...
$\Delta_2^P =P^{NP}$, is the set of all languages decidable by a polynomial Turing machine with access to a SAT oracle. I came across a definition of $\Delta_2^P$ as the set of all languages $L$ such that there exists $L_1\in NP, L_2\in coNP$ where $L=L_1\cap L_2$. I'm trying to prove that a language in $P^{NP}$ can b...
I was wondering if there was a method that can be used to generate a Regular Expression for a language. Take the Language $L$ as an example where: $L= \{w \in \{0, 1\}^{\ast} \mid \text{length of } w \text{ is a multiple of } 2 \text{ or } 3\}.$ Can you show the step by step method to make the RE for this language? Che...
I was learning converting DFA to regex. I came across Arden's method which solve given DFA as follows: Ardens method Let us form the equations $q_1 = q_10 + q_30 + є$ $q_2 = q_11 + q_21 + q_31$ $q_3 = q_20$ Solving the eq_uations $q_2 = q_11 + q_21 + (q_20)1 = q_11 + q_2(1 + 01)$ $q_2 = q_11 (1 + 01)^*$ So, $q_1 = q_1...
I recently learned about the rolling hash data structure, and basically one of its prime uses to searching for a substring within a string. Here are some advantages that I noticed: Comparing two strings can be expensive so this should be avoided if possible Hashing the strings and comparing the hashes is generally muc...
i think that it's true that AM is contained in $\Pi_2$ but I'm not sure how to prove it. How do I prove that $AM \subseteq \Pi_2$?
Take a group filled with an arbitrary number of random integers. Is there any way of finding out whether it is possible for the sum of the integers can equal a certain number, with the condition that any of the integers can (but do not have to) be multiplied by 0 or -1? The only possible solution I could think of was t...
I'm interested in how you might detect similarities in tree structures. For example, in these three JSON documents; (a) { name="foo", length=23 } (b) { name="boo", length=99, redundant=true } (c) { quux="baz", a=44, b=66, c=99 } it's obvious to the human eye that (a) and (b) are more similar, in content and stru...
I am reading about agent logics and especially affective agents. There are BDI logics and combination of logics called KARO framework that considers those questions. All those logics seem to be specified and evaluated rather completely - so - are there implementation of this logics as solver or reasoner software. If th...
I am studying for a test in Logic right now, and saw the symbol $\underset{x}{=}$, which is used like this: $I \underset{x}{=} I'$. I've seen it in the solutions of questions like this one: Prove that $\lnot \exists E \mathrel{=\!\!\!|} \forall x \lnot E$. The theme is 'Satisfiability'. There is an exercise in which...
I've recently been working on creating a neural network to classify handwritten digits. I implemented 1-of-N encoding such that there are the same number of output nodes as possible digits (The expected output is 0 for all digits' nodes except for the digit that was inputted, which would be 1). Because this is a classi...
If linear programming suggests that we need $2.5$ trucks to deliver goods, why can't we round up and say $3$ trucks are needed? If linear programming suggests we can afford only $3.7$ workers, then why can't we just round down to $3$ workers? When can we not use this rounding technique?
While tracing the history of the BREAK and CONTINUE statements found in popular languages, I ran into a dead end right around ALGOL. Algol _? -> CPL -> BCPL -> C -> C++ -> Java -> JavaScript What was the first programming language to introduce the feature of being able to break out of a loop from the body? This feature...
I have a question in Logic: If I am asked to construct a formula, using the '=' predicate, that shows that there are exactly n objects, I need to show that there are no n+1 objects, right? For example, to show that there are exactly 3 objects, I will show that there are no 4 objects. Also, I need to show that there exi...
I have a requirement to reduce the size of the request / response XML by compressing repetitive productID data in compatible tag. My request / response xml looks something like below <products> <id> 2XZ </id> <compatible> 2TR,07N,2TS,082,084,2TT,2TU,2TV,2TW,2TX,2TY,2TZ,2U0,2U1,2U2,2U3,2U4,081,083,2U5,...
How can I prove whether irregular languages are infinite? I thought about proving it by the definition of regular language but got stuck.
I'm interested in the way artists use lines to indicate shape in drawings. Strictly speaking, my question is about human vision — how our brains interpret certain lines — but I'm asking it here because those working in shape perception might be able to suggest an answer. It concerns what my visual system thinks it's se...
I am reviewing some old papers for a final tomorrow, and there is a question that I'm not sure about. If a language A is Turing-Recognizable and Undecidable, what can be said of the Turing-Machine that recognizes the complement of A? To my understanding this turing machines accept states, are all those that were of t...
The protocol is defined here, but I'll give a summary here. Okay, so a number of agents want a certain public good to be constructed (a public good is something like a book, a program, or a statue, something that can optionally benefit everyone once constructed.) It costs $P$ to construct this good. The agents each giv...
From this main picture explaining how skip lists work from Wikipedia, we see that some nodes carry different amounts of pointers to other parts of the list: Wouldn't it make more sense to have every node carry 4 pointers (since this is the height of this specific example)? For instance, node with value 2 would also ha...
I need a structure that resembles an RSS feed of items, but each item is on a different network machine. Users cannot insert in the middle of the feed but only at its head. Deletions are possible. The first idea was to implement a basic linked-list where each item of the list is an RSS item. Being on the network, this...
Suppose you're given the list of $2^{2n}$ complex coefficients defining the state of a $2n$ qubit register. You want to compute the $2^n \times 2^n$ density matrix of the first $n$ qubits. Is it possible to compute the result in $O(4^n)$ time? That would be optimal, since the output has size $\Theta(4^n)$. It's easy to...
If I want to represent all the base 10 integers that are multiples of 9 as a language how do I do so? Alphabets are finite sets.
Suppose $q_0$ is the start state, does this mean that if it's the accept state, then the machine must accept the empty string since it cannot have a transition with the empty string?
I made the following (ungolfed) Haskell program for the code golf challenge of computing the first $n$ values of A229037. This is my proposed solution to compute the $n$th value: a n | n<1 = 0 | n<3 = 1 | otherwise = head (goods n) goods n = [x | x <- [1..], isGood x n] isGood x n = and [ x - ...
While reading Sipser, in computability I read about many to one mapping reducibility and Turing reducibility,the latter one being a more general form of reducibility. But in the introductory chapter about complexity, where the book shows examples of NP-Complete problems,the polynomial reductions used are only many to o...
If i have a graph $G=(V,E)$, a subset of vertices $S \subset V$ and a second set of vertices $S' \subset (V\setminus S)$, what is the best way to find the shortest path connecting the two sets? That is, we are looking for a shortest path among all $S$-$S'$ paths. We can also assume all edge weights are positive. Here i...
I am study this paper "Relating Proof Complexity Measures and Practical Hardness of SAT". Here the authors propose to use pebble formulas to find a relation between these and practical SAT performances using as measure the space of resolution. My question is is it to possible to extend that relation beyond of pebble fo...
I have a matrix of size $N \cdot M$ filled with integer values $A[i][j]$. I want to choose some numbers so that their sum is maximal. But there is one very important constraint. If I choose numbers in the $i$-th row from interval $[a, b]$, then I have to also take the interval $[\max(1, a - 1), \min(b + 1, M)]$ in the ...
I have a K-Map and I need to figure out which expression isn't equivalent to the provided K-Map. $f(w,x,y,z) = \sum(3,7,9,11,13,15) + \Phi(4,5,6)$ We know that both options (a) and (b) are equivalent, and both represent the K-Map's function. Option (c) however, turns to $(x)(x+w)$ if we make a subcube of size 8 using...
Let there be a (unsymmetric, directed, weighted) graph ( $\mathbb{G}$, capacity $m$ ) and an array ( $\mathbb{A}$, fixed capacity $n$) of objects ($m>>n$). The array contains references to a number of vertices. The problem is to pick a single vertex ($\mathbb{V}$) from the graph, that is not in the array, fulfilling th...
I am studying Brandes' betweenness algorithm for weighted undirected graph. I am not sure that, in Algorithm 1 (which is based on Dijkstra's shortest path algorithm), If a node is first encountered, then we have to check d[neighbor_node] < 0. But if not, do we have to check d[neighbor_node] > d[current] + length(curr...
Both virtual memory and job pools store the processes temporarily on disk and bring them to memory at some later stage, so what is the actual difference in between them? What I guess is that when a process is just created, it first goes to the job pool and then it is sent to the ready queue. Virtual memory is only used...
How to find the longest (in terms of sum of weights) simple path with at most $k$ edges in a tree? Weights of edges are integers, so they can be negative. I thought about using Bellman-Ford, but it would take too much time. Is there any faster algorithm than $O(V \cdot E)$?
Let $p \colon \mathbb{R}_{\geq 0} \rightarrow \mathbb{R}_{\geq 0}$ be a one-dimensional function that fulfills $p(0)=0$. Moreover, we are given some value $u \in \mathbb{R}_{> 0}$ such that $p$ is strictly convex, increasing, and continuous on the interval $[0,u]$. Assume that we can compute $p(x)$ on $[0,u]$ and the i...
I have a quick question. The maximum matching problem is an easy problem but not a trivial one. I was wondering that if the bipartite graph was complete, is it a trivial problem? I think we can just select an arbitrary edge $\{u,v\}$ and remove the vertices $u$ and $v$ from the graph and continue until there is no vert...
The best known algorithm(s) for matrix multiplication of $n$-dimensional matrices take $O(n^{2.37})$ time. However, that's for matrices with totally independent contents. When the two matrices are related to each other in some known way, it's sometimes possible to get a speedup. For example, computing $U \cdot V$ is qu...
Anybody could let me know what exactly the PDT is and where does it come from? it comes from predictive modeling or decision tress? I read some articles and websites like: this and this but both of them are about predictive modeling. I think PDT comes from decision tree rather than predictive modeling.
While solving Recurrences of type $T\left ( n \right ) = a\cdot T(\frac{n}{b})+c$ using the recursion tree method, number of levels in the recursion tree is equal to $\log_{b}n$ when $b$ is a constant. But when $b$ is dependent on $n$, can we say that number of levels are still $\log_{b}n$? For example, in $T\left ( n ...
What's the difference between generative and transformative algorithms in relation to algorithmic composition of music? As I understand the basic idea of the algorithms themselves, generative uses past candidate values (output becomes input) as progenitors (parents) for the next output, i.e. by combining them under cer...
I have data stored in N-dimensional matrixes (i.e. Arrays nested N layers deep). Is there a good standard solution - other than brute force - to the following two problems I want to swap 2 dimensions for each other e.g. a 6 x 5 x 4 x 3 matrix will become a 6 x 4 x 5 x 3 matrix I want to raise a dimension to being the...
A language $L$ is regular if and only if it is definiable by a sentence in monadic second order logic (MSO) over strings (J.R. Buchi, Weak second-order arithmetic and Finite automata; Z. Math. Logik Grundlagen Math. 6 (1960) 66-92). Are there proofs of non-regularity of a language $L$ (e.g. $L = \{ a^n b^n \}$) that ...
When I talked with students about pseudo-random number generation, I mentioned that you should not blindly use subsequent outputs of a pseudo-random number generator (PRNG) to form tuples as they may not be uniformly random then; a famous example is RANDU. The natural follow-up question is: what do you do? I can imagin...
I am trying to prove that with language L, (L^R) ^R =L So that the reversal of the reversal of the language is the original language L. I have proved that before with a string not language (let's call it a string 's'). (s^R)^R = s. Proof by induction on the length of s. Base: |s|=0. s=ε. (s^R)^R =(ε^R)^R =(ε)^R =ε=w. ...
I have an optimization problem in which I need to sum pixel values in an image over a rectangular region. This is a core component of the optimization so it will be done often and the naive solution is not fast enough. The region can be rotated arbitrarily so that I can't use an integral image; integral images only wo...
I'm curious about the general question of whether any combinatorial optimization problem with polynomial time solution can necessarily be reformulated as minimizing a submodular function. The answer is probably negative. But my problem at hand is simply the shortest path problem. Consider a graphical model with two var...
I have recently discovered term rewriting when I watched this video - https://channel9.msdn.com/Series/Beckman-Meijer-Overdrive/Beckman-Meijer-Overdrive-The-Lambda-Calculus-and-Food-Nutrition It seems that term rewriting is a generalization of which lambda calculus is an instance. A couple of the programming languages...
Is it possible for Heapsort to work in time $o(n\log n)$ on certain inputs? For example in case of Insertion sort it is possible, however when it comes to Quickssort it is not possible. What about Heapsort? I tried to find an input array such that Heapsort will be working in $o(n\log n)$. I ask you is it possible? Som...
Let's consider these four function types : Polynomial, Exponential, Logarithmic and Trigonometric. Considering that both input and output values are floating point numbers. How do they rank in terms of time complexity (of computing an output value for a given input value) ?
Ok, I've been told for years that during the old days, a program written on a certain machine would run only on that machine but now, programs run on multiple types of computers. What does this really mean? I mean, does it mean that programs were written for certain instruction sets of the processor and would not run ...
If two languages L1 and L2 both are reducible to each other in polynomial time then which of the following is false? A L1 is decidable and L2 is undecidable. B L1 is recursive and l2 is RE C both D none of these I know that both need to belong to NP or NP hard if they are reducible to each other. simply solving ...
Let f(n) = Ω(n), and g(n) = O(f(n)).Then g(n) = _______. I thought of it this way, since f(n) is Ω(n),then f(n) belongs to the set of functions defined by Ω(n), ie,{n,$n^2$,$n^3$ ....}. So g(n) will change accordingly , ie , g(n) will be of complexity O(n),O($n^2$),O($n^3$) ...etc. Is it correct to directly substitu...
Problem I want to implement an optimization algorithm for my file transfer program. The program buffers data in a local file before uploading to central server periodically and it compresses the files before transferring. I would want the program to intelligently predict the time and size thresholds before transferring...
In social network (an unweighted indirect network), is there some measure of importance of a person A on another person B, denote as I(A,B), so that (approximately): The smaller the shortest distance between A, B in the the network, the higher the I(A,B) (closeness) If A_1 is 1 of the 100 friends of B_1, A_2 is 1 of ...
What is the maximal difference between heights of leaves in an AVL tree? I am interested only in the asymptotic difference. I am not sure about my answer - I think that it is $O(\log n)$, given the fact that at every level we may have difference equal one. Am I right?
I'm currently reading introduction to algorithms and came by Johnson’s algorithm that depends on making sure that all paths are positive. the algo depends on finding a new weight function (w') that is positive for all edges and keeps the correctness of the shortest paths relations. It does so by calculating h(s), h(d) ...
I am reading this classic paper by Klein, Plotkin and Rao titled Excluded Minors, Network Decomposition and Multicommodity Flow. In section 3, Theorem 3.1, they define $\hat \ell(vw) = \lceil \ell(vw)/C\rceil$, where $C$ is the sum of capacities of edges, and $\ell: E \to \mathbb R^+$ is a length function. $dist_\ell(s...
I have an undirected simple graph and an integer x. My goal is to remove x edges from the graph so the largest connected component of the graph after the removal will be minimal. I tried to think how to solve this problem, and i thought maybe using Girvan-Newman algorithm for removing edges with highest Betweenness. Wo...
This is a homework question. Suppose the only accept state is the start state. My rationale for this is that L* is just the concatenations of L, so if all strings in L are accepted, then all strings in L* will be accepted as well. One problem I see with this is that a machine can only accept one language, so it might b...
To be specific, I am using the online website of Strait Times News. It limits users to 30 articles to read per month. I just do not understand how do they know you are accessing? We use different IP each time we go online, don't we? Is there anyway to hack this?
I have been taking a language theory class, and we learned about Brzozowski derivatives recently. At class it occurred to me that they could be used to implement a simple regular expression matcher. If you take the derivative of a regular expression with respect to a given string and the resulting expression matches th...
There is a graph with N vertices numbered from 1 to N. Edge between a and b exists if and only if a|b or b|a. If a|b then the weight of the edge is b/a. If b|a then the weight of the edge is a/b. Given two vertices u and v, I want to find the length of the shortest path between them. I think that the shortest path shou...
I was taught that if you can create a DFA to accept a language, then the grammar that is generating the language is regular. AND A DFA is a finite automata that accepts a language and also rejects the strings that aren't a part of the language. It says if we replace $x$ with $c$ where $c \in \{0,1\}^+$, then $L$ is reg...
In computational theory for deterministic finite automata, there is a 5-tuple representation containing $Q$, $\Sigma$, $\Delta$, $Q_0$ and $F$. I am wondering how one understands thinking about the number of states to construct such a DFA. Example: $$\{w \in\{0,1\}^*\mid w\text{ contains at least two $0$s but does not ...
I am programming CPU cache simulator and I am supposed to implement removing of entries. I will not use LRU but just random. I am not really clear, when should I call the removing function? When cache (2 or 4 caches) are full and CPU wants to write into cache where all (data and tag) of specific indexes are same? Are t...
I am learning the basics of the language C, and so far we have covered up to loops. This question is related to my assignment. The problem is I do not understand what the question is asking. I know the error in the code, but I don't understand what this question is asking me to do? What is an instance? Am I supposed to...
I have a set of nodes where each node $n_i$ is associated with a cartesian coordinate $\vec r_i$ and a radius $\sigma_i$. I want to generate a graph data structure where nodes $n_i$ and $n_j$ are connected by an undirected edge if $|r_{ij}| < \sigma_i + \sigma_j$. This is not my field and I am interested in efficient a...
I have to prove the following problem is in NP (and define verifier as well as the certificate/witness): The input is a set of $n$ boxes with weights $w_{1},\ldots,w_{n}$ and two numbers $s$ and $t$ (all natural numbers). Can the boxes be loaded onto $s$ trucks if each truck can only carry a total weight of $t$? Appa...
I have some arbitrary pairwise similarity metric for some objects, and I am considering trying to find the best way to position the objects onto a line segment such that the pairwise euclidean distances between points on the segment are best representative of the pairwise similarities between the objects. The applicati...
Given a set of $N$ jobs and two machines A and B, each machine can process only one job at a time. Each job, if processed, must be processed by machine A before processed by machine B. The processing time of job $i$ at machine A and B is $t_{i}^{A}$ and $t_{i}^{B}$ respectively. The deadline and the profit of job $i$ a...
Let $\Sigma = \{ \sigma_1 , ..., \sigma_t \}$ and let $S$ be a string from $\Sigma^*$. Denote: $n=|S|$, that is $S$ has $n$ letters. I'd like to find the shortest prefix $T$ of $S$ such that $S$ is a prefix of $T^n$ ($T^n= T \cdot .... \cdot T$, $n$ times). I tried to build the suffix tree for $S$, and then checking ea...
if I have an unsorted array with the length of $10^6$, which is filled with absolutely different float numbers, which sorting algorithm would be the best to use and why? And which one would be the worst? InsertionSort, QuickSort, MergeSort, HeapSort, BucketSort? And would it be a difference if the float values would be...
It is well-known that there is an asymptotic lower bound of $nlogn$ for comparison sorting. However, I am wondering what is the fastest known algorithm for comparison sorting, in terms of the multiplicative constant?
i came across a question with no proper explnation. IF A is reduced to B and B belongs to NPC then we cant say anything about A since it can be as harder a NPH and as easier as P. i know why it is as harder as NHP but i am not able to figure out about P class. according to me if A > B(A polynomial time reducible to B) ...
We can form DFA accepting binary numbers divisible by $n$. For example DFA accepting binary numbers divisible by 2 can be formed as follows: Similarly DFA accepting binary numbers divisible by 3 can be formed as follows: We can follow a well defined procedure to form these types of DFAs. However can there be any wel...
I have a problem I'm trying to answer for my homework. The question is: Let $p$ be a prime number and let $GF(p)$ denote the finite field of size $p$. Suppose that A has input $x∈GF(p)$ encoded with $⌈log2p⌉$ bits and B has input $y∈GF(p)$ encoded with $⌈log2p⌉$ bits. Let $f:GF(p)×GF(p)→\{0,1\}$ be the function defined...
Assume $X$ and $N$ are two sets of vectors (observations) from a normal distribution, where $X$ represents clean data and $N$ represents noise; and $A$ a projection matrix of a filter. The scenario is that our clean data was corrupted by a multiplicative noise via matrix $A$ and an additive noise of $N$: $$Y=A X + N.$...
I'm trying to solve a practice problem in Elements of Programming Interviews (19.4) and I am a bit confused. The question is to determine if an undirected connected graph is minimally connected. The authors define minimally connected as "it is connected and there is no edge that can be removed while still leaving th...
Let's say that you have an infinite grid of cells. A program is run per cell, where you have read access to some finite number of cells (for the previous state in time), but you only have write access to the specific cell you being run on (for the next state in time). The program reads cell data about the LAST state of...
I'm having some trouble with the following language: $L_1 = \{0^i1^j2^k3^m | i,j,k\ge 0,m = i+j+k\}$ with alphabet $A=\{0,1,2,3\}$ I'd like to find a deterministic pushdown automata to recognise it according to the empty stack criterion. I built the deterministic pushdown automata according to the final states criteri...
I read an interesting comment in a paper recently about how weirdly useful maths turns out to be. It mentions how polynomial time doesn't have to mean efficient in reality (e.g., $O(n^{999999999999999999999})$ is polynomial time, but not efficient). Yet, isn't it the case that all algorithms in polynomial time also hap...
How do I check wether a string is generated by given regular grammar? I know you can check for it in O(N), what is the algorithm called?
I am trying to learn NFA to DFA. This is the original image To begin the process of converting to DFA, I started off with the start state and noticed that if the input is a 1, this means it goes to qb, which would be represented as {qa qb}. I also think it would loop onto itself because if you have a 0 and are in that...
I am having trouble finding out what a primitive subset of the lambda calculus would look like. I reference primitive recursion as shown here: "https://en.wikipedia.org/wiki/Primitive_recursive_function". These are the three base axioms: Constant function: The 0-ary constant function 0 is primitive recursive. Successo...
Without using pumping lemma for deterministic context-free languages I need to prove that the language $\{u\colon |u| \text{ is odd and $b$ is in the middle}\}$ is not deterministic. Someone suggested me that I could try to deduce that if it were deterministic then the language $\{a^nb^nc^n\colon n\ge0\}$ would be cont...
I'm investigating different solutions for solving what looks like a decision making problem. Although the domain I'm working on is different, for the problem at hand, it's quite easy explaining with an example of online shopping cart. Suppose you have a shopping cart like you have in every online retailer but this one ...
After asking this question I was thinking about some variants of subset sum problem (SSP). The usual subset problem is the following. Instance: Given a set of $n$ integers and an integer $\sigma$. Question: Is there a non-empty subset that sums to $\sigma$? The three variants of subset sum that I thought about are (I...