instruction stringlengths 35 11.4k |
|---|
L={ $a^mb^nc^pd^q: m+n=p+q$ }
I cannot find a grammar to prove that it is context free.
However I can visualise a PDA which can accept this language.
The PDA would push O's for every a and b which it can later match against c and d.
Please someone suggest a grammar for this language ?
|
I think the following encoding also works.
ZERO := λf. λx. x
ONE := λf. f
TWO := λf. f f
THREE:= λf. f (f f)
Note: the original encoding is
ZERO := λf. λx. x
ONE := λf. λx. f x
TWO := λf. λx. f (f x)
THREE:= λf. λx. f (f (f x))
Why is the original one better?
|
Let's take the following definition of a FPT Turing reduction from Flum & Grohe's book.
Let $F$ and $G$ be parameterised problems. For any instance $x$ of $F$, write $k(x)$ for the parameter of $F$ and $|x|$ for the size of $x$. For any instance $y$ of $G$, write $l(y)$ for the
parameter of $y$. An FPT Turing reduction... |
If two computer system's has to do some kind communication like data transfer or receiving should its clock sync to do that?If not then how they transfer bytes without having syced clocks?
|
Exercise 1.3 from Vijay Vazirani - 'Approximation Algorithms' asks:
Consider the following factor $2$ approximation algorithm
for the cardinality vertex cover problem. Find a depth first search tree
in the given graph, $G$, and output the set, say S, of all the nonleaf vertices
of this tree. Show that S is indeed a ver... |
There is a flash game that you can very easily find on Google called Blockage.
Rules & Goal of the game : Get all coloured blocks from
their initial position to a corresponding target spot of the same color. Once a block is placed on a target spot of the same color, it cannot move anymore. You can select a specific... |
Let $L_1$ be a DCFL and $L_2$ be recursive language. Is $L_1\cap L_2$ a DCFL?
According to me the intersection should be a Recursive language. However the answer given is DCFL. Can anyone confirm?
|
My professor mentioned the below statement in class but without a proof. I am trying to prove it for myself as I don't understand 100% why this is always the case.
Given is A, a subset of {0,1}$^*$.
ε $\in\ A^+$ <-> ε $\in\ A$, where ε is the empty word.
I thought of doing a proof by contradiction to show -> by assumi... |
On the Wikipedia page for Fixed Point Combinators is written the rather mysterious text
The Y combinator is an example of what makes the Lambda calculus inconsistent. So it should be regarded with suspicion. However it is safe to consider the Y combinator when defined in mathematic logic only.
Have I entered into som... |
Given a list $L$ of positive integers, assuming you can only modify the list by "splitting" its numbers a finite number $n$ of times. Write an algorithm which minimize the maximum of the last generated list.
By "splitting" a number $x$ I mean deleting $x$ from $L$ and adding to $L$ two positive numbers $\alpha,\beta$... |
My professor mentioned the below statement in class but without a proof. I am trying to prove it for myself as I don't understand 100% why this is always the case.
Given is A, a subset of {0,1}$^*$.
ε $\in\ A^+$ <-> ε $\in\ A$, where ε is the empty word.
I thought of doing a proof by contradiction to show -> by assumi... |
Pratt's paper suggests that the average time complexity for his gaps are $0.315 n(\log_2 n)^2$ (gaps generated from the ascending sequence of numbers in the form $2^p3^q$). Pratt's paper claims that $\Theta(n (\log_2 n)^2$ is better than all other shell gaps, suggesting the assertion, $n^{\frac{3}{2}}=o(n (\log_{2} n)^... |
$\oplus P$ is low for itself ($\oplus P^{\oplus P}=\oplus P$).
Are there other complexity classes $\mathcal D$ that satisfy $\mathcal D^{\oplus P}=\oplus P$?
Are there complexity classes $\mathcal C$ that satisfy $\mathcal C^{\oplus P}=\mathcal C$?
|
Rice theorem says that any non trivial property of a language recognized by a Turing Machine is undecidable.
Now does this theorem applies to machines as well since we can define a language consisting of strings which are encoding of machines?
For example whether a machine will run more than 100 steps on some input? Th... |
The propagation delay between two links is 200 bit time .....i want to know what is the difference between 200 bit time and 200 mill seconds
|
"Propogation delay betwween two links is 200 bit times"
I am little confused here, Propogation delay should be in seconds, milliseconds etc but here it is in bit times. I also want to know what is bit time and is it same as Propogation delay.
|
I have developed an upper bound on the number of vertices of a particular graph. This bound is the best possible bound that can be found for any given instance. What do you call such a bound? If it were an optimization problem then I would call it the optimal value or the optimal bound. Is that right?
|
I'm confused about the idea of constructing a decider for a language and i need some help with it.
For example, if i have an enumerator M1 for a language L and another enumerator M2 for the complement of L, how do i construct a decider for L that uses both enumerator M1 and M2?
I understand that i would first introduc... |
My situation
I am writing a paper presenting a software module I developed and I want to compare its runtime to other modules for the same task.
I am aware of the drawbacks of runtime experiments, but please assume as given that there is no way around it in my case.
(I can and do deduce some properties theoretically, b... |
Why is the array used for a restricted hashing scheme always sized to a 4k + 3 prime? When they talk about a restricted hashing scheme are they talking about a non perfect hashing which includes having a collision algorithm which resolves that problem? Can someone please help me?
|
If somebody with a computer science background wants to learn about information visualization, again from a computer science perspective, which will be the best learning material for him?
A textbook will be preferred but any other tutorial or something similar is also welcome.
|
I am trying to solve a problem where some of the constraints have NaN values. Which algorithm can be used to handle this kind of problem.
In my example I have 3 nonlinear inequality constraints,
C(1)<= 0
C(2)<= 0
C(3)<= 0
If C(1) is not satisfied, C(2) and C(3) will have NaN value.
|
I have made a draw of a DFA, and I have to formally define the automaton in the following format. Let $A$ be the necessary automaton :
$$A=<\Sigma,Q,q_0,\delta,F>$$
Where $\Sigma=\{a,b,c\}, Q=\{q_0,...,q_4\}, F=q_3$ and $q_0$ is the initial state.
The drawing is attached to this post:
Can I do something like $\delta_{A... |
Over some infinite alphabet $\Sigma$, can we state that the set of all possible finite strings is countable?
|
I was wondering what are the conditions to apply source coding theorem (SCT).
1. Is it applied only to uniform-length coding, what about variable-length coding, does it also satisfy SCT?
I was asking because in my lecture, SCT is only discussed in uniform coding section.
2. Is the result of SCT for uniquely decodable ... |
I am interested in an algorithm that accepts an array that places identical elements contiguously but the array doesn't necessarily have to be sorted.
E.g. if input is
array = ["a", "a", "c", "b", "c"]
then output
groupby(array) = ["a", "a", "c", "c", "b"]
or
groupby(array) = ["c", "c", "a", "a", "b"]
etc. The point ... |
This excercise is from The Algorithm Design Manual by Skiena:
My solution is this:
We will attempt a proof by induction.
First, prove that the algorithm is correct for $n = 1$ :
$n = 1$ means that $p$ will be set to $a_1$. Then, the for loop will execute once with $i = 0$, setting $p$ to $a_1x + a_0$ and returning ... |
I'm trying to write typing rules for a simple language, which is basically a lambda calculus with SSA-like $\phi$-nodes, which basically exchange formal parameters for actual parameters.
For simplicity, let's assume the simply typed lambda calculus, with let and where as syntactic sugar (as usual, functions may only ta... |
I'm not sure on how to come up with a string that is in terms of $p$ for
$ a^ib^jc^k$ where $ i+j = k^2$
Where $p$ is the pumping length. I can't seem to find anything in terms of $p$ that satisifies the constraint. Any ideas or sugeestions are appreciated!
|
I have the following question regarding a situation given and we are then required to derive a regular expression out of it.
What i have to do now i to give a regular expression for this language described by the knob movement from A,B and C. Because i have to go through B if i were to traverse to C, and vice versa, i... |
I read that in spinlock, process keeps on waiting for the lock continuously in a loop until it receives signal(lock) or release(lock) from other processes. This causes busy waiting and hence CPU cycles are wasted.
My doubt is, if CPU is continuously checking the value of lock variable in loop, then how will some other ... |
I'm currently reading the book Introduction to the Theory of Computation (2nd or 3rd Ed.) by Michael Sipser, and have stumbled upon a question in Chapter 1 - Regular Languages, namely when the author is presenting the proof idea of Theorem 1.49 - "The class of regular languages is closed under the star operation." usin... |
When a system call takes place some kernel code must be executed. If some kernel code is being executed it means it can alter register values. So before this code gets executed the old process state must be saved. This is called context switch.
Now Wikipedia says that not all system calls need context switch. How is th... |
This is a problem 1.6 from the book Algorithm Design by Kleinberg/Tardos:
There's a company that manages ships that do various tasks when in port. There're $n$ ships, $n$ ports, $m$ days in a month such that $m>n$.
At any given day there can't be two ships from the company in the same port. $(*)$
The company wants to ... |
Is there any theorem that states that any NP-Complete Problem has a class of instances solvable in Poly time? For example, some problems like vertex cover are NP-Complete on general graphs but can be solved in polynomial time on instances which are Trees. Does every NP-Complete problem have such class?
|
I am reading "Introduction to Theory of Computation" by Michael Sipser. One of the exercise problems asks to verify whether the problem of deciding whether a Context free grammar generates exactly K strings is decidable?
This problem has two parts
K can be infinite (I know how to solve this. If the grammar has any
k... |
In an undirected, weighted graph G the set of shortest paths from an arbitrary start vertex s form a spanning tree of G. We're calling this spanning tree a shortest path tree.
How do I find an example to show that, even if all edge weights are different (and non-negative), it is possible to have more than one shortest... |
Suppose I have a binary tree that is guaranteed to have at least one level that holds the maximum amount of nodes possible. I want to find the height of the deepest level that is full/holds the maximum amount of nodes possible. I have a function highestFull() that calls it's recursive version highestFull(Node* t) which... |
T/F Questions
Adding a constant to every edge weight does not change the solution to the single-source shortest-paths problem.
Solution - False
I think this should be True, as Dijkstra's Algorithm sums the paths from source to each vertex. If every edge weight is increased by a constant, then nothing should be chang... |
I don't have any knowledge at all in the field, i don't know if i am in the correct community. Is there any book you would suggest for a starter to gain an idea about computer science? I have a good background on mathematics and engineering. I want a book to understand get a general idea about the field in order to be ... |
Suppose I have an NFA with accepting state q1(which is also an accept state) and non-accept state q2, with ε-transition from q1 to q2.
Also, suppose that empty string is inside the language. Then I want to know if the empty string is accepted by the above NFA following the standard definition:
Here, $\mathcal{P}(Q)$ ... |
I found an algorithm that enumerates k-subsets of length n/4 for a input set of n length, having a time complexity $O{n\choose n/4}$, the algorithm fits well a problem I'm looking to solve, but I'd like to double check if I understood well its time complexity.
I plotted it for different increasing N and looks exponenti... |
So i just don't understand the relation between interrupts and Preemption in O.S?
For example in Multi-programming, do we need the support of Preemption or not? when a process needs I/O and sends an interrupt, do we use Preemption here to remove that process in order to get another process running, or no need for Preem... |
The question is to show that there is no deterministic polynomial time algorithm that solves SAT correctly on all but $poly(m)$ formulas of size $m$, for every $m \geq 0$ unless $P \ne NP$.
I know that if $P = NP$, a polynomial time algorithm exists that, given a Boolean formula φ, actually produces a satisfying assig... |
I'm solving a problem of detecting an optic disc in a retina image. As you can see from the image:
the optic disc is the epicentrum of the blood vessels, has an irregular circular shape and has a brighter color than the rest of the retina.
Now I want to use a convolutional neural network to detect it. I know that ty... |
All functions are from naturals to naturals.
Let f(n) and g(n) be monotonically increasing functions. prove or disprove
h(n) = max(f(n),g(n)) => h = O(f) or h = O(g)
I've found close questions regarding max(f,g) being O(f+g) but I couldn't derive anything from them regarding my specific problem. Needless to say, I'm... |
I'm stuck on this semaphore exercise (it's a exam question of a previous exam and I'm studying for that exam):
There are three processes: A, B and C. Process A wants to execute method a(); Process B wants to execute b(); and Process C c();. The Processes are each started once.
The execution of a(); must not overlap wit... |
In the 0-1 knapsack problem, I am given a set of items with their weights and the weight that a knapsack can carry.
The objective is to maximize the number of items I can carry subject to the fact that I do not exceed the maximum weight of the knapsack.
The algorithm could be something as follows-:
weight = 0
list_of_i... |
What is the fastest way to compute the inverse of the matrix, whose entries are from file $\mathbb{R}$ (set of real numbers)?
One way to calculate the inverse is using the gaussian elimination method. In this method append more columns(double the number of columns ) to the input matrix and then we try to make last row ... |
Where does computer store used and unused memory address to access it ?Are base address and length or ending address stored side by side?
|
I understand how 1-bit adders work, but I don't see how to make a 4-bit adder using those 1-bit adders...
This is my 1-bit adder:
How can I use this to create a 4-bit adder??
This is my attempt, but it ain't working because I event don't include a carry-in; and I need two 4-bit inputs.
|
This question is taken from an exam of a Computer Theory Course.
Describe how a NON-Deterministic Turing Machine with two tapes recognize in linear time palindrome strings with even length that have the form: $L=\{ww^R\mid w\in\{a,b\}^+\}$.
Tape 1: Read-Only & monodirectional
Tape 2: Read and Write, bidirectional
$... |
Suppose I wished to devise an algorithm (to be run on a turing machine) which could find the sum of 2 integers (expressed in base2). How many tapes would this require?
My intuition tells me that 4 tapes would be required: 1 for each of the two numbers being added together, 1 to store the 'carry over' value, and 1 to st... |
A two-way hash function that could hash complex strings to a fixed length would change the world.
Imagine the decreased load on wires around the world if, for example, HTML pages could be hashed, then decoded by clients. Power (electricity) savings would be enormous.
Is it absolutely, without a shadow of a doubt, impos... |
I am learning about context free grammars and have been through few texts in a undetailed manner on these topic . I think I should know the exact , rigorous ,technical definition of what exactly a "grammar" means .
I could see that ,in all of these lessons, a sequence of equations as follow :
a = bc
b = ed
c = gh... |
We are given a string S, we need to find count of all contiguous substrings starting and ending with same character.
Examples :
Input : S = "abcab"
Output : 7
There are 15 substrings of "abcab"
a, ab, abc, abca, abcab, b, bc, bca
bcab, c, ca, cab, a, ab, b
Out of the above substrings, there
are 7 substrings : a, abca... |
Can external fragmentation occur in fixed size partitioning ?
I searched everywhere but couldn't find a sentence which says external fragmentation is not possible in fixed size partitioning.
Please someone clear my doubt.
|
Given a modulus $n\in\mathbb{N}$ and another natural number $0<x<n$, what's an efficient algorithm to enumerate all pairs of natural numbers $(a,b)\in\mathbb{N}^2$ such that both $a$ and $b$ are less than $n$ and $$ab\equiv x \mod n\text?$$
|
This question is taken from an exam of a Computer Theory Course.
Describe how a NON-Deterministic Turing Machine with two tapes recognize the language generated from the grammar: $ S \rightarrow SS | (S) | )S( | \epsilon $.
Tape 1: Read-Only & monodirectional
Tape 2: Read and Write, bidirectional
My guess:
Example ... |
A common modification to the Needleman-Wunsch to reduce running time is to only fill in the cells along a diagonal band of the matrix (slides 27/28). Let 2d + 1 represent the width of the band. Then based on the provided text, this ensures that the total number of inserts and deletes does not exceed d.
However, I can'... |
This is the so-called recursive style:
And this is the so-called iterative style:
It seems like it is defined recursively to me. The function doesn't hide the next call of the function defined in it at all.
(SICP 95)
|
Suppose we are given a matrix $A$ over real numbers and we want to computer the inverse of matrix $A$. There are various algorithms to do so and it also turn out that we can use matrix multiplication problem to solve matrix inversion problem.
My question: How to prove that matrix inversion is at least as hard as matr... |
Nodes A and B are accessing a shared medium using CSMA/CD, with a propagation delay
of 245-bit times between them (i.e., propagation delay equals the amount of time to transmit 245 bits). The minimum frame size is 64 bytes. Suppose node begins transmitting a frame at = 0 bit time. Before A finishes, node B begins tra... |
Assuming that the worst case running time of merge sort can be described with this recurrence:
$\
T(n) =
\begin{cases}
\theta(1) & \text{if }n = 1\\
2T(\frac{n}{2}) + \theta(n) & \text{if } n\gt 1
\end{cases}
$
Introduction to Algorithms says that it is possible for the same constant $\ c $ to represent th... |
Consider the following generalization of maximum set cover problem:
Given a collection $C$ of subsets of a finite set $S$.
Find $C^{'} \subseteq C$ of cardinality $k$ that maximizes
\[
\sum\limits_{s \in S} f(s, C^{'})
\]
For example:
If $f(s, C^{'})=\begin{cases}1 & \exists c \in C^{'}, s \in c \\ 0 & \text{otherwise... |
I remember using a simulated machine with with a minimal instruction set in university. In particular I remember that the instruction that consisted of all zeroes loaded was a LOAD instruction. So, if you made a mistake and began executing empty memory then it would simply keep executing until it ran out of address spa... |
The computational complexity of primality testing is usually specified in relation to the bit length of the number being tested.
However, Mersenne numbers have the special property that the characterizing instance exponent $p$ is exponentially more succinct than the number it signifies. Surprisingly, most of the litera... |
Can epsilon be in the input alphabet of an FST ?
|
Given is the NFA N:
What's the language of this NFA? What's its complement?
I'm learning for a test and I'd like to know if I solved this task correctly.
The language L of the NFA N should look like this:
L(N) = {x ∈ Σ* | x mustn't include 'aba' and x mustn't end with 'ab'}
I have tried several different words and I... |
In The Temporal Logic of Programs there is an operator first appearing on page 3 (48) under "Partial Correctness" that looks like an elongated super set symbol. What is it?
|
Problem:
Given a vectors of size $n$ with integer data within $[1, n-1]$ range, find $if$ and $which$ numbers are multiple duplicates (numbers appearing more than once). The time complexity ought to be linear and space complexity constant (don't use any auxiliary data structure except the input vector and variables) a... |
Is it possible to build a parsing algorithm that build a parse tree using a top-down method that simulate a derivation process for regular expressions, like we do for type 2 languages?
My guess
Given a regular expression r, build its FSA, then obtain the grammar that generate r in order to build a parse tree
|
Consider a job schedule decision problem with only one machine takes input $\{(r_1,p_1,d_1),(r_2,p_2,d_2),...,(r_n,p_n,d_n),K\}$; where $r_i$ is the start time for the ith triple, and $p_i$ is the process time of the triple; and $d_i$ is the deadline.Require for each $i$, schedule a job at time $t_i$ such that $r_i≤t_i... |
Assuming I have two 0-1 decision variables X[a,b] and Y[i,j,e,d] where :
X[a,b] = 1 if a is in b 0 otherwise
Y[i,j,e,d] = 1 if (i,j) is matched with (e,d) 0 otherwise.
I need to ensure that if two elements say k and l are both in f respectively i.e X[k,f] == 1 and X[l,f]==1 then no matching i.e for each (e,d) Y[k,l,e... |
I'm familiar with the idea of basic tail recursion elimination, where functions that return the direct result of a call to themselves can be rewritten as iterative loops.
foo(...):
# ...
return foo(...)
I also understand that, as a special case, the function can still be rewritten if the recursive call is wrap... |
Given a persistent red-black tree, I've been searching for an algorithm, approach, or equivalent data structure that allows me to efficiently merge two instances of the tree produced by divergent modification of a common ancestor.
For instance, tree instances v1 and v2 produced by mutating the common instance v0, are c... |
If I'm passing parameters as call by value-return and call a void function, will the local values within the function still be copied to the corresponding values in the caller function even though the called function doesn't return? For example:
int x = 4;
void foo(int a) {
a = 8 + 8;
}
int main() {
foo(x);
... |
I'm new to formal language and automata theory and I was left alone with this exercise. The task is to define a formal grammar for given language.
$Σ \in \{a,b\}$
$L = \{ w \in Σ^*\, |\, |w| \equiv 2 \mod 3 \} $
I already solved tasks of that kind, but now i struggle to understand what $|w| \equiv 2 \mod 3$ means. $... |
Can anyone explain how are conditionals implemented in the CPU?
Is special circuitry used?
|
I'm looking for a finite state machine that can match inputs to the regular expression .*b. deterministically (i.e. it cannot change state w/o being fed input and the transition to a new state is solely determined by the current state and the input word).
Consider the following examples that should be matched by the au... |
Is it possible to solving simultaneous multiple chinese remainder theorem on the quantum computer?
We have $k$ variables. Each variable can take two values.
The question is: can we calculate all possible circuits equations chinese remainder theorem (which may be $2^k$) and reduce to the smallest result on a quantum com... |
I'm currently working on a few turing machine exercises and I can't understand how I can prove whether the below is at least partially decidable:
$\{M \mid L(M) = \{x \mid |x| = 10\}\;\}$ where $|x|$ is the length of word $x$
Can anyone explain to me what the above statement actually means and an idea of how to go abou... |
This is sort of a silly question that's been bugging me.
I have a list of 100k numbers that I am calculating some statistics for. Specifically, I am computing the mean, minimum, maximum, and sum of these numbers. I'm doing it using a fold. In JavaScript:
// define folding functions:
let mean = (a, b, index, array) => a... |
Given a Mealy machine $M$, is it possible to construct another Mealy machine $M'$ that generates the reverse outputs from the reverse inputs, and if so, how?
That is, for each string $s$, $M(s) = t$ iff $M'(s') = t'$, where $s'$ is $s$ reversed and $t'$ is $t$ reversed.
For example, if $M(``abcd")$ is $``efgh"$ then $M... |
How to define a non ambiguous grammar for regular expressions on the $\Sigma =
\{a,b\}$ alphabet?
Given that:
If $\Theta = \{+, ^*, (,),\cdot, \emptyset\}$ is a set of symbols
A regular expression on $\Sigma$ is a string such that one of the following condition applies
$r = \emptyset$
$r \in \Sigma $
$r = (s+t)$ or $... |
Let's say we have given matrix of size $n \cdot m$, such that both $n, m$ are big numbers and we cannot keep the whole matrix in memory (up to 10 millions).
In some of the coordinates of the matrix there are positive numbers and all other fields are zeroes (at most 100000 elements are with value different from 0). For ... |
Recently it's been in the headlines that IBM was able to simulate a 56 qubit quantum computer using only 3 TB of memory. This is several thousand times smaller than one would expect the memory requirements of such a simulation to be. How were they able to do this? Did their simulation run correspondingly faster? Does t... |
and why?
It seem abstract in that it is and idea created and implemented with nodes arranged a certain way.
But it did not show up in the text here:
https://en.wikipedia.org/wiki/Abstract_data_type
Here:
https://en.wikipedia.org/wiki/Binary_search_tree
they are referred to as data structure b.c. other ADTs can be cr... |
Question:
Show that every CF grammar G = (V,T,S,P) can be converted into an equivalent CFG in which every production is of the form A → xBC or A → ϵ, where x ∈ T U {ϵ} and A,B, and C are variables.
For this question, I have considered that it can be proved by using Greibach Normal Form, because we can get the form: A →... |
Given $n$ variables : $a_1,a_2...,a_n$ and $m$ inequalities of the form $a_i<a_j$, we want to know if there's a positioning that satisfies all the inequalities.
a. We want to modelize the problem to a directed graph $G=(V,E)$. $V=?,E=?$
$V=\{a_i|i\in[n]\}$ $E=\{a_ia_j|a_i<a_j\}$
b. Complete the sentence: There exist... |
I am trying to solve a question from the exercise of this book, pg. 46,section 7.4.
Let $M$ be a deterministic Turing machine that only queries oracle strings
that are shorter than the input string. Show that if $A = L(M^A)$ and $B = L(M^B)$ then $A = B$.
I think I have to apply induction. Does it involve self-reducibi... |
How can I solve this?
I saw Solving the recurrence $T(n)=T(n-1)*T(n-2)$ but I don't know how I can apply it to $T(n)=T(n-1)/T(n-2)$?
|
Let there be two sets of $n$ points:
$A=\{p_1, p_2, \dots, p_n\}$ on $y=0$
$B=\{q_1, q_2, \dots, q_n\}$ on $y=1$
Each point $p_i$ is connected to its corresponding point $q_i$ to form a line segment.
Example:
I need to write a divide-and-conquer algorithm which returns the number of intersection points of all $n$ line... |
Help is needed, I've tried to solve it by myself but I could find any reasonable solution which is solid enough. this is what I've wrote:
Consider a 0-1 ILP, where each variable x1,x2...,xn can assume values
0 or 1. The number of constraints is m.
We can choose all possible 2n assignments of x1, x2...xn in
non-det... |
I tried to make a 4-bit adder, but it ain't working.
When I do this:
a 0000
b 1111
+ _____
s 0101
but s should be 1111!
And this is my 1bit-adder:
What am I doing wrong? Is it possible to put a0123, and b0123 in just two 4-bit inputs instead of 8 separate inputs?
|
I have a graph with n edges and m vertices. This is an undirected graph.
I need to find a 3 vertex cycle. Only 3.
I'm confident I need to use an incidence matrix for this as this seems to be the best data structure. I'm familiar with cycle finding algorithms and they are all in crazy polynomial or even exponential time... |
We have two functions:
$f_1: \mathbb{N}\rightarrow \mathbb{N} \quad $
$f_2: \mathbb{N}\rightarrow \mathbb{N}$
By definition $f_1$ is turing-computable while $f_2$ is not.
Then we define a third funtion $g(n) = f_1(n) + f_2(n)$.
I want to show that $g(n)$ is not turing-computable:
So first assume that $g(n)$ is computab... |
How to prove that the problem VERTEX-COVER belongs to $NP$?
The problem VC is defined as follow:
INSTANCE: Graph $G = (V,E)$ and an integer $k$
PREDICATE: Is there a subset $V_1 \in V $ s.t $\mid V_1 \mid \leq k $ and $\forall (u,v) \in E $ $u \in V_1 $ or $v \in V_1$ ?
My approach:
I know that the class $NP$ can b... |
My problem is as follow, imagine a complete undirected graph with weighted edges, i would like to extract a connected graph keeping all the vertices and where the edge with the highest weight is the minimum one compared to all others possible configurations.
Is there another solution than bruteforce it.
|
I am reading Theory of Computation by Peter Linz. The transitions for PDA uses $\epsilon$ as end marker for input string. For example if the final state is
$q_1$ then the transition is written like $\delta(q_0,\epsilon,z)=(q_1,z)$.
Why don't they write the transition as $\delta(q_0,\$,z)=(q_1,z)$.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.