instruction stringlengths 35 29.1k |
|---|
I am working on a simple quantum circuit identity. I proved it on paper with the tensor product, but i'm having trouble showing that with qiskit. I know I need to measure them somehow but i don't know how.
Can someone help? :)
|
Related to my answer on this question, I'm not sure of a detail.
Assume you have a Turing Machine which simulates all possible Turing Machines all at once (meaning it does not "page" its data, i.e. it can't erase data from one "process" to write data from another "process"; it must keep all "processes" "in memory" at t... |
I have solved that the recurrence of running time of the algorithm given as
$$
T(n) = \begin{cases} \Theta(1) & \text{if n=1} \\ T(n-1)+\Theta(n) & \text{otherwise} \end{cases}
$$
So the question is that solve the recurrence that I have solved above.
So this is my answer.
Case 1
Show that $T(n) = \Theta(n)$
Guess $T(n)... |
I understand how monadic computation works, I am just wondering where does the name come from. I cannot relate the thing that the bind operator actually does (i.e. unbox the monadic value, and then apply a function to produce another monadic value) and the name bind (which, to me, means associate two things together).
... |
How to answer on many requests by type:
Count amount simple paths passing through chosen edge in an acyclic undirected graph using dynamic programming?
|
Write a parallel algorithm which runs in $\Theta(n)$ time and transposes an $n \times n$ matrix on the $2D$ mesh SIMD Model with wraparound connections. Processing element $P(i, j)$ has local variables $A(i, j)$ and $T(i, j)$, where $1 \leq i, j \leq n$. When the algorithm begins execution $A(i, j) = a(i, j)$. After e... |
Suppose I want a function like
f: ((A, B) -> C) -> A -> B -> C
A statement I've often seen made is that f has just one implementation, namely the 'curry function', i.e. g => a => b => g(a, b)
Taken at face value this doesn't seem to actually be true, I can always define f as acting differently from this in special case... |
I think the intuition is to disprove this by counter example, but what are 2 specific well known problems I can use as counter example?
|
I'm having some difficulty understanding ip addresses. Let's say:
Question Info:
private subnet 192.168.0.0/24
IP addresses 212.201.49.1-5
Now, a host 192.168.0.2:1234 retrieves a web page from the web server at 42.35.12.33.
Then, host 192.168.0.5:1234 retrieves a web page from the web server at 100.12.45.11
Answer Par... |
I know that 3SAT is in NP and 2SAT is in P. And 2SAT can reduce to 3SAT just says 3SAT is strictly harder than 2SAT, so I don't think this proves P = NP, but it doesn't seem to disprove it either.
|
Im trying to find an algorithm which returns array elements that a[i] > 2a[j] with i < j in O(nlogn). I can think how to implement this algorithm using double for but i cant implement it in O(nlogn). Does anyone have an idea about how to implement that?
|
From some of the texts I read, one definition of NP is: "An equivalent definition of NP is the set of decision problems solvable in polynomial time by a non-deterministic Turing machine." and that we have the following, where $n$ is the length of the input:
$$
\text{NP}=\bigcup \text{NTIME}(n^k)
$$
This means that one ... |
Can someone please explain to me why this function runs in O($n^2$) rather than O($n^3$). I feel like since that for loop runs in O($n^2$) and f() is recursively called around n times, that it should end up being $n\cdot n^2$ for an overall O($n^3$).
f(n) {
if (n == 0) {
return 0
}
int result = 0
... |
Intuitively if A can reduce to B, and B is NP-Hard, A might be NP Hard but maybe not. If there is a way to solve A that does not involve reducing to B, it might be faster.
How do I formally disprove this statement using a counter example or some well known algorithms, or using some other technique?
|
I am looking for an optimal solution of an interval scheduling variant.
Basically, given n tasks with the start time Si and end time Ei, select EXACTLY two tasks whose execution periods are maximum and do not over lap (Equal start/end time counts as overlapping).
So if there are these task [9-14], [7-13],[1,4],[2-5],[2... |
To the best of my knowledge, the best algorithm for the minimum s-t cut in a weighted digraph is the Goldberg push-relabel algorithm with $O(n^{2}\sqrt{m})$ time complexity. I'm interested in solving this problem as a separation sub-problem inside a branch and cut algorithm, so I don't always need the optimal solution.... |
We have $h_1(n)$ and $h_2(n)$ which are both admissible heuristics. We know that $h_1(n) < h_2(n)$ for every state $n$ in a search problem.
Now we are given two heuristics $h_3(n)=\frac{h_1(n)}{1+h_2(n)}$ and $h_4(n)=\frac{h_2(n)}{1+h1(n)}$ and we want to prove $h_3(n)$ and $h_4(n)$ are both admissible.
|
The class of function $\mathcal{F}$ is PAC-learnable if there exists an algorithm $A$ such that for any distribution $D$, any unknown function $f$ and any $\epsilon, \delta$ it holds that there exists $m$ such that on an input of $m$ i.i.d samples $(x, f(x))$ where $x\sim D$, $A$ returns, with probability larger than $... |
Given an alphabet $\Sigma$, let $c=|\Sigma|$. Can a set of languages $\{L_k\}$ be created, such that any DFA for $L_k$ has $\Omega(c^k)$ states and a NFA for $L_k$ exists with $O(k)$ states?
I'm having trouble creating an $L_k$ such that any DFA for it has $\Omega(c^k)$ states. There are constructions that require $\... |
I have a following graph-based problem:
Input: positive integers K and L, undirected graph G
I have to choose K vertices from this graph
In the path between each pair of chosen K vertices there has to be at least L vertices, i. e. there has to be a "space between" each two of chosen vertices made of at least L v... |
I am trying to solve a maximization problem using the Tabu search algorithm but there is no relevant code available on the internet. Any kind of sample code is highly appreciable.
My function is F(x)= x^3-60.x^2+90.x, 0 < x < 31
|
I am reading the following paper:
MPCircuits: Optimized Circuit Generation for Secure Multi-Party Computation
Paper Link
I have following question:
We have two groups shown in the circuit. Why we call it a multi-party circuit?
Paper provides a comparison of its multi-part technique with the old 2 part based technique:
... |
The unrestricted grammars characterize the recursively enumerable languages. This is the same as saying that for every unrestricted grammar G there exists some Turing machine capable of recognizing L(G) and vice versa.
Context: Grammars are Turing-complete. Therefore complexity classes like NL have equivalences in gr... |
I have an instance of the stable marriage problem in which the first side $S_1$ has $n_1$ agents and the second side $S_2$ has $n_2$ agents with $n_2$ is very big in comparison to $n_1$. In addition, the agents of $S_2$ have the same preference list. The stability constraints can be modelled as follows:
$ 1 \leq \sum\l... |
I came across this problem online and found no solutions or insight. The problem is stated as:
Given a map as a square, and a set of locations on the map, users are able to select a rectangle on the map and all of the locations on the map are returned
How would you preprocess the map data so that the find operation ... |
I have a problem statement where i am having many inputs lets say A,B,C,D.... and this inputs can take any real value(e.g A-a1,a2,a3, B-b1,b2). Now, i have file which will be have record of the all the inputs and there values at given point of time. I also know what should be the specific sequence for example A-a1,B-b1... |
I want to create a regular expression for the language:
$L=\{w \in \{0,1\}\mid w \text{ does not contain 00 as a substring}\}.$
I've tried various things, but I can't seem to get the correct regular expression.
|
We have an array of numbers and we are supposed to do the following queries on it:
Add number x to all elements on the subarray with indices [ L, R ] of the array.
Query for number of elements less than number x of the whole array.
Note that x is given in each query and is not fixed.
I have a solution with time compl... |
Many references say that the large constant term is hidden in the calculation of the time complexity of the Strassen algorithm.
I want to know how the huge constant term is constructed or how it is calculated mathematically. (assuming when n matrices are given)
You can add more matrix constraints to help with the solut... |
Given a grammar where every rule has the form $X \to YZ$, $XY \to Z$ or $X \to a$ where $X,Y,Z$ range over nonterminals and $a$ ranges over terminals, and given a nonterminal $S$ and a terminal $a$, determine whether $S$ can derive $a$.
What complexity class does this correspond to?
Related questions:
What complexity c... |
I want such data-structure, which can:
add element at the end of the array in $O(log (n))$.
find out the minimum value in the sub-segment in $O(1)$
|
Let $G$ be a connected weighted undirected graph. Let $T$ be a minimum spanning tree (MST) of $G$. Consider removing an edge $e=(a,b)$ from $T$, which will give two subtrees $T_a$ and $T_b$, where $Ta$ contains the vertex $a$ and $T_b$ contains the vertex $b$. Now consider the subgraph of $G$, $G_a$, which contains the... |
I'm searching a data structure that supports O(1) concurrent insertions (thread number is known in advance) and iteration over its elements (insertion order doesn't need to be preserved).
While one thread is iterating over the elements there won't be any insertions.
So basically I'm looking for a concurrent dynamic arr... |
Is it a good idea to store a pointer to the parent node in a binary search rather than to find the parent node several times?
struct BSTNode
{
Node* leftChild;
Node* rightChild;
Node* parent; //nullptr for root
int data;
};
or
struct BSTNode
{
Node* leftChild;
Node* rightChild;
int data... |
This is my first question here!
If I have a non-planar graph where every vertex connects to 3 other vertices, and where the edges are allowed to intersect, how do I find the boundary of the graph?
For example in the below graph, the pink line shows the boundary of the graph which needs to be found. The boundary should ... |
Suppose we have a weighted undirected graph $G$ and a minimum spanning tree $T$
Let $G2$ be a new graph by increasing the weight of one edge $e = (a,b)$ that is part of $T$.
I'm using a common algorithm to update $T$ so we don't have to find a mst of $G_2$ from scratch. The algorithm is to first take out $e$ from $T$,... |
I would like to encode a binary tree where every node has either 0 or 2 kids into a binary word.
I was thinking about marking every left edge with a "0" and every right edge with a "1"
and then use every path from root to a leaf concatenated to encode the tree, but I'm not sure if this results in a unique code for ev... |
Let $ n∈N $ . Construct a circuit with $ C_n(x_1,\dots,x_n) $ with $ 2^{2^n} $ outputs $ y_1,\dots,y_{2^{2^n}} $ which computes all
distinct boolean functions $ f_i:\{0,1\}^n→\{0,1\}$ such that $ y_i $ is the
output of $ f_i $ and satisfying $ Size(C_n)\in O(2^{2^n}) $
Remark: The circuit is in a model of fan-in ... |
I'm interested in creating a graphs whose vertices are strings, and whose edges represent the relation of having an edit distance of 1 under a given string metric.
An obvious approach is to make all $\frac{n^2-n}{2}$ comparisons among the $n$ vertices, giving us $O(n^2)$ time complexity.
Excluding parallelizing the com... |
Given a grammar where (every rule has the form $X \to YZ$, $XY \to Z$ or $X \to a$), (($X \to YZ$) implies ($X \to ZY$)) and (($XY \to Z$) implies ($YX \to Z$)) where $X,Y,Z$ range over nonterminals and $a$ ranges over terminals, and given a nonterminal $S$ and a terminal $a$, determine whether $S$ can derive $a$.
What... |
Given a grammar where every rule has the form $X \to YZ$, $XY \to Z$, $X \to a$, or $X \to \epsilon$ where $X,Y,Z$ range over nonterminals and $a$ ranges over terminals, and given a nonterminal $S$ and a terminal $a$, determine whether $S$ can derive $a$.
(Thanks Yuval Filmus for pointing out this characterization - se... |
I was going through the classic text "Introduction to Automata Theory, Languages, and Computation"
by Jeffrey Ullman,John Hopcroft and Rajeev Motwani, where I came across the simulation of MULTI-TAPE turing machine using SINGLE-TAPE turing machine as follows.
Before the simulation the MULTI-TAPE turing machine is defin... |
I don't know this is off-topic (if not, someone can direct me to the proper Stack), but here goes: Let's say there is some algorithm $T$ that can find the integer roots of any arbitrary real-valued continuous univariate function $f(x)$. For any value of $x$, $f$ can be computed efficiently ($O(n^k)$, where $k$ is some ... |
I'm trying to implement graph power calculation using BFS. According to Wikipedia, BFS with depth limit k will suffice (I'm using adjacency list representation, my graphs are sparse, so adjacency matrix power is not optimal).
Complexity of BFS is O(V+E), running it for every vertex is trivially O(V*(V+E)). I also hav... |
Consider we need to solve the Matrix chain multiplication using dynamic programming for this problem :
The table for min. cost is shown below :
Edit : Reference https://www.radford.edu/~nokie/classes/360/dp-matrix-parens.html
The table for Optimal locations for parentheses:
I know how to construct these tables but ... |
I am wondering if we had a large array to sort (let's say 1,048,576 random integers), chosen because it is a perfect power of 2, if we can just keep dividing those blocks into smaller and smaller half size blocks, how would someone know (on a particular computer using a particular language and complier) what the ideal ... |
Is it possible that using the Machine Learning classification model we can classify/predict the LOCATION/ORIENTATION of the lot number and expiration date on different vials label?
If yes, possible approaches.
Update: So far what I have observed is with EAST model
https://arxiv.org/abs/1704.03155
one can locate text i... |
I have ran into a wall with this question in the exercise my teacher gave me, is there any actual connetion between the Von Neumann architecture and imperative programming ?
I have tried googling and finding questions similar to this, but I couldn't find anything, and the one question that I have found actually said th... |
I am trying to write a compiler that converts a simple imperative language to SSA form, but I am having trouble with loops. As an example, I have some code that looks like:
fun count() {
i = 0;
while(i < 10) {
x = i + 1
i = x;
}
return i;
}
I then convert it to a control flow graph that... |
In 2-D dynamic programming problems like Edit Distance and binary knapsack, there can be multiple optimal solutions. By tracing back from the last element in the matrix one could trace out all the possible solutions.
Here's the question: How to count the number of unique optimal solutions without backtracking? Is it e... |
How do I convert this PDA to CFG?
I am currently stuck with this, any help would be appreciated, thank you in advance!
|
Consider the following question
There are K magical pens (numbered 1 through K). You are given strings P1,P2,…,PK (each of which consists of characters from 'a', 'b', …, 't') ; for each valid i, the i-th pen can only write letters from the string Pi
.
You want to write a word S
of length N. All the characters of S are... |
Assume A is an m sized array containing n ($m \ge n$) natural numbers (excluding $0$), sorted on the left of it.
All remaining cells on right are filled with zeros.
For example, $m=10, n=4$:
$$A = \{5,7,11,24,0,0,0,0,0,0\}$$
How can I find the index of a natural number x in A with $O(\log \boldsymbol{n})$ complexity?
E... |
Is there a language A that cannot be polynomially reduced to by some language B? Or is it always possible to reduce a language B to A?
|
In my code i want to solve the Fermi-Dirac-Integral numerically. This can be achieved with a Polylogarithm.
Actually I'm coding in C#, so my function to calculate this polylogarithm looks like that:
public double PolyLog(double s, double z)
{
double sum = 0;
for (int k = 0; k < 1e5; k++)
sum += Math.Pow... |
Show that there are at most $\lceil n/2^{h+1}\rceil$ nodes of height $h$ in any $n$-element binary heap.
How can I show this? Or, how can I prove this?
|
Prior to ASCII existing, we already had at least four number systems, namely
Binary
Decimal
Octal
Hexadecimal
So what were the needs that lead to the implementation of ASCII codes? Why was this code chosen, from a computer architecture perspective?
I have searched online, but I haven't found a satisfactory answer.... |
People in theoretical computer science stack exchange advises me to ask this question here. I ask the same problem in https://cstheory.stackexchange.com/questions/46668/examples-for-derandomization-via-small-sample-spaces and if you are interested in answers there, you can go to see it.
I read the book the Probabilisti... |
In many algorithms, it's easy to understand how the algorithm is executed, but as for why it works well and how it can work, it's not very easy to see, sometimes, authors construct trees or graphs to put things analysed in them and use those structures to describe the property of the research object and prove some prop... |
Given a polynomial circuit consisting of only $AND$ and $OR$ gates. Is it true that any such circuit is easily parallelizable i.e. it belongs to the complexity class $NC$?
I think this is the case but I can't find a source confirming it.
|
Focusing on the 2D plane:
Lawson's Flip Algorithm works in worst-case $O(n^2)$ flips. I have seen it mentioned that (other?) flip-based algorithms work in expected $O(nlogn)$ time for two dimensions. What is a simple example of an algorithm like this (perhaps with proof of complexity)? How would this be found?
Edit: If... |
Is it possible to convert any problem in P to any other problem in P in polynomial time?
|
Given two ellipsoids $\mathcal{E}_1 = \{ X | X^T A_1 X + 2B_1^T X + C_1 \leq 0\}$ and $\mathcal{E}_2 = \{ X | X^T A_2 X + 2 B_2^T X + C_2 \leq 0\}$ both non-empty, it is possible to test if $\mathcal{E}_1 \subseteq \mathcal{E}_2$. Indeed, by the use of the so called S-procedure, $\mathcal{E}_1 \subseteq \mathcal{E}_2$ ... |
I am studying Computer Architecture,
and am a bit confused about the difference between device descriptors and device handlers in operating systems. Am I correct in saying that a device handler is actually a device driver?
What confuse me is that while the terms
device handler and device handler appear in the course s... |
Suppose we have a complete graph, with say 100 nodes. We divide the nodes in the graph into groups, for example 10 nodes in each group, identified by color. We want to obtain a minimum spanning tree under the constraint that at least one node will be present from each group ("group spanning tree").
How to write an eff... |
I have noticed that in the blossom algorithm, we need to find the blossom while finding the augmenting path. What will happen if I just know there is a blossom in a graph and the contracted graph has an augmenting path. Will the original graph not have that augmenting path or will be same?
|
Traditionally, the $W$ hierarchy is defined around the problem of weighted circuit satisfiability. More precisely, the class $W[t]$ is defined as the closure under $\mathrm{fpt}$-reductions of the following problem.
Given a circuit of weft at most $t$, and depth bounded by a constant, decide whether there is a satisfyi... |
I know it's a silly scenario but I wolud like to know if it's relevant and maybe there are some sort of theory/studies on it or it's merely a non-sense situation.
Immagine a language much close to a Turing machine that is compiled in an higher language (let's say C). This language can accept an integer as input, but us... |
Consider the decision problem: Subset sum. For an input set of integers, it asks for a Yes/No answer to the question of whether or not we can find a subset of elements of this input that add up to 0. The output for this problem is $O(1)$ and simple (e.g. 1/0). This problem is NP-Complete, which as far as I understand i... |
I came across this question:
At the beginning of transmission t, a TCP connection in congestion avoidance mode
has a congestion window w = 60 segments.Packet loss is observed during transmission
rounds t, t+10, and t+20 by getting multiple ACKs. What is the congestion window
at the end of round t, t + 10, and t + 20? ... |
apologies if this is in wrong place (very new to CS). I know there must be some flaw in my reasoning here, but I can't quite see it. Here's how I've stated the problem.
There are two generals, A and B. Messages start from A with a request M and B replies with an agreement N. Thereafter, the generals must exchange ackn... |
Subset Sum is a well-known dynamic programming problem, which states that given a succession of numbers and a number, the algorithm determines if exists a subset that its sum is equal to the given number. I was asked to use this algorithm (however it is implemented) at most $O(n)$ times to build a subset which satisfie... |
For TSP there are well known heuristic and approximation solutions which run in low-polynomial time, like Christofides / 2-OPT and so on.
I need a practical, fast algorithm, ideally sub-quadratic complexity, to solve the minimum weighted set cover problem (which is NP hard). It solves subproblems in a genetic algorithm... |
The top accepted answers to the questions below allude to two complexity classes of optimization problems: NPO and PO (in relation to NP and P for decision problems):
Decision problems vs "real" problems that aren't yes-or-no
Optimization version of decision problems
“NP-complete” optimization problems
The way these... |
Suppose there are n nodes.
These nodes are connected by m unique directed edges. Sets of these edges may form cycles.
Each node has an associated quantity.
r of these nodes are selected as root nodes.
A node a can be said to reach node b if
a is b or
there exists a directed path from a to b.
The goal: For each root n... |
So I have a problem in which I have two lists of physical exercises (routines) and I want to merge them such that the merged list maintains the relative order of the previous lists, so for example, if the list A is [a,b,c] and the list B is [d,f,g], a valid merge between the two may be [d,a,f,b,g,c], or even just the c... |
Suppose I have a hash table which stores the some strings. Let the index/key of this hash table be the length of the string. what is the time complexity of checking if the string of length K exists in your hashtable? is it O(1) or O(k) ?
|
I'm solving distance-d independent set problem, as a follow up to my last question. I'm not quite experienced in a subject, so I'm looking for a simple algorithm (which has to be an exact algorithm). So far I have:
Input: undirected planar grid graph $G$, which might not be "full", but be a subgraph of a full rectang... |
Problem statement
I am looking for an algorithm to maintain a very large number of disjoint sets under node and edge additions. Due to the data size, keeping everything in memory is not feasible, so the algorithm needs to work efficiently with SSD storage.
Ideally, the algorithm should:
support link(v1, v2) operation ... |
Before anything I want to preemptively thank anyone who drops by for their patience, I don't have any formal CS background so I'm probably going to use some of these terms wrong.
I have a puzzle: Given two numbers which define a set of continuous counting numbers of the same number of digits, between roughly 5 and 12 d... |
I am reading the Resolution proof system exponential lower bound via Haken's bottleneck method for the Pigeonhole Principle as presented in Arora and Barak's Computational Complexity: A Modern Approach, Chapter 15. However, I don't like how the proof is presented in the book and I am having some difficulties following ... |
I'm quite struggling with calculating the probability of a rule for a PCFG.
I've been looking for examples online and more information, but I am none the wiser.
Here is an image of the slides. I cannot understand how the numbers are calculated on the left. From what I understood, I have to take a rule and see how many ... |
I saw several questions discussion the benefits of adjacency lists over matrices to represent a sparse undirected graph. On the other hand, none of them discuss sparse matrix representations such as scipy's coo or csr formats.
Do adjacency lists still provide benefits in this case?
Definitions of the above:
Adjacenc... |
I've been trying to create a NFA that accepts strings that end with a letter that exists in the string. For example abcdb, cbdd, acac etc. while strings like abc aacd etc are not accepted since the last letter wasnt in the string before the last letter was read. I only seem to be able to create a NFA that accepts a sub... |
I have an exam in two days and I am not sure if I have understood correctly the way of proving np-completness and how to pick a known np-hard problem to reduce it. Bellow I present a problem which I need help with to understand how to prove it's NP-complete. Any help will be much appreciated!
[Background] A directed gr... |
I was going through the classic text "Introduction to Automata Theory, Languages and Computation" by Hopcroft,Ullman,Motwani where I came across the simulation of a turing machine using a real computer. There the author argued that it shall be almost impossible to carryout the above simulation (not considering universa... |
Suppose you have a system that consists of $m$ slow machines and $k$ fast machines. The fast machines can perform twice as much work per unit time as the slow machines. Now you are given a set of n jobs; job $i$ takes time $t_i$ to process on a slow machine and time $\frac{1}{2} t_i$ to process on a fast machine. The g... |
Assume that Alice and Bob are respectively given two strings $x \in \{0,1\}^n$ and $y \in \{0,1\}^n$ such that the hamming distance between $x$ and $y$ is either $> n/2+\sqrt{n}$ or $< n/2-\sqrt{n}$.
Alice picks a set $A \subseteq \{1,...,n\}$ of size $k$ uniformly at random, and sends to Bob the set $\{(i,x_i) \mid i... |
Consider a set of n elements whose key values are $$0, 1, ..., n−1.$$ Let $p(i) (0 ≤ i ≤ n−1) $ be the probability that the element with key i is searched. Assume the following distribution of $p(i)’s$:
$$p(i) =
\begin{cases}
1/2^{n−1}, & \text{if i = 0} \\
1/2^i, & \text{otherwise}
\end{cases}$$
Assume linear search... |
I would appreciate anybody's help with a problem I am trying to solve.
A little background:
given is a social network consisting of people represented as a directed graph, with edge from person A to person B if person A is a follower of pers B on that network. For any set S of people, we say that S reaches all people... |
We have to maintain an array $a_1,\ldots,a_n$ supporting the following operations:
Assign $a_i = x$
Given $\ell,r$, return $\sum_{i=\ell}^r a_i$
Given $\ell,r$, return $\sum_{i=\ell}^r \sum_{j=\ell}^r a_i a_j$
Given $\ell,r$, return $\sum_{i=\ell}^r \sum_{j=\ell}^r \sum_{k=\ell}^r a_i a_j a_k$
After $O(n)$ initializa... |
I wrote a program recently which was based on a recursive algorithm, solving for the number of ways to tile a 3xn board with 2x1 dominoes:
F(n) = F(n-2) + 2*G(n-1)
G(n) = G(n-2) + F(n-1)
F(0) = 1, F(1) = 0, G(0) = 0, G(1) = 1
I tried to calculate the complexity using methods I know such as recursion tree and expansio... |
When given the string and the property in question as a potential certificate. Is there any classification theorem that says something along the lines of: all properties (of strings) that have this property (as a sub property) are verifiable in polynomial time?
Are there any collections of types of patterns in strings ... |
Problem Statement
I came across this problem here. For given arrays $A$, $B$ and $C$ arranged in ascending order, we need to minimize the objective function $f(a, b, c) = \max(a, b, c) - \min(a, b, c), a \in A, b \in B, c\in C$.
It can be thought of as a problem to select a number from each of the three arrays such tha... |
I'm not exactly sure how to approach this problem. I was thinking we would need to detect a vertex in a cycle, then run DFS on it while also orienting the edges along each vertex u in the cycle, to be directed from u to some vertex v incident to it. But I am not sure what edges cases I might be overlooking, or whether ... |
For school I have a big assignment on hashtables etc. One of the functions is a size_t function where we calculate the hash value. (Keep in mind the structure of every function is given so we are not allowed to change input variables/function types). However, the hash calculator function does need to handle errors, but... |
I have a directed graph that has positive weights (but there are reverse arcs) and I am trying to find the shortest path between a given source, s and a given sink, t but the path should also contain two given arcs in a sequence. Say we are given arcs a1, a2, we want to find a simple shortest path that goes from s to t... |
In a simple uniform hashing with chaining collision, the time complexity of a successful search is: $Θ(1 + (1 + \frac{α}{2} - \frac{α}{2n}))$ where $α=\frac{n}{m}$, but I don't understand how to determine it.
I tried to calculate the cost of access of each node in the list and to divide it by the number of elements of ... |
Are unguarded affine programs Turing-Complete?
Are affine programs with affine guards Turing-Complete?
Unguarded program: all branches are taken
Affine program: only assignments like $x:=x_1+5x_2-x_3+4 $(Affine equations as right hand)
Affine guards: all conditional branches have only affine guards, for instance $x_1+x... |
Does it simplify to $O(\log n)$ or $O(\log^2 n)$ or something else entirely? I am a bit stuck on this one.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.