instruction
stringlengths
35
29.1k
I have read Chater 17. Balanced Allocations and Cuckoo Hashing in Mitzenmacher. Upfal. Probability and Computing: Randomization and Probabilistic Techniques in Algorithms and Data Analysis and got stuck with a problem. We have $m$ elements and $n$ buckets. Each element is hashed into two random buckets (we assume that ...
Given only an n-dimensional hyperrectangle by its corner-point-values and an n-dimensional Predicate that corresponds to an arbitrary shape and tests whether a point is contained in said shape, is it possible to calculate whether the box intersects the shape?
I’m reading CLRS(Introduction to Algorithm, 3rd edition). In the chapter 32.1 about the naive string-matching algorithm, the book says the worst case running time is $\Theta(n^2)$ if $m = \lfloor \frac n2\rfloor$. I get that when $m$ equals $\frac n2$, but I don’t see it when $m$ is less than $\frac n2$. Any hint or su...
I'm trying to solve the shortest common supersequence with Genetic Algorithm. I found it a little bit hard to reduce the size of the chromosomes in each generation. I know that the maximum size of the chromosome is the total length of the strings. Even if we create a "naive" genetic algorithm: Totally random strings (w...
I was trying to learn Coq using the famous book Software Foundations. In it I found the following: Theorem mult_0_r : forall n:nat, n * 0 = 0. Proof. induction n as [| n IHn]. - simpl. reflexivity. - simpl. rewrite -> IHn. reflexivity. Qed. which I understand perfectly but find rather unintuitive. I understand...
I have been stuck on this sorting problem for a while now: Given an array of length N find the minimum number of shift operations in order to sort the array. A shift operation is defined as shifting a value in an array to another position. For this problem however, you can only perform this shift operation on the first...
In a bipartite graph $(X+Y,E)$, it is possible to find a minimum vertex cover in polynomial time, by Konig's theorem. Suppose the minimum size is $s$. Is there an efficient algorithm for finding a vertex cover $S$ of size $s$, such that $S\cap X$ has a minimum cardinality? What I could do so far is to formulate this pr...
In a flow network, suppose we add constraints of the following type: The flow entering a vertex $v$ must be at most the flow exiting a vertex $u$. Is maximum-flow with such constraints still solvable in polynomial time? Is it possible to reduce it to a standard maximum-flow problem? NOTE: I found a recent paper that ...
In wireless communication , I understand what it means to transmit a "bit" but I wanted to understand what exactly does it mean by a packet . *******POST EDIT/RECEIVING INITIAL ANSWERS******* I got the following question , which is also there in my comment , How to decide which bytes should form one packet of data ?...
In the pseudocode guide for my syllabus, an example of a record data type is given as below: TYPE Student DECLARE Surname : STRING DECLARE FirstName : STRING DECLARE DateOfBirth : DATE DECLARE YearGroup : INTEGER DECLARE FormGroup : CHAR ENDTYPE However, for enums and pointers it gives the followin...
In my Operating Systems class I have an exercise to sketch out how a round-robin algorithm would apply to a specific scenario, which is the following: Now the correction that I was provided with by the lecturer is the following: But I do not understand how this is correct. After referring to the lecture that was ...
I'm creating a powerful regular expression matching system that can be augmented by adding small microprograms to deterministic finite automaton (DFA) states. The microprogram solves the big bang issue where a rule of the form .*ab.*cd doubles the state count of the DFA. The solution for the "big bang" problem is to cr...
I was working through a textbook (Probability & Computing by Michael Mitzenmacher & Eli Upfal) and am not able to understand the following: Let $F(x)$ be given as a product $F(x) = \prod_{i=0}^{n} (x - a_i)$. Transforming $F(x)$ to its canonical form by consecutively multiplying the $i$th monomial with the product...
Today I learned about an abstract class of machines called linear bounded automata. It is intended to model real-world computers that have a limited amount of memory. I have always thought that real computers are DFAs due to the finite memory (but the DFA is a terribly poor abstraction). Is it possible to convert LBA i...
A line $\ell$ for a set $S$ of points is bisecting if the open halfspaces on either side of $\ell$ contain at most $\frac{|S|}{2}$ points. Now given point sets $A$ and $B$ in the plane, prove that we can always find a line $\ell$ such that $\ell$ bisects both $A$ and $B$ simultaneously. We can assume that no three poin...
Assuming we have a model of TM with an infinite number of states. The domain and range of the transition function are also infinite. Given a description of a TM $M$ and a string $w$ how can we use the new model to tell if $M$ ever stops when running on $w$?
How these two languages be regular.If there is comparison between m and n since (n < m) is the condition to be satisfied.
Given is an alphabet $\Sigma = \{ 0, 1, 2 \}$ and a function quer to calculate the cross sum of a word. $quer : \Sigma^*\to \Bbb N$ with: $$quer(w)=\begin{cases} 0, &\text{when } w=\epsilon\\ quer(v)+x, &\text{when } w=vx, x\in\Sigma \end{cases}$$ Where $\epsilon$ is the empty string. Prove by Induction on words that...
I'm wondering how to express the complexity of a brute force primality testing algorithm in the number of digits the number under test has. The brute force algorithm just checks whether $n$ is prime by checking if there is a number $k$ from $2 \leq k \leq \lfloor\sqrt{n}\rfloor$ that cleanly divides $n$. How would I go...
Context: Cubical Type Theory Consider a simple HIT, say, an HitInt: data HitInt : Set where pos : (n : ℕ) → HitInt neg : (n : ℕ) → HitInt posneg : pos 0 ≡ neg 0 Or, if you don't speak Agda we can use cubicaltt: data int = pos (n : nat) | neg (n : nat) | zeroP <i> [ (i = 0) -> pos zero ...
Suppose there are $n$ triangles on a 2D plane, which don't cross each other and have no common vertex. Suggest an algorithm that gets $n$ points and in $O(n \log n)$ determines the points that don't lie in any triangle. What if the triangles could overlap. I found some algorithms to determine if a point is inside a tri...
Wikipedia defines a Top type: (edited for readability) The Top type [...] is the universal supertype, as all other types in any given type system are subtypes of Top However, the article goes on to say: In C++: The pointer to void type can accept any non-function pointer, even though the void type itself is not the ...
Given a bipartite graph $G(X+Y,E)$, how can I find a non-empty subset $Y'\subseteq Y$, such that $|N(Y')| \leq |Y'|$ (where $N$ is the set of neighbors)? If $|Y|\geq |X|$ then the problem is easy - $Y'=Y$ satisfies the requirements. The interesting case is $|Y| < |X|$. In this case a solution might not exist, for exam...
It is well known that the the decision problem $w \in \mathcal{L}(M)$ for a DFA $M=(Q,\Sigma, \delta, q_0,F)$ is in $\mathcal{O}(|w|)$. To proof this we assume that the successor state computation can be done in $\mathcal{O}(1)$, for example with an array of size $Q \times \Sigma$. My question is: Is there a better way...
I'm confused about a point regarding the Time Hierarchy Theorem. In order to establish the upper bound for this theorem it's necessary to show the following: We're given $(\langle M \rangle, t)$ where $\langle M \rangle$ is the encoding of a Turing machine $M$ and $t$ is a natural number given in unary. Claim: one can...
Let G be a graph directed without circles. Suggest a method to find a minimum set of vertices So that all the vertices in the graph can be reached. I thought to run an SCC algorithm to find binding components and then return them. This is true? Or is there a better algorithm?
The Portable Executable file format is the format that Windows EXE files use. It is a binary format. Numbers are in little endian form. Thus, the following hex represents the decimal number 256, not 1. 00 01 Some fields in the file format represent text strings. For example, the "Name" field contains a null-terminated...
Let $\mathbb{F}_p$ be a prime finite field for $p > 2$. Consider two ternary quadratic forms $$Q_1\!: x^2 - a_1(t)y^2 - b_1(t)z^2,\\ Q_2\!: x^2 - a_2(t)y^2 - b_2(t)z^2$$ over the field $\mathbb{F}_p(t)$ of rational functions with coefficients from $\mathbb{F}_p$. For simplicity let $a_1, a_2, b_1, b_2 \in \mathbb{F}_...
Why is packet delivery time equal to transmission time + propagation delay, and not equal to 2*(transmission time) + propagation delay? At the end of packet delivery time, doesn't that mean that those bits haven't been received?
I am building a lambda applicator in Java, and I have uncovered a bit of misunderstanding. Either my question at the bottom is what I am asking, or something in the build-up below is wrong. Either way, I'd appreciate any insight. So, NOT can be defined as λb.b (λxy.y) (λuv.u) If we allow A1 = λb.b B1 = (λxy.y) C1 =...
Managed code needs to be be interpreted or JIT-ed at runtime. At first glance it seems to me that in general it is more energy consuming to interpret/compile the program on every user's computer than to compile it once and distribute binary code that can be run without any further processing... So does that make compil...
I have created a context-free grammar $$ \begin{align*} &S \to S_1 \mid S_2 \\ &S_1 \to aS_3bS_4 \mid \epsilon \\ &S_2 \to bS_4 \\ &S_3 \to aS_3 \mid \epsilon \\ &S_4 \to aS_4 \mid bS_4 \mid \epsilon \end{align*} $$ for this regular expression $ (aa^*b(a \cup b)^*) \cup (b(a \cup b)^*) $ Is the grammar correct or am I ...
Provan and Ball [1] showed that the problem of counting the number of minimum st cuts is #P-Complete. What is known about the problem of approximating the number of min st cuts? Is it possible to get a Fully Polynomial Randomized Approximation Scheme for it? [1] Provan, J. Scott, and Michael O. Ball. "The complexity of...
I came across a statement in my book which claims that the problem P1 in NP-C and P2 is P. P1: Given graph G(V, E), find out whether there exists an independent set of size k in the graph, where k is any positive integer. P2: Given graph G(V, E), find out whether there exists an independent set of size 5 in the graph. ...
Given is a language $A = \{ a^n\:b\:c^{2n}\:b^m |\; n ∈ N^{+} ;\; m ∈ N \}$ ; where $N^{+}$ are the natural numbers excluding 0. I have found a type-1 grammar to describe it: $S \to A_1A_2$ $A_1 \to aA_1cc \;| \; abcc$ $A2 \to bA_2 \; |\; \epsilon$ However, this doesn't tell me much about the language's Chomsky typ...
I encountered an algorithm to solve a real world problem, and I remember a class I took where I made something very similar for some for a homework problem. Basically it's a plot of points, and the lines are drawn to be equidistant between two points. It forms a perfect partition where the lines around the point form ...
Given a directed weighted graph, we need to mark all edges (represented by an ordered triple of (source,destination,weight) ) which lie on some shortest path from source to destination (there could be more than one shortest path); I know that it can be done by running Dijkstra two times, first from source and another ...
When 54 bytes of data is transferred using the UDP protocol, the efficiency is? (In per cent) IN UDP, the maximum datagram size can be $2^{16}-1 \, bytes$ Now to this, 8 Bytes of UDP header is included and this together must fit within $65535\, bytes$ IPv4 packet limit(Including 20B IP Header size). So, maximum data th...
I am not able to understand how to write a recurrence relation for n queen problem. I searched on web and everywhere it was given directly without explaining how can we arrive to that. Recurrence relation is for n*n board $T(n)=n*T(n-1)+O(n^2)$ but think it should be $T(n)=T(n-1)+O(n^2)$ as if we put the queen anywhe...
I currently have an undirected weighted graph. I am trying to find a good algorithm for learning/finding a cluster of closely related nodes and/or loosely relationship within a cluster in a graph given a size of the cluster. For example, here the longer edges represent the farther relationship between 2 nodes. We ident...
I have some questions about the PUMPING LEMMA. First of all, I do not study computer science, I still go to school, but I'm very interested, so I could make mistakes. And sorry about my English :) Now my questions. What is the easiest way to find a word, to start the Pumping Lemma? Are there some tricks I have to know?...
The problem I'm trying to solve is difficult to to give a single name, but I'll call it the ordered decision tree problem. Imagine a row of commands: A -> Perform X B -> Perform Y C -> Perform Z You read the above as if the data you're looking at is A, perform X, else if it's B, perform Y ... Now let me add more log...
Suppose I have an NP problem, $\text{PROBLEM}(n)$, such that for certain values of $n$ I can get a reduction from vertex cover with $n$ vertices, and for others such a reduction is not possible (if $\mathbf{P}\neq\mathbf{NP}$). More precisely, there exists an infinite set $M\subseteq\mathbb{N}$ such that for $m\in M$ w...
I am trying to find an algorithm to determine whether a $N\times N$ matrix of ones and zeroes could have a sublist of ones, such that in that sublist we have only one $1$ from each row or column.
I have a set S of (key, value) pairs and a large number of subsets of S. I'm looking for a data structure that would efficiently execute the following operations : Add a (key, value) pair to S and to a collection of subsets. Delete a (key, value) pair from a collection of subsets containing this pair (not all of them...
I have to determine the Optimal Multiplication Order for above matrices using Dynamic Programming approach and also present that sequence (i.e. optimal order) in Binary Tree. Consider the following five matrices A, B, C, D and E along with their dimensions; A=(6×5) B=(5×1) C=(1×7) D=(7×4) E=(4×2) Af...
The memory that stores the input is called the input memory. The memory that an algorithm additionally occupies during the computation is called the working memory. $\textit{Model of Computations}$ Word RAM : This a very well known model of computation. Read-only word RAM: Where input memory is assumed to be read-only...
1) I need to determine recursion tree depth for strings composed of 10, 100 and 1000 elements when using merge sort. For the 10 elements one/I can do it on a paper, just drawing tree, but what about 100 or 1000 elements? How do I determine recursion tree depth for them? Is there any pattern that I cannot see? What if s...
In a computer, the processor executes different threads and changes between them, the operating system is a program at the end that it´s being executed by the processor, there exists the posibility that the processor is not executing the code of the operating system, if there is, shouldn´t this cause problems with the ...
If I were to pose the question: "Given a program $P$ containing statement $X$, will $X$ be executed (given enough runs with all possible inputs)?" This strikes me of being a relative of the Halting Problem, but I just don't know the taxonomy here. What is the name of this problem, or does it not have a name because it ...
I am working on file formats conversion. Some of them can be converted back and forth to others without losing any information (fields or precision of the numbers encoded), others file format do not take into account some data or meta-data or use approximated values. I was looking for a term to describe the first case...
I know that decidable problem: has both counting (bijection with $\mathbb N $) and membership algorithm (TM halts for both member and non member strings ) semidecidable problem: has counting algorithm and TM halts for member strings countable problem: has only counting algorithm Now I have come across undecidable lan...
Are hashing algorithms constructed to guarantee that no fixed point exists? My assumption is not, because I don’t see what utility that would have. (Please correct me if I’m wrong.) As such, purely for curiosity’s sake, have any fixed points of common algorithms (e.g., MD5, SHA-256, etc.) been found?
I have this algorithm taken out from the Manual of Algorithms Analysis: function pesky (n) r:=0 for i:=1 to n do for j:=1 to i do for k:= j to i + j do r := r + 1 return (r) I understand the time complexity of this algorithm for any given input size n > 0 will be O(n^3) since the 3 for loops will always be...
The manifold hypothesis is the statement that real-world high dimensional data (such as images) lie on low-dimensional manifolds embedded in the high-dimensional space. It has been tested to be true quite extensively. So could someone explain or give some intuition why it is true? Why doesn't real world data such as do...
Let $P$ be any nontrivial property of the language of a Turing machine. Prove that the problem of determining whether a given TM’s language has property $P$ is undecidable. Proof:(This is from sipser's book). Assume for the sake of contradiction that $P$ is a decidable language satisfying the properties and let $R_P$ b...
Why proving that we can verify the solution of a problem is polynomial time is sufficient enough to say that the problem is nondeterministic polynomial time? Please note: this is not a question on how to prove a questions is NP, but instead asking why, we can just do so? If there is more step we need to do, what are m...
I'm searching for a simple algorithm to allotment a real estate unit for the customer based on the customer preferences like the following table. Each customer has a priorities and we should allocate a unit for each customer, what is the name of this algorithms type to cover all scenarios.
I'll try to do my best to explain this. I have X circles (from 2 to 4) which can move around smaller pivot circles. The pivot circles are fixed and cannot be moved once they are in the "field". Pivot circles are never created colliding with other pivot circles. Something like this: Red are pivot circles (fixed) and or...
Suppose we have a two-dimensional table $T$ with $r$ rows and $c$ columns that is sparse. Let $T[i][j]$ be the element at the $i$th row and $j$th column of $T$, with zero-based indexing. We can compress $T[i][j]$ by putting all elements in a single 1D array $A$, and letting $A[D[i] + j] = T[i][j]$. Now with $D[i] = ci$...
I want a queue like data structure in which a new element inserted has to be some elements away from a related element. While reading from this data structure, related elements should only be read after some time. Suppose X is inserted. Then Y which is related to X should only be inserted at a position which is k eleme...
I'm struggling to understand this factorial algorithm. Falling(n, m): if m = 0 return 1 if m = 1 return n return Falling(n, floor(m/2))* Falling(n - floor(m/2), ceil(m/2)) The algorithm should compute $n!/(n-m)!$ I'm analyzing it in the case of n = m, i.e it returns n! Now I'm g...
I seem to be having trouble understanding the connection between the formal definition of co-NP and how problems are concluded to be in it. co-NP is defined to be the class containing the languages that are complements to languages in NP (I'm using this definition). So, given this problem: "given a finite set of integ...
This was a question given in a course, without answer. The referenced literature (just a few books) do not cover it, unfortunately. I think there is no relation with the range as the range of the Halting problem is {0,1} and the range of the successor function is infinite. But I feel like I'm missing some subtleties he...
First off, I should mention that I am a new contributor on this site and as such, please bear with me if this has been asked and answered before. I searched to the best of my ability to find similar questions and didn't find any. The Question Consider the definition of a deterministic finite automaton given below: A d...
I have a problem I've been dealing for the past few days, and I'm pretty stuck. Each user has a schedule for a given week, such as Mondays 9:00-12:00 and 14:00-18:00, Tuesdays... and so on. Each provider has another schedule for himself. The problem is: Get the best k (different) solutions such that each solution assig...
why is this Problem$$L = \{ \langle M\rangle \mid L(M) \text{ is undecidable}\}$$ undecidable? I thought if we know $L(M)$ the turingmaschine accepts all $x \in L(M)$, so $L(M)$ is in every case decidable and $L=\emptyset$ especially finite and decidable. I know we cannot find an algorithm but every TM has a language a...
Problem Given a range of integers $\{a,a+1,...,b-1,b\}$, find a subset of size $k$ such that the sum is equal to $s$. Question This problem came from evaluating some scheduling algorithms that I am interested in optimizing for some small home grown useless embedded system I am playing with. My problem is that I do not ...
Would the intersection of a recursive language and a recursively enumarable language be recursive or recurisvely enumbarable or neither? Assume $L_{3}$ is the intersection of some language $L_{1}$ $\epsilon$ RE and some other language $L_{2}$ $\epsilon$ REC . Since $L_{2}$ $\epsilon$ REC, there must be a Turing-Machin...
I'm on the Wikipedia page for Hindley-Milner type systems, on the section about "let polymorphism": https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system#Let-polymorphism I'm a bit confused on this sentence: Ideally, this would be allowed with any use of a bound variable What does that mean exactly? I'm no...
I’ve searched around for this already but ironically the results have been overshadowed by “Why C was named C” instead. If C was named “C” because it came after B, why was B named "B", since the only languages preceding B were FORTRAN and Plankalkül? Is it possible naming B - “B” was a play on “Assembly” abbreviated - ...
It is well known that the Kolmogorov complexity is uncomputable in Turing-complete programming languages. However, what about total programming languages? For example, is the Kolmogorov complexity of natural numbers computable if we work in Gödel's System T? (I suppose not, but I don't have a proof.) Furthermore, is it...
If I show that a language $L$ is contained in $\textbf{P}$ and $\textbf{NP}$ and I know that the language is $\textbf{NP}$-complete, why did I proof that $\textbf{P} = \textbf{NP}$?
The function $\mathrm{INDEX}:\{0,1\}^n\times\{1,\dots,n\}\to \{0,1\}$ is defined as $$\mathrm{INDEX}(x,i)=x_i,$$ where $x=x_1\dots x_n$. I am looking for the randomized communication complexity of $\mathrm{INDEX}$ for an arbitrary number of rounds. Somehow, I do not manage to find it in the literature. The deterministi...
I came across following problem: If the CFG is left factored then it must be Unambiguous and Not left Recursive. TRUE/FALSE? I have many thoughts about this. But I feel they are somewhat contradicting and hence form a bigger doubt. May be I lack some understanding. Thought 1 Ambiguity has nothing to do with determi...
The problem is the following: Give an example of a graph that has a unique minimum spanning tree but for every cut of the graph, there is not a unique light edge crossing the cut. I am trying to find such a graph, but I have not find any example. Is it possible to have such a graph? If not, why?
Suppose you have 1. a grammar for terms of a language; 2. type-assignment rules, 3. a set of reduction rules. You want to prove that your language is adequate for mathematical reasoning. If I understand correctly, the right way to do it is to develop a semantics for it, and then prove certain desirable properties such ...
Egg drop. Suppose that you have an $n$-story building (with floors 1 through $n$) and plenty of eggs. An egg breaks if it is dropped from floor $T$ or higher, and does not break otherwise. Your goal is to devise a strategy to determine the value of $T$ given the following limitations on the number of eggs and tosses: ...
Preface: This is not an attempted proof at P vs NP Starting with some CNF Boolean expression ϕ, by the rules of logical disjunction, a clause is only unsatisfied if each of the literals in it are themselves forced into being unsatisfied. A trivial example is (x OR y) with the interpretation XY=00. Non-trivially, we can...
This may be a silly question, but if a computer works in binary how can you encript numbers using decimal?
we know the performance of Dijkstra's algorithm with binary heap is O(log |V |) for delete_min, O(log |V |) for insert/ decrease_key, so the overall run time is O((|V|+|E|)log|V|). Now let's modify the Dijkstra to stop once it reaches T (Destination) from S(Start). The given performance is: Understand that we don't ne...
Is there any existing work done on finding paths that are geometrically straight? I encountered a problem where I'd need to find the longest straight(-ish) path in a web of connected nodes, each of which has a defined position in euclidean space (they're taken from a picture). Specifically, I want to find all straight...
My whole life I thought a collision is a situation that occurs when two distinct pieces of data have the same hash value. Everything looks a little bit different now: A few days ago we had to analyse common collision resolution strategies to handle the event that at least two keys being hashed to the same slot of an...
Let PARTITION-INTO-THREE-SETS be defined as following: Input: Positive integers $a_1, ..., a_n$ Problem: Are there three pairwise disjoint sets $I, J, K \subseteq \{1, ..., n\}$ with $I \cup J \cup K = \{1, ..., n\}$, so that $\sum_{i \in I}{a_i} = \sum_{j \in J}{a_j} = \sum_{k \in K}{a_k}$? It's easy to show, that PAR...
" How long will it take for 2 jobs to complete if they're running in parallel, knowing that both have a total of 20 minutes of CPU usage time and 50% IO" I calculated the CPU usage: 1-0.5²=75%. To my understanding, if they're running sequentially, time needed to completion is 80 minutes (each job needs 40 minutes to co...
I am trying to polynomial-time reduce the decision version of vertex cover to the decision version of binary programming. Here are the problem statements. Vertex Cover Decision Problem Instance: A graph $G=(V,E)$ and an integer $k$. Question: Does $G$ have a vertex cover of size at most $k$? Binary Programming Decisio...
For RDBMS viz. MySql, PostgreSql a common solution for scalability and high availability is to run a primary instance as master that is a read-write instance and one or more read replicas. If the master fails, a failover happens and one of the read replicas become the master. The problem happens, when a network partiti...
Reading the book of Dasgupta-Papadimitriou-Vazirani.pdf about the performance of Dijkstra's algorithm on Page 118, we are given: 4.4.3 Running time At the level of abstraction of Figure 4.8, Dijkstra's algorithm is structurally identical to breadth-first search. However, it is slower because the priority queue primit...
I have read few research papers in which given a graph $G$ where $V$ denotes its vertex set and $E$ denotes its edge set. Model of computation is word RAM. "Without loss of generality assume that vertices are numbered from $1$ to $n$" Question : How to justify the above mentioned assumption? I am not getting why this a...
What does Grover's algorithm output when the desired element is absent from the database? Since there will be no phase inversion, how exactly will the probabilities work?
It can be shown that every graph G has at most $\binom{n}{2}$ min-cuts. It follows from Karger’s algorithm Analysis. Is there a different combinatorial proof of this fact? Was this known before Karger’s paper?
I need SAT instances, involving 9 to 20 variables. They need to be hard to solve for humans. Both SAT and UNSAT instances are needed. I tried random-SAT generators on the web, but the results were not satisfactory because they are trivial. A good example of what I'm looking for is the following 4-variable instance from...
I was hoping someone could help me in understanding how to achieve a DFA here. The question is how I would create a DFA that accepts unsigned decimal integers whose digits are in non-decreasing order, such as 1234, 1589? The numbers can't start with 0.
In CLRS, in the later part of breadth first search topic, for unweighted graphs, it says: At the beginning of this section, we claimed that breadth-first search finds the distance to each reachable vertex in a graph $G=(V,E)$ from a given source vertex $s \in V$ . Define the shortest-path distance $\delta(s,v)$ from...
How can I construct a PDA which accepts the language $\{a^ib^j \mid 0 \leq j \leq 2i\}$?
Recap to the Johnson's shortest path algorithm: By the procedure extending the original graph $G^\prime = (V^\prime, E^\prime), V^\prime = V\ \cup \{s\}, E^\prime = E\ \cup \{(s, v)\ |\ \forall v \in V\}$, and then extend the original weighting function $\forall x \in V,\ w(s, x) = 0.$ Finally define the reweighted fun...
Let $L= \{\langle M \rangle \mid M \text{ halts on } \langle M \rangle \} $ be a language where $\langle M \rangle$ is the Code of the TM $M$. $L$ is undecidable. I've heard that I can't use Rice's theorem to proof its undecidability. But why? I can construct a set $S = \{f_M \mid f_M(\langle M \rangle)\in \{0,1\}\}$....
If SAT can be decided in polynomial time, is it clear that Min-ones SAT can be decided in polynomial time? The idea I had was to take a poly decider of SAT and try it on a formula OR'd with all settings of the variables with exactly $k$ ones. If it is satisfiable for $k = 1$, then we know the Min-ones SAT on the formul...
C++ templates have type variables and can express lambdas, so they must have System F embedded. But is that exactly where they are located in the lambda cube? Can C++ templates produce new types or express dependent types? (I originally posted this to Stack Overflow, but they referred me over to here.)
For example, consider an AVL tree: Performing the two_close(T) should give back (13, 12), as they are the closest elements together. Said another way, you can take any two other elements in the tree, and their absolute difference will always be greater or equal to that of the result: $|c_1-c_2|\leq |o_1-o_2|$, where $...