instruction stringlengths 35 29.1k |
|---|
Given an AVL tree, I want to compute its height as efficiently as possible. $\newcommand{\bf}{\text{bf}}\newcommand{\height}{\text{height}}$
Each node of an AVL tree stores its balance factor ($\bf$), defined as
$$\bf(v)=\height(v.\text{left}) - \height(v.\text{right}).$$
We can recursively compute the height of an AVL... |
G:
S -> bRS | RcSa | @(epsilon)
R -> acR | b
....
2-LOOKAHEAD(S->@) = {$,a,aa}
2-LOOKAHEAD(R->b) = {b,ba,bb,bc}
I don't understand a result of these rules..
----+
when I tried to solve 2-LOOKAHEAD(S->bRS), it solve easily.( {ba,bb} ).
but I don't understand why 2-LOOKAHEAD(S->@) results are {$,a,aa} and
2-LOOKAHEAD(... |
Given an $n$-bit integer, I am interested in performing an increment operation using as few bit reads as possible. The standard binary code (standard binary representation of numbers), requires $n$ bit reads and writes in the worst case, though only $2 - 2^{1-n}$ bit reads on average (i.e $2$ bit reads on average asymp... |
Is there anyway for example, to take a trivial program from C such as:
int main() {
int i = 1 + 1;
return 0;
}
And compile this down to some form of Quantum Abstract High-level language, i.e. Quantum C?
From what I understand, quantum arithmetic is quite tricky business that uses QFTs. My first thought was to do t... |
I am currently doing my homework for my Computer Architecture class. One of the questions asks:
A computer has a 64-bit data bus and 64-bit-wide memory blocks. The memory devices have an access time of 35 ns. A clock running at 200 MHz controls the computer and all operations take an integral (i.e. whole number) of c... |
Suppose we have public key: $$n= 1015, e= 3$$ and private key: $$d= 635, p= 35, q= 29, \phi(n)= 952$$
For $m = 100$, we have $$c = m^e ~mod~n = 100^3 mod~1015 = 225.$$
To decipher this, let us take $$c^d~mod~n$$ which is $$225^{635}~mod~1015$$ which equals $$680$$ But $680 \neq 100$ so this means that RSA incorrect... |
I'm learning how to convert NFAs to DFAs and I want to make sure I'm doing it right. Obviously, going back in the other direction isn't a thing. Does anyone know of an algorithm to check that a DFA is equivalent to a NFA?
|
I'm very interested in computing and programming. I have done a lot of programming with different languages although I have a question nobody was able to answer until now.
I question myself how is software related to hardware. to be more specific what are the basic mechanisme which make it possible for hardware to und... |
The edit distance between two strings $d(w_1, w_2)$ sums up the cost of edit operations that transform one string into the other. If done right, the edit distance is a metric.
In particular, the cost of an edit operation may depend on the character inserted or deleted, meaning we have costs $w_\text{insert}(a)$ and $w... |
I have found that naive Bayesian classifier performs much better than classification using mixture of multivariate Gaussians.
Here is the problem: I have a set of objects with attached features (10 of them), part of the set is the training set with pre-assigned labels, another part needs to be classified into 3 classes... |
I am looking for the most efficient algorithm for finding shortest path between two Vertices.
The graph is:
undirected
edge-weighted
Non-negative
less then 300 nodes
I understand that most of the algorithms based on Dijkstra's shortest path algorithm. But which one is the most efficient for the case a specified abov... |
Let $X = \{x_1, x_2, ..., x_n\} \subset \mathbb{R}^m$ be a finite set of points. Smallest enclosing ball is a well-known problem that asks for the $m$-ball that covers all $x_i \in X$, while having the smallest radius possible.
I am interested in solving a related, more constrained problem. Namely, in my version, the e... |
I'm trying to prove some code is correct, using Hoare logic. How do I check whether my loop invariants are correct?
I'm asked to prove (using Hoare Logic) that the following program is valid:
x=1;
i=N;
while (i!=0){
i--;
x*=A;
}
with the pre-condition that N>=0 and post-condition that x=A^N.
This is my atte... |
String is an immutable class in Java. An immutable class is simply a class whose instances cannot be modified. Why does the Java programming language choose to make objects of class String immutable?
|
Of course a matching polytope is the convex hull of edges in a matching and similarly for a perfect matching polytope.
|
Consider a bipartite graph $G=(U, V, E)$. Each $v \in V$ represents a soccer team, and each $u \in U$ represents a mini-tournament which needs to be scheduled. Tournament $u$ is adjacent to team $v$ if $v$ plays in that tournament $u$. Each tournament uses a full day.
If $u_i$ and $u_j$ share no common neighbor, these ... |
I was wondering how one can find a non-quadratic residue modulo $p$ and what the runtime of this algorithm would be.
I thought that one can use the Legendre Symbol
$$ \left( \frac{a}{p} \right) = a^{ \frac{(p-1)}{2} } \pmod p $$
if the Legendre Symbol returns -1 then its a non quadratic residue and if its a quadratic... |
This question is fairly specific in the manner of steps taken to solve the problem.
Given
$T(n)=2T(2n/3)+O(n)$ prove that $T(n)=O(n^2)$.
So the steps were as follows. We want to prove that $T(n) \le cn^2$.
$$\begin{align*}
T(n)&=2T(2n/3)+O(n) \\
&\leq 2c(2n/3)^2+an\\
&\leq (8/9)(cn^2)+an
\end{align*}$$
and then my pr... |
Say for instance you layout a quantum simulator like follows:
amps = [0] * 8 # 3 qubits
Therefore you are left with the following in binary:
000, 001, 010, 011, 100, 101, 110, 111
Does the third digit in binary represent the third qubit or the first?
One would assume it would be the third but I'm not certain and I do... |
Are there any good examples of promise problems that are NP complete?
|
I am having trouble understanding how to write a regular expression for the set of words that contain at least two b's and at least two a's, where the alphabet is {a,b}.
I understand that set of words that contain at least two b's is: [1] (a+b)*b(a+b)*b(a+b)* and the set of words that contain at least two a's is: [2] (... |
A k-dumbbell is a graph that consists of 2 cliques each of size k with one and only one edge between them. How do I show that finding if a graph is a k-dumbbell is NP-complete?
Proof it is in NP: Given the cliques of size k, I can verify if it they are the cliques of size k.
Proof of NP-hardness: If there is only one e... |
I am attempting to find the most efficient route to get from a source to a destination in a bus network. Each stop is a vertex in a graph, and each edge between vertices represents a route between stops.
The weights of the edges represents how long it takes to complete a particular journey between stops. For example, i... |
I'm a little confused about the concept of the Bellman-Ford(BF) algorithm to compute the shortest path in a general graph with negative weights knowing that there are no negative cycles present. I understand why Dikjstra doesn't work for a graph with negative weights. So in the Bellman-Ford algorithm we decide to updat... |
Hypothetically, let's say you are using the pumping lemma for either regular or context free languages. Now using either, you come across a case that remains true despite pumping it. In this situation, do you have to "throw out" the lemma so to speak? I am under the impression that the answer is yes, but I'm just not s... |
I'm working on a AI project which generates poems in Turkish language like this project: https://github.com/schollz/poetry-generator
It's a successful project but it's a template based poem generator. You can't select a topic for poem generation. It generates poems randomly with hardcoded templates and words.
In my pro... |
I am trying to proof the following statement:
If $ {\rm SAT} \in {\rm PCP}[r(n),O(1)]$, where $ r(n)=o(\log n)$, then ${\sf P}={\sf NP}$.
Here are my ideas for the proof:
It can be easily worked from here that there exists an nondeterministic Turing machine $N$ solving any SAT instance in time $o(n^{q})$ for any $q \in... |
We know that under hierarchy collapse results GI is not NP complete.
Would there be any consequences if GI is equivalent to a promise version of an NP complete problem?
|
I was reading CLRS and it asked to show that if $p$ is a prime of the form $4k+3$ and $a$ was a quadratic residue, then $a^{k+1}$ is a square root (one can also easily show that $a^{-k}$ is a square root).
I was wondering if using the previous fact and also that we knew we had a number of the form $N = 4k+3$ (not neces... |
How can the class of tail recursive functions (TR) be compared to the classes of primitive recursive functions (PR) and recursive functions (R)?
The computation of a PR function always halts. This does not apply to TR functions.
Given a tail recursive function $f$:
$$f(x) = f(x)$$
The function $f$ obviously will res... |
Given a string S of length N, a string A of length M, a string B of length O such that N >= M + O. Check if the string S can be split into two subsequences X and Y such that A = X and B = Y.
Example: S = "abCDEfgH", A = "abfg", B = "CDEH" => answer is Yes
S = "abcDEG", A = "acdG", B = "ED"
I found that this can be solv... |
Given the depth of the tree, I need to calculate the longest possible path in the full binary tree (also known as the diameter).
When attempting this problem, I experimented with what the depth has to do with the path length. However, the solutions I came up with depended on going through the root, while the longest pa... |
I'm inserting numbers 1 thru 15 into a binary search tree one by one. I need to come up with an order to insert these elements for it to result in a full and balanced binary tree. I've tried to create the binary search tree myself, starting with a root of 8, however I could never get it to be full; the depth would incr... |
Let's say I am working on handwritten digit recognition (0 to 9). I know for instance that if I use clustering then I need to look for 10 clusters. But once I have the 10 clusters,how do I identify automatically which cluster corresponds to which digit?
In general, say I have some other classification task where I don'... |
I got confused with the analysis of algorithms in average case. Following is the my perception regarding average case using sorting problem:
Suppose we have a 5 elements array to be sorted using Insertion sort.
Time complexity will depend upon the particular arrangements of
elements in the array. Usually, when alg... |
I am learning about Context Free Grammars and currently stuck on the following question.
Is the following language context-free? If not, then how can we prove it using Pumping Lemma?
$\qquad L = \{a^i b^j c^k \mid i,j,k \geq 0 \land i+j > k\}$.
After spending some time I have been able to generate the production rule... |
I understand the basics of networking(DNS,DHCP,IP,MAC, etc.).
I have installed a router and plugged my computer into the router.
On the other end of the router the cable goes somewhere to a switch(I think). And then to internet. But on the same network my neighbour is also connected. Now my neighbour and I tried to pin... |
I'm trying to understand the run-time analysis in the article [1].
The authors define the following notation: $g(n) = \hat O(f(n))$ if $g(n) = O(f(n)^{O(1)})$. In the run-time analysis of their algorithm, they find that
$$T(l) \leq \hat O(p\log n)10^{\log_{p/2} l} \equiv f(l,p)$$
where $n$ is the number of nodes in the... |
Why does the concatenation of $\emptyset$ with any language give $\emptyset$. I would like to know the intuitive explanation for it.
|
Assume that $L$ is a language, is there any established notation that means that $L$ is infinite or empty?
|
I want to write a Turing machine which checks for unary powers of 2 but without the use 0s, only accepting as input a series of 1s and dashes. I do not know of a sequence of states which would allow me to demonstrate this. I worked out 1 of the 2 I started with, which is make a palindrome checker but as for this I'm cl... |
I have been wondering, what are some ways to handle synchronisation and/or sequencing issues in distributed systems. For example, assume multiple homogeneous nodes listening on a stream of messages and updating a data store based on those messages. Let's say 2 updates for a particular record enter the queue, one at t1 ... |
How do I prove that the Perceptron bound for mistakes is tight? I need to prove that for any amount of given data points, the total amount of updates (mistakes) that the algorithm will make is $\frac{1}{\gamma ^2}$, where $\gamma$ is the margin. I know that I'll have to make it such that for a given $m$ number of data ... |
As I've learned, the Calculus of Constructions has only two binders - $\lambda$ and $\Pi$. Morte, for example, has $\forall$ as a mere alias of $\Pi$. Yet, on the paper Self Types for Dependently Typed Lambda Encodings, there are types such as:
$$\begin{gather}
\mathrm{Nat} := \forall X. (X \rightarrow X) \rightarrow... |
I read a theorem which states that:
If there exists a polynomial time approximation algorithm for solving the Maximum Clique problem (or the Maximum Independent Set problem) for any constant performance ratio r, then NP = P.
But I never understood the reasoning behind this!!
|
I am looking into coding a program that can Analyse an image and identify objects in that environment (incl their depth and contours/shape).
What is the term for this? Is there a term or area of expertise for this? 'Computer Visualisation' is too broad a term I believe. Maybe Computer Vision and Pattern Recognition (CV... |
I have been hearing the phrases quasipolynomial, superpolynomial and subexponential.
I think know what quasipolynomial and subexponential is. I believe these are functions respectively of form $n^{\log^c n}$ and $n^{n^{1/c}}$ for some $c>1$.
What does superpolynomial mean?
|
I am reading about planar graphs from this site.
It says:
The complete bipartite graph K3,3 is not planar, since every drawing of K3,3contains at least one crossing. why? because K3,3 has a cycle which must appear in any plane drawing.
I am not able to get what cycle which must appear in any plane drawing has to do w... |
Note: this is basically a more precise restatement of this question, which didn't get proper answers because it was vague.
Most two-player perfect information games can be represented as a finite directed graph, because although the games could theoretically go on forever, there are only finitely many possible states f... |
I am running a Baum-Welch HMM algorithm (in R). The sequence vector contains a series of observations which have been gathered from a dataset where the data has 17 states.
I can successfully run the HMM algorithm and it converges without any problems when I set pseudo count to 1e-09, below that the algorithm fails.
My ... |
I am reading the paper "Understanding Random SAT beyond the Clauses-to-Variables Ratio" and at beginning of the page 2 say
the hardest region corresponds exactly to a phase transition in a non-algorithm-specific theoretical property of the instance
I am a Spanish speaker. Can you help to understand what means "non... |
For example, for a product, we have a list of the number of products you buy and the corresponding price you pay with this number of products:
number = {1, 5, 8, 12}
price = {0.5, 2, 3, 3.6} (i.e. you pay 0.5 for 1 product, 2 for 5 products and so on)
Now I need to use a fixed number of dollars to buy as many number of... |
I heard Google creates indexes of pages. Even then, the number of indexes goes with time. Why wouldn't this slow down the search?
|
Disclaimer: I am a biologist, so sorry for (perhaps) basic question phrased in such crude terms.
I am not sure if I should ask this question here or on DS/SC, but CS
is the largest of three, so here goes. (After I posted, it occurred to me that Cross-Validated might be the better place for it, but alas).
Imagine ther... |
You have a square matrix of weights $W$ and a square matrix of distances $D$. You want to find a permutation $\sigma$ minimizing $$\sum_{i,j} W_{i,j} D_{\sigma(i), \sigma(j)}$$
Is there a known algorithm for that? Is the problem NP-complete? Is the optimal solution easily approximable?
|
Classify the language
$L = \{xx^Rw\ \big|\ (|x| \geq 0\ \wedge |w|\gt 0)\ where\ x,w\in\Sigma^*\}$
as one of:
Regular but not Context-Free
Context-Free but not Regular
Decidable but not Context-Free
Most generally, $\Sigma^*$ can be any regular language (say $(a+b)^*$).
My first thought is that it can't be r... |
I'm trying to prove that:
$L=\{w\in\{a,b,c\}^*\Big|\#_a(u)=\#_b(v),\ \ w=ucv,\ \ \ u,v\in\{a,b\}^*\}$ is irregular, so I'm trying to use the Pumping Lemma.
This is what I tried so far:
$w=a^ncb^n$, then $|w|\ge n$ and $w\in L$.
By, condition 1 and 2 (of the Lemma) we will get that: $w=xyz$ - such that: $x=a^r,\ y=a... |
Does having one larger L1 cache instead of L1 and L2 cache makes computation faster? Also will this make the CPU more expensive to make?
|
I came across the following question in my revision. I would like to know how to solve this and in general what are the techniques I can use to make an undecidable TM decidable by changing inputs?
Suppose that there is a Turing Machine T when, starting with an empty
tape, will generate an infinite sequence of progra... |
In Lovász writes [1] :
bipartite graph has a perfect matching, which is a special case of the clique problem
Why is bipartite perfect matching a special case of clique problem?
The Work of A.A. Razborov by L. Lovász (1990)
|
I am studying for my final exam in coding-theory class, and as textbook provides poorly written solution to the exercise question, I decided to ask the question here, hoping for more clarification.
Question:
If $C_1$, $C_2 \subseteq V$ are linear codes, with generator matrices $G_1$, $G_2$
and parity-check matrices... |
How large can the number of layers in a neural network be? Can there be maybe 1000 layers with, say, 1000 neurons in each layer?
I imagine the brain has hundreds of thousands of layers.
|
I need to create the combination of 3 elements from a array of given n elements, however every of those 3 el. has to be in "relationship" with each other. Here is an example I can describe my issue better on:
We've got elements 1, 2, 3, 4, 5 & 6. We know following relationships:
1 <--> 2
1 <--> 3
1 <--> 4
1 <--> 6
2 <... |
Is $\{ WxW^{\mathrm{R}} \mid W,x\in\{0,1\}^+\}$ a regular language? If so, why?
The notation $W^{\mathrm{R}}$ means the reverse string of $W$?
If we consider the best answer in this solution, if the language is regular, then its FA should reject all strings not in the language. However, a string such as 0110100 would a... |
I was wondering if the output of an algorithm like Dijkstra was always contained in the minimal spanning tree, however, a counter example to this claim are cyclic graphs like:
The shortest path $B \rightarrow C$ is in no way contained in the MST. Are there known conditions on the graph and the edge weights that ensure... |
In the question below, let TM be Turing machine, NTM be nondeterministic Turing machine and PTM be probabilistic Turing machine.
In his paper "Actor Model of Computation: Scalable Robust Information Systems" Carl Hewitt proposes following hypothesis:
All physically possible computation can be directly
implemented us... |
My data structures exam contains the following question:
Which of the statements below about red-black trees is true? (select one or more)
Every path from the root to a leaf has the same amount of red links.
A node never has two red links to his childs.
Using a red-black tree, you can always draw the associated 2-3 t... |
Hi I am not sure what is exception here and how it will be raised in following case
Sub $11,$2,$4
And $12,$2,$5
Or $13, $2,$6
Add $1,$2,$1
Slt $15,$6,$7
I was reading and encountered that
add $1,$2,$1
will cause an exception. Could you guys please help in understanding what is exception here.
|
Okay lets say i have two data structures . two phone data for example containing their Name and spec ( cpu , ram , display etc ) . I want to check if these two phones are the same or not . Their names can be different as their other features . For example we have a :
Name : Galaxy s3, CPU : Dual core , Display : 4 i... |
m doing a practise quiz which my professor has posted online, one of the questions im very confused about was this one.
Consider the clauses {x,y} , {~x,y} , {~y,z} , {~z,w} , {~w,~y}
is this true or false?
The implication graph contains the following bad loop:
x -> y -> z -> w -> ~y -> x
I said that this statemen... |
The prefix parity problem can be defined as follows. You are given a string $S$ of length $n$ and initially every character is $0$. Then you want to build a data structure that can support updates such as follows.
For a given $i$ change $S[i]$ to either $0$ or $1$
for a given $i$ find the parity of $S[1]+S[2]+...+S[i... |
I can't think of any definition for half-space that would involve some sort of quantity not being homogenous.
This term is used in the paper Robust Concepts and Random Projection in the following paragraphs:
The next problem we consider is learning an intersection of t half-spaces in Rn, i.e., the positive examples al... |
I am trying to understand a proof regarding the Busy Beaver problem that uses a proof by contradiction approach to show $\sum(n)$ is Turing-uncomputable:
Find $\sum(n) = max \{\sum(M) | M \in M(n) \}$
Where
$n$ : Number of states
$M(n)$: Set of Turing Machines with $n$ states and binary alphabet (0s and 1s)
$[k]$:... |
I am wondering about the complexity of the following problem: given a directed graph $G=(V,E)$ (which may have self-loops at some vertices) and a subset of the vertices $U \subset V$, does there exist a collection of vertex-disjoint cycles $C_1, C_2, \ldots$ such that each $u \in U$ belongs to some cycle $C_i$?
When $U... |
I was reading CLRS and is said:
If factoring large integers is easy, then breaking the RSA
cryptosystem is easy.
Which makes sense to me because with the knowledge of $p$ and $q$, it is easy to create the secret key which the knowledge of the public key. Though, it explains the converse statement, which I don't qui... |
As far as I know, presentations of the (general) halting problem (cmp. Wikipedia) are referring explicitly to an ennumeration of (applicable) programs. For the purpose of my questions let's consider specificly any programs for one-head, two-symbol Turing machines with sufficient memory to store the instructions prescri... |
Consider the set of transcendental numbers that are not compressible to a finite base-2 representation. How can I compute multiples (more generally, any algebraic computation) of one of these numbers, while maintaining an error less than $\epsilon$?
I'm curious because I know that I can approximately store a transcend... |
I can find quite a bit of literature on A* but very little on A.
What is the difference between the two search algorithms?
|
I conjecture that, in a Directed Acyclic Graph, $O(|V|) = O(|E|)$. Is this statement correct, can it be refined? This is probably standard material; is there a simple reference about this?
|
I am stucked at this problem:
Let $A=(\Sigma, Q, q_1, F, \delta)$ be a finite deterministic automaton (I.e. $\delta:Q\times\Sigma\to Q$) such that $Q=\{q_1,...,q_m\}$.
Let's define foreach $i,j\in\{1,...,m\}$, $k\in\{0,1,...,m\}$
(Note: the $\delta$ below is the extension of $\delta$ to $\Sigma^*$)
$L_{i,j}^k=\{w\in\... |
As nicely described in this article, backpropagation for multi-layer perceptrons defines the error term for a neuron in terms of the partial derivative of the weights.
It's traditional to represent the weights between neutrons in matrix form: $w_{ij}$ representing the weight between neuroma $i$ and $j$.
Since a weight ... |
I'm interested in the implementation of a Turing Machine (deterministic) in Lambda Calculus.
How should I proceed to do this?
I am not sure on how to start since I must represent the state and infinite tape somehow.
I hope my question makes sense.
Thanks in advance.
|
I was reading CLRS and it mentions that if $p$ is a prime of the form $4k+3$ and $a$ is a quadratic residue, then $a^{k+1}$ is a square root of $a$. One can also easily show that $a^{-k}$ is a square root of $a$ as well.
Can we use this to get a primality test, for numbers $N$ of the form $N=4k+3$?
After reviewing Mil... |
As stated here https://books.google.cz/books?id=dwpeNRgjK68C&pg=PA57&lpg=PA57&dq=uniform+halting+problem&source=bl&ots=qsbv_672W9&sig=NDcebhxrwcYdF-P15dor565l8Jc&hl=en&sa=X&ved=0ahUKEwj5mpG-zNTJAhUH6A4KHSB_DOI4ChDoAQgpMAI#v=onepage&q&f=false
Uniform halting problem is variation of Halting problem and asks the question ... |
How to construct a single-tape Turing Machine which writes the number 7 in UNARY number system, leaving the tape with a delimiter symbol followed by 7 1s?
So outout would be a tape contains #111111 and blank symbols afterward.
|
Can we show that following language is not context free using Push down automata approach?
L = {a^i b^i a^i : i>=1}
For every a we will Push 'A' onto stack, for every b we will pop 'A' out of stack so at the end we will have a's onto stack and the input word would be empty as string would be something like aabbaa
Doe... |
Use the pumping lemma to prove that the following language is not context-free.
$\qquad L = \{ w w w \mid w \in \{a,b\}^*\}$
I am studying for an exam and really trying to understand this question. For some reason the third w is throwing me off.
I first tried using the string $a^p b^p a^p b^p a^p b^p$ but didn't get ... |
You are given a tree $T=(V,E)$ along with a designated root node $r \in V$.The parent of any node $v \ne r$, denoted $p(v)$, is defined to be the node adjacent to $v$ in the path from $r$ to $v$. By convention, $p(r) = r$.
For $k > 1$, define $p^k(v) = p^{k−1}(p(v))$ and $p^1(v) = p(v)$ (so $p^k(v)$ is the $k$-th anc... |
I am comparing several different algorithms for navigation applications. Since I may possibly be publishing a paper comparing the performance of these algorithms with each other, I was wondering the best way to go about measuring performance.
As far as I know, there are two ways to compare performance: writing the code... |
I'm playing around with Coq and Software Foundations and is somehow very confused by something I took for granted since forever.
To prove
Theorem app_length_cons : forall (X:Type) (l1:list X) (x:X),
length (l1 ++ x :: l1) = S (length (l1 ++ l1)).
we can first prove
Theorem app_length_cons... |
The original problem statement is:
Given a sequence of numbers $A[1..n]$, find $k < n$ consecutive numbers such that the sum of these $k$ numbers is maximized where $k$ is a positive integer given together with the sequence. Specifically, we want the index $i$ such that $A[i+1..i+k]$ is the largest.
Design $O(n)$... |
First of all, I have just started studying computer science by myself and maybe I just need some clarification of what "polynomial time" means regarding the time complexity of an algorithm and references to study it well.
As I have understood it, whether integer factorization can be done in polynomial time is still an ... |
You are given $N$ $(1 \le N \le 10^6)$ positive integers $a_1, a_2, \ldots, a_N (1 \le a_i \le 10^6)$
and two positive integers $D$ $(1 \le D \le 10^6)$ and $M$ $(1 \le M \le 10^6)$
Find the longest contiguous subsequence such that
its sum $(a_i + a_{i+1} + \cdots + a_j)$ is divisible by $D$, and
$(a_i + a_{i+1} + \c... |
We know that the lower bound for comparison-based sorting algorithms is Ω(nlogn), where logn being the binary logarithm of n. But what about for the best-case scenario of the bubble sort, which takes O(n) time? Of course, n is faster than nlogn. Why is that?
However, I don't know if this bound only applies for the wors... |
According to me, maximal paths in a graph are those paths which cannot be included in any other larger paths. Could anyone please explain me this with some examples? Also what would happen if the graph happens to contain cycles?
|
I'm a bit confused as to wear exactly the dynamic link points to on the activation record. I understand that it points to the 'top' of the instance of the callers activation record but I am unsure of where the 'top' is.
Based on an example from my textbook:
It would appear to me that the 'top' of the calling function... |
I cannot quite feel the difference between two models.
The first one is read-only Turing machine which is basically the same as Turing machine with write protected input. See this question for example: Single-tape Turing Machines with write-protected input recognize only Regular Languages
It was said that it indeed rec... |
Consider this distance matrix of an asymmetric TSP instance:
$$
\begin{matrix}
& c_0 & c_1 & c_2\\
c_0 & 0 & 1 & 2\\
c_1 & 2 & 0 & 1\\
c_2 & 1 & 2 & 0
\end{matrix}
$$
One optimal tour (with a total distance of 3) is clearly: $$ c_0 \rightarrow c_1 \rightarrow c_2 \rightarrow c_0$$
Now we can reformulate this as an ILP.... |
My book says a language is in NP if it can polynomially verified if a string belongs to the language with a certificate. It puts no restrictions on what the certificate can be.
For instance, for SAT, the certificate could simply be be the assignment values. We just sub them in and see if it satisfies the expression.
Bu... |
I've been reading a number of quantum computation research papers that claim quantum cost's that do not add up.
For instance, in this paper - there is a claim that the MTSG gate is a quantum cost of 6. But to actually perform the computation, you need swap gates to get the stuff into the right order!
For instance, to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.