instruction
stringlengths
35
29.1k
I am trying to show a different form of Hamiltonian cycle problem is NP Hard. The problem is as follows. We have a directed graph and each node can have at most 3 outgoing edges. Determine if this graph has a Hamiltonian cycle. Is this problem NP hard? I just need to find a problem to reduce to my problem but could a...
I'm running into an interesting directed acyclic graph (DAG) problem and was wondering if this is a known problem and if it has an efficient algorithm for it. I will use 'graph' and 'DAG' interchangeably Problem statement: Find all subgraphs of a DAG that can be defined by two nodes 'Input' and 'Output'. All vertices m...
Below there is Hoare triple in which variable $a$ is an array of integers, $len$, $x, i$ are integer-valued variables, and $r$ is a Boolean-valued variable. I have to provide a loop invariant (using predicate logic) suitable for proving partial correctness and explain in words why it is a loop invariant and why it is s...
I recently came across carry look-ahead adder(CLA) in David and Sarah Harris's book(Digital Design and Computer Architecture). The circuitry for a 64 bit number (standard integer size in C) is probably huge and gets very complicated.The generate function has just too many gates. My question is: are CLAs used in current...
Given the following statement: For a graph $G$, consider its minimum spanning tree $T$ and let $e = (a,b)$ be an edge that is not a light edge for a given cut $C$. Then $e$ never belongs to $T$. Intuitively, I believe that the above statement must be true since in order to make an MST we always take (one of) the lig...
I'm struggling with the following question: Define $Avg-P$ the class of all languages $L$ for which there exists a polynomial time Turing Machine $M$ such that for every $n$, for all but $\frac{2^n}{n}$ of the $2^n$ strings of length $n$, $M$ gives the correct answer to whether $x\in L$ or not. Prove that there exists...
Prove that the following language $Σ = \{1\}$ is not regular. $L$ = $\{w | |w| = k$, where $k$ is a prime number}. How should one go about proving this? Should I use pumping lemma for this?
Im learning about tree data structures, and had a question that i couldnt find answer to so I came here. Usually when we balance a tree, we insert keys and keep checking balance factor, as soon as it exceeds the given limit of (-1,0,1) we immediately balance it and continue to insert keys, if any. But lets say, I const...
Our professor took three statements from various textbooks that seem to be a little contradictory regarding the complexity analysis of Dijkstra’s algorithm as well as the lowest-cost-first or best first algorithm. Edit: I've discovered a related question which can be referenced here: https://stackoverflow.com/questi...
There is a variation of 3CNF-SAT which is called 10-3-CNF-SAT = {<$\Phi$>: $\Phi$ is a satisfiable CNF formula with $\textbf{at most}$ 3 literals per clause and every variable occurs in $\textbf{at most}$ 7 different clauses}. We need to prove that 10-3-CNF-SAT is NP-complete. My idea is that we can reduce from 3CNF-SA...
I have practiced DFA's for an upcoming test and I haven't been able to grasp how to construct more difficult DFA's. An example would be this question : Construct a deterministic finite state automata that recognizes the set of bit strings not containing 010 (With three states).
The following Hoare triple in which variable a is an array of integers, and len, max, i, n, j and m are integer-valued variables. Provide a loop invariant (using predicate logic) suitable for proving partial correctness of the Hoare triple. Explain in words why it is a loop invariant and why it is sufficient to prove p...
I have a facial recognition algorithm that compares two images A and B and returns the likelihood that they match. I also have 50,000 images, and I would like to sort these images into groups. Here's the immediate way I thought of to do this: Start with image 0, compare it to all 49,999 images. Store the similarities ...
We can associate a one counter finite automaton with a function $f:\Sigma^* \to \mathbb{N} \times \{0,1\}$, where $f(x)=(n,b)$ describes the state where the automaton terminates when fed an input word $x \in \Sigma^*$: $n$ holds the number inside the counter, and $b=1$ iff the state is an accepting state. Is it decidab...
I'm reading Sipser's Introduction to the Theory of Computation (3rd edition). In chapter 0 (pg. 2), he says we don't know the answer to "what makes some problems computationally hard and others easy," however, he then states that "researchers have discovered an elegant scheme for classifying problems according to their...
The reduction of Exact Cover to Subset Sum has previously been discussed at this forum. What I'm interested in is the practicality of this reduction, which I will discuss in section 2 of this post. For you who are not familiar with these problems I will define them and show the reduction Exact Cover $\leq_p$ Subset Sum...
I am looking for suitable algorithm how to solve the following problem. For finite set $S \subset \mathbb{R}$ ($|S| = N_{S}$) we need to find its disjunctive separation $S = A \cup B$ ($A \cap B = \emptyset$) on two ordered sets and assignment $\pi$ between elements of these two sets, where the following conditions mus...
The problem is the following : Data An oriented graph $(V, E)$ : to be understood as a set of partially ordered tasks A map $d: V -> \mathbb{N}$ : to be understood a function mapping tasks to a discretized duration. a couple $(p_0, p_1) \in \mathbb{N} \times \mathbb{N}$ : to be understood as an authorized time frame. ...
Imagine Google wanted to make their chrome browser faster. Let "database" be all the machines which serve content from Google's servers, including Search and Google cloud services. Google begins using machine learning to analyze thousands of petabytes of data on their database to extract a dictionary of the most redund...
I'm having some hard time with this problem. Can someone give me some clue/guidance? This is an homework question, so please don't just solve it. Given a weighted directed connected graph $G = (V,E)$ and given another function $d: V \to \mathbb{R}^+$ (including zero), find a linear time algorithm that checks if $d...
I have written the following algorithm $select(\Pi)$ select the first elements from $\Pi$. When there are no element in $\Pi$, it return $\emptyset$. Always terminates .Worst case complexity $O(1)$ $processing(e)$ function take a element $e$ as input and process it. And based on the processing it either output elemen...
I'm looking for a computer vision algorithm or method that can tell if the camera is moving in a video. Or maybe an alternate way of telling if the background is moving. I have a lot of videos and only want to keep the ones where the camera is stationary. All videos feature a person talking directly to the camera (the ...
Is the Space Complexity O(number_rows + number_cols) for Breadth First Search on a Grid. This is an attempt to show my reasoning: For example, the flood fill question is described here: https://www.geeksforgeeks.org/flood-fill-algorithm-implement-fill-paint/ The flood fill algorithm using breadth first search (queue) h...
I need to create a turing machine that accepts the language $a^ib^jc^k$ where $i \ge j \ge k$, but I am not even really sure how to start. Turing machines in this context are a hard concept for me to grasp for some reason.
What would it be a recursive algorithm to get permutations for any list of n elements that might contain or not repeated elements? For the following 3-element list [1, 1, 2] I would expect the following result: [1, 1, 2] [1, 2, 1] [2, 1, 1] So far I have the following result: [1, 1, 2] <- duplicate [1, 2, 1] <- duplic...
I'm trying to figure out the upper bound for the number of iterations of the bozo sort opt algorithm, described in this paper on section 3.2: http://www.hermann-gruber.com/pdf/fun07-final.html I know the maximum number of inversions in this case is nC2, what i'm struguling with is the probability of two numbers in an i...
Can anyone please help me with the following question? Consider a single processor system supporting two running processes, A and B, with the following sequential execution patterns: A: [CPU 8 ms; IO 1 ms; CPU 8 ms; IO 1 ms; CPU 8 ms] B: [CPU 2 ms; IO 1 ms; CPU 2 ms; IO 1 ms; CPU 2 ms] Assume that IO operations do not ...
I have referenced this similar question: Prove correctness of recursive Fibonacci algorithm, using proof by induction *Edit: my professor had a significant typo in this assignment, I have attempted to correct it. I am trying to construct a proof by induction to show that the recursion tree for the nth fibonacci number...
I am trying to practice some coding problems and I came upon this problem: As electricity prices are soaring, there must be a way to reduce wastage by increasing the utilization of heavy duty machines, such as elevators. We formulate the problem as follows. There are $N$ persons $ (p_1,...,p_N)$ waiting in a queue to ...
Define a function ∈{0,1}→ℤ so: for everything w ∈{0,1}, diff w = # of 1's in w- # of 0's in w. Thus: =0; 0=−1; 0=−1; Let = {∈ {0,1} * | = 3 for some ∈ ℤ}. the teacher only explained to me in class the functioning of the DFA multiple of 3 https://cdncontribute.geeksforgeeks.org/wp-content/uploads/dfadivision-1.j...
Let $\Sigma = \{ a,b,c \}$ be an alphabet. How should I calculate the number of Languages over $\Sigma$?
Let $L$ be a language. $w \in\ L$ , and $w$ could be broken in $xyz$. Then if $L$ is regular, there exists a pumping length $p$ such that: $\vert y\vert>0$ $\vert xy\vert \leq p$ $\forall i \geq 0,\ xy^i z\ \in L$ I understand that this lemma is based on pigeon hole principle we use it to prove that a language is n...
I have a graph algorithm that runs in: $$ T(n, m) = \begin{cases} c_1 & n \leq 2 \lor m = 1\\ T(n - i,\ m - j - k) + T(i, k) + c_2 m + c_3 n & m \leq (n-i)i\\ T(n - i,\ m) + T(i, m) + c_2 (n-i)i + c_3 n & \text{otherwise} \end{cases}$$ The restrictions on $i$ and $j$ are as follows: $$0 < i < n$$ $$0 \leq j \leq...
So suppose we have a set of vectors $X$ and we want to approximate the maximum of the following: $\prod_{x \in X} b \cdot x$ where the components of $b$ sum to $1$ If it matters the components of each $x$ sum to $1$ as well. What algorithm would you use to do this? Sorry if this belongs on the mathematics exchange, I ...
Let us define a $n \times 2$ matrix M consisting of integer sets, such that the first column consists of the so-called intersecting sets, and the second column consists of the so-called intersected sets. Also, for each element $a_{i,j}$ in $M$, $a_{i,1} \supset a_{i,2}$, i.e. i-th intersecting set is a superset o...
I am having trouble finding out the time and space complexity for this recursive solution. I have to create a list of words in order of word length. Each word, must be one character insertion off from the previous word. All permutations. Here is example: For the set "a, b, at, bat, cat, bait". The possibilities are: a ...
BFS Algorithm for Finding Minimum Steps for Knight Eliminating a Moving Pawn. As the Title suggests, I'm trying to intuitively understand this problem. Suppose we have a Pawn and a Knight taking turns. Both pieces must move on their turn, and both pieces have a starting position, and suppose the board is sufficiently...
Once you encode your message as a polynomial you can effectively generate and stream an endless number of points on that polynomial of which only a finite subset would be required to recover the polynomial. Why isn't Reed Solomon also a Fountain code? I have never seen it listed as such and I looked.
Forgive me if this should be in StackOverflow or Mathematics instead! I was given the following question at an interview: Given an array of unique integers, find the first missing non-negative integer that is missing to form a consequence sequence of non-negative integers. For example, the input [3, 4, -1, 0, 1] shou...
So, i'm stack on the following question > "A system has a 12 bit address bus. What is the maximum amount of RAM that can be installed on the system?" First of all, is this question correct? If so, can you explain to me way and how to determine the answer? Thanks in advance.
I know that combination is used in many areas. But do we really need parallel version of algorithms for that? If so, where do they used? Here is a famous example of parallel algorithms, Adaptive and Optimal Parallel Algorithms for Enumerating Permutations and Combinations by S. G. AKL.
How could one construct an algorithm for finding a node in a binary search tree that only requires the presence of $<$ on the key type. The ones I can easily also requires $=$.
For example, 111-11 I want to have the output as 111-11=1 I am a beginner at TM and am having a hard time trying to solve this question.
for an information word M with m bits that is coded as following: M is coded into a word A using an unknown code that allows detection of not more than one error. the code word is the word obtained by a concatenation of A to itself. so A becomes AA and etc.. 1)is it possible to know the overhead in the given code? 2)...
This is from a Kickstart problem: Note: The Manhattan distance between two squares (r1,c1) and (r2,c2) is defined as |r1 - r2| + |c1 - c2|, where |*| operator denotes the absolute value. Then in the analysis: Note that the manhattan distance has an equivalent formula: dist((x1, y1), (x2, y2)) = max(abs(x1 + y1 -...
I have a problem proving the following properties of given language K: $K = \{< M > | M\ accepts < M >\}$ I am trying to prove that language K is Turing-recognizable but undecidable using the diagonalization method. What I tried regarding proving K is undecidable using diagonalization: Suppose there exists a Turing mac...
Where f(n) = n! belongs to? P, co-P, NPComplete or NPHard?
I am wondering, if it is even possible: is it possible to reduce $HALT_{\text{TM}}$ to $E_{\text{TM}}$? $HALT_{\text{TM}}=\{\langle M,w\rangle\mid M\text{ is a }TM\text{ and }M\text{ halts on input }w\}$ $E_{\text{TM}} =\{\langle M\rangle\mid M\text{ is a TM and } L\left(M\right)=\emptyset \}$ I tried to look online, i...
Consider an alphabet $\Sigma=\{1,\dots,n\}$. An ordered word is a word $w=w_1w_2\dots w_k\in\Sigma^*$ such that $w_1<w_2<\dots<w_k$. In other words, an ordered word is a strictly increasing sequence over $\{1,\dots,n\}$. Let us call $O_{n,k}$ the set of all ordered words over $\{1,\dots,n\}$ of length $k$. Clearly, the...
Have been any interesting formulations for the concept of reduction between regular langauges, and if so -- are there regular-complete languages under those reductions?
I am trying to implement a decision tree classifier using ID3 algorithm. According to Aritificial Intelligence - A Modern Approach, information gain of attribute A is given by: Gain(A) = B(p/p+n) - Remainder(A) where B is the entropy of a Boolean random variable and p and n are the number of positive and negative examp...
Let consider a connected graph $G = (V, E)$ which is not oriented. One way to detect a cycle in such a graph is : Create an array : seen of size $\mid V \mid$ with seen[i] = false for all $i$ Perform a DFS (or BFS) starting at the node $0$. When we see a node $i$ : we have two cases : if seen[i] = false then seen[i...
I need to give a context-free grammar for each of the examples: $L_1=\{a^hb^ka^mb^n : h+k=m+n\}$ $L_2=\{a^ib^ja^k : (i=j \,\,\,\, and \,\,\,\, k≥0) \,\,\,\, or \,\,\,\, (i\ge0 \,\,\,\, and \,\,\,\, j>k)\}$ I've done many simple examples and have improved on my skills to generate CFGs from grammars. I normally star...
I was carrying on my reading of What Every Computer Scientist Should Know About Floating-Point Arithmetic but got stuck on the proof of Theorem 2 (page 34). At some point it says: \begin{align} (x \otimes x) \ominus (y \otimes y) & = \left[x^2(1 + \delta_1) - y^2(1 + \delta_2)\right](1 + \delta_3) \\ & = \left[(x^2 - y...
I'm writing a "Chores Scheduler" in Python. It has to be implemented using dynamic programming and has to take in two types of chores, as below: Regular chores with a start time and end time (a real-life example of this may be taking classes at the same time from Monday to Friday). I need 5 of these in my implementati...
I have searched the site well through, and also using Google and notes and couldn't find an answer to a question I am wondering about. Given: $$CF_{TM} =\{ \langle M \rangle \mid \text{$M$ is a TM description and $L(M)$ is a context-free language} \}$$ Are $CF_{TM}$,$\space $ $\overline{CF_{TM}}$ Turing-recognizable? I...
You are given a set of n jobs, where each job j is associated with a size s(how much time it takes to process the job) and a weight w(how important the job is). Suppose you have only one machine that can process one unit of jobs per time slot. Assume all jobs are given at time t = 0 and are to be processed one b...
i want to build decision tree classifier, and i have no idea how to extract feature from text (my file is text) can anyone help me? is BOW, N-gram orTF-IDF useful?
In a CFG, we might have :$A \rightarrow AA$ and $A \rightarrow a$ where $a$ is a terminal and $A$ is a variable. Then if we apply the first rule, and then the second , do we get $aa$ or either $aA$ or $Aa$ ?
Given a TM $M$ that halts on all inputs, and a general string $w$, consider the most trivial algorithm (Call it $A$) to decide whether $M$ accepts $w$: $A$ simply simulates $M$ on $w$ and answer what $M$ answers. The question here is, can this be proven to be the fastest algorithm to do the job? (I mean, it's quite cl...
Assume that $A$ is the set of objects such that each object $x_i \in A$ has value $w_i$. We wish to pack these objects into group, each pack containing at least $k$ objects. Our goal is to minimize the maximum difference between the maximum and minimum value of each packs. in other words, our goal is to minimize $L$ w...
Was doing a little interview prep. Given an undirected graph G, such that each node is colored red or blue and |E|≥|V|, find a path in O(|E|) time such that starting and ending at 2 blue nodes, s and t, that you pass through as few red nodes as possible. Initial Impressions: Since |E|≥|V|, O(|E|) time would include O(|...
Say, there are two camera feeds, how can I establish if they were filming the same scene? It seems plausible that there are algorithms that somehow calculate mutual information and detect "causality violations", determining that the other feed is most probably not another perspective of the same source, and that in the...
I have some constant vector $\mathbf{s}$ on $n$ dimensions, where every element of $\mathbf{s}$ is a real number, and I would like to multiply it by every possible $n$-dimensional binary vector $\mathbf{v}_j\ (0\leq j < 2^n)$. I only care about whether $\mathbf{s}\cdot \mathbf{v}_j > 0$. I would like to count all of th...
In the decision problem, I set all variables to true and see if the formula is satisfiable. My question is because I do not understand how there can be multiple solutions, though all variables are true.
Typically, median of medians algorithm is written with groups of size $5$ or $7$ to ensure worst-case linear performance. The argument against groups of size $k=3$ is typically that we get a recurrence of: $$\begin{align*} T(n) & \leq T(n/3) + T(2n/3) + O(n)\\ & = O(n \log n) \end{align*}$$ However, this assum...
I solved a practice interview problem that was sent me by Daily Coding Problem mailing list. I am now curious about the exact time complexity of my solution. Problem Statement Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. For example, the message '111' ...
I have read about Rice's Theorem on Sipser's book, and I think I understand it quite well. I understand that it can be used to show that a language is not decidable. However I am not sure about one question - Can I use Rice's theorem on languages which are defined on $LBA$ or $DFA$? For example, the following languag...
I was reading answer to https://crypto.stackexchange.com/questions/24941/prove-there-is-prg-that-is-not-necessarily-one-to-one Here assuming existence of G: from n bit to l(n) bits non injective G' is created from n+1 bits to l(n) bits I was wondering if it is possible to construct G with domain of n bits instead of ...
I want to create a database and model it with an E-R diagram. This database should be about a library. An entity is the member of the library, where the member can borrow books from the library. However , the member cannot borrow more than 5 books and cannot borrow any more books , if he hasn't returned every book of w...
I do not understand the difference highlighted in the chapter 2.5 of the book Theorem Proving in Lean: Notice that the meaning of the expression let a := t1 in t2 is very similar to the meaning of (λ a, t2) t1, but the two are not the same. In the first expression, you should think of every instance of a in t2 as a sy...
I want to understand a tricky method to find the maximum difference between two elements such that larger element appears after the smaller number. I found easy solution keeping track of the minimum array but I don't get the following solution which first find the difference between the adjacent elements of the array a...
To make my question more concrete, here is an example I am stuck on. I want to prove that $T(n) = 8T(\frac{n}{2}) + n^3$ is asymptotic bound by $n^3\log(n)$ using the substution method. That is $T(n)$ is $\Theta(n^3\log(n))$, so both $O(n^3\log(n))$ and $\Omega(n^3 \log(n))$. We know $T(n) = \Theta(n^3 \log(n)) \Leftri...
This DFA fulfills: Define a function $diff: \{0,1\}^*\to\Bbb Z$, for $w \in\{0,1\}^*$, $diff(w)=($# of 1's in $w)- ($# of 0's in $w$). Thus, $diff(\epsilon)=0$; $diff(0)=−1$; $diff(1)=1$. Let $L = \{w\in \{0,1\}^* \mid (w) = 3m\text{ for some }m\in\Bbb Z \}$. but I have been stuck when I go to proving correctness of ...
I am looking for an example of decidable problems the decision procedures of which are unknown. I believe someone mentioned one to me once, and I also have read somewhere, but my memory is corrupted. I suppose the decidability of these problems are proved non-constructively, so that they have this kind of counter-intui...
Suppose we have a set $A$ of binary numbers with the same length $n$. For example (with $n=8$): $A = \{ 10010011, 01011011, 00010010, 11110001\}$ Now, I want to find the binary number $z$ (also with $n$ bits) such that the minimum hamming distance between $z$ and any of these numbers is maximized. i.e. $z = \arg \max \...
Given the pre-order traversal, we can easily obtain the necessary Binary Search Tree(BST- not necessarily balanced). However, the problem arises when we have to decide the balancing manually(this was a question in a written quiz). Is it possible to do so in any way? Edit: I built the BST following the steps in this vid...
Is it possible to find the shortest path and visit all the nodes in a graph by A* algorithm? If yes, how?
We know that number of coprimes less than a number can be found using Euler's totient function. But if there are two numbers $p$ and $q$ and we need to find number of numbers less than $q$ and coprime to $p$, is there any efficient method?
My question is about mathematical part of machine learning algorithms, especially about using it in neural networks. We train network reducing train error and I was thinking about how then test error is also small (discarding overfitting and underfitting), what is mathematical proof for it. I found about that in this b...
A metaheuristic is defined as a metaheuristic is a higher-level procedure or heuristic designed to find, generate, or select a heuristic (partial search algorithm) that may provide a sufficiently good solution to an optimization problem So my question is if a neural net could be consider in that definition
I'm trying to prove the undecidability of the following language. $$L=\{\langle M \rangle\mid M\text{ is a Turing machine and there is a string }w\\\text{ s.t. }M\text{ accepts }w\text{ and }M\text{ rejects }w'\},$$ where $w'$ is the mirrored version of $w$. I know that my first steps should be to find a reduction fr...
Consider the language $\{ w \in \Sigma^*~|~ w~\text{contains exactly one double letter}~\}$. For example, $baaba$ has exactly one double letter, but $baaaba$ has two double letters. Suggested answer for the case where $\Sigma = \{a,b\}$ (even if it's an RE not a DFA): $(\epsilon \cup b)(ab)^*aa(ba)^*(\epsilon \cup b) \...
What is difference between Synchronous and Asynchronous Bus Operations. And how are they change in read cycle and write cycle ?? I shared a website it tells these bus operations bu I didint understand clearly and I didint understand these pictures in the website. https://www.quora.com/What-is-the-difference-between-a-s...
Let's say you have a bunch of points on a cartesian plane. For a few of these points you would like to find how many of the other points lie within their (x, y) coordinate, see below for an example: I'm trying to solve this for a school assignment and I haven't been able to find any existing algorithms to do some rese...
Let L be a language in P. Prove it is polynomial time reducible to any language in NP, including any language in P, which contains at least one string but doesn’t contain all the strings. I tried solving this, One solution I can think of is making a deterministic Turing machine that recognizes the problem P in polynomi...
Let's say I want to compute the matrix $M$ of the squared euclidean distances between each pair of vectors $(x, y)$ belonging to two sets $X$ and $Y$ respectively. The sets of vectors $X$ and $Y$ have size $m$ and $n$. Each vector has $k$ floating point coordinates. As far as I can tell, there are mainly two ways to im...
I am gaving trouble proving a natural deduction proof when there is no predicate given. Only conclusion is given. I understand the rules of elimnations, inclusions, IPs and others but I having trouble applying them when no predicate is given. The question is: $$ \vdash P(a) \to \forall x(P(x) \lor \lnot(x = a))$$ Also ...
I got confused by this a bit... the words of any recursively enumerable language $\mathcal{L}_{RE}$ can be enumerated by an enumerator $E$, i.e. there is an effective procedure (using lexicographic ordering of inputs) for all words $w \in L$ (with $L \in \mathcal{L}_{RE}$) to be printed by $E$. Now suppose $E$ lists do...
Q) Consider the following program fragment: var x,y:integer; x:=1; y:=0; while y < x do begin x:=2∗x; y:=y+1; end; For the above fragment , which of the following is a loop-invariant ? A) x=y+1 B) x=(y+1)2 C) x=(y+1)2y D) x=2y E) None of the above, since the loop does not terminate Since, Loop-Invarian...
I am working with metallic shapes which are curved and highly irregular. The initial order of them is random and by default they are merely sorted by size, which is simple. However the resulting order is neither optimal, nor "good". A smaller frame means less material used, so an optimization is desired. The shapes the...
I have 2 problems that derive from a simple problem. I'll explain the simple one with the solution I found and after that the modified problem. Suppose there is a game with 2 players, A and B and a list of positive integers. Player A starts by taking out a number from the list, player B does the same and so on aft...
I was wondering how do I solve this, I've been trying any possible way to but I've failed: $$\begin{align*} T(n) &= T(n-1) +3n^2 - 2n +1 ,& n \ge 1 \\ T(0) &=2 &\\ \end{align*}$$
I have just started studying Michael Sipser's Theory of Computation, studying various computational models such as FAs, PDAs et cetera. In the book, the term "memory" was often used,as in the case of FAs, it was taken to be the number of states, or for PDAs, the length of the stack, which is infinite,a hint as to why P...
Given a connected, directed graph $G=(V,E)$, vertices $s,t \in V$ and a coloring, s.t. $s$ and $t$ are black and all other vertices are either red or blue, is it possible to find a simple path from $s$ to $t$ with more red than blue vertices in polynomial time? I think it should be possible but our TA said this was NP-...
Several scientists view DNA as some kind of software. Chaitin suggests that life is an evolving software. Rothemund, Papadakis, and Winfree showed that DNA self-assembly can be used as a Turing-universal biomolecular system. DNA holds genetic information and holds the key to the evolution of living organisms. Transcri...
Let $$L_1 = \{\langle M\rangle\mid M \text{ is a Turing Machine and }L(M)\ne\emptyset\}.$$ Is $L_1$ recognizable? If so, can you give me a pseudo-algorithm? My attempt: I wanted to study reachability the same way one does with DFA/NFA. However although a transition might be defined between $q_i$ and $q_j$ for $ x \in ...
I encountered the problem below and the only solution I came up with is branch and bound like that is used in TSP and I don’t think the bound I used is good enough. Are there any better idea on this? Consider a graph $G$ that consists of an undirected bipartite graph and another vertex $O$ that is connected to all the ...
I had an exam today, and there was a question that said: Based on the definition of binary search algorithm, discuss when the algorithm time will be $O(1)$ and when it will be $O(\log(n))$. I'm not sure about my answer, but I answered randomly saying that, it can be $O(1)$ when the element I am searching for is at t...
WhereTo(H,X) is searching for the place to set X (an integer) in a minimum heap-H. The function is executing a binary search on a path of a heap. Assumption: We have the specific path because it starts on the last available leaf which is the last index in the array that doesn't contain any value, and there is only one ...