instruction stringlengths 35 29.1k |
|---|
I'm trying to calculate the complexity of the saxpy method, which aims to solve the equation $y=\alpha*x+y$, where $x$ and $y$, are vectors and $\alpha$ is a scalar.
There two versions of the algorithm, with loop unrolling and without, the version without (as seeing below), I've manage to find the complexity, been $2n$... |
I'm trying to construct an unrestricted grammar for strings of the form XWX, where W is the reverse of X, over the alphabet {a, b}.
I think I can apply similar logic to the a^nb^nc^n solution (below), but am running into issues.
S ->
S -> aSBC
CB -> BC
aB -> ab
bB -> bb
bC -> bc
cC -> cc
I've thought about it a lot, ... |
Let's say I have a semantic segmentation model that distinguishes between 100 classes of objects, and the speed of running the model is 1 image per second.
Now let's say I take the same model architecture (with untrained parameters), and train it to distinguish between just 2 classes of objects.
Is there any theoretic... |
The problem goes like this:
Write a function, nonAdjacentSum, that takes in an array of numbers as an argument. The function should return the maximum sum of non-adjacent elements in the array. There is no limit on how many elements can be taken into the sum as long as they are not adjacent.
I am struggling to unders... |
Suppose we have an NP-complete problem A, an NP-hard problem B, and a polynomial time reduction from A to B exists. Do we have a polynomial time reduction from B to A as a result?
|
I'm trying to solve a recurrence problem using substitution method:
Given the following recurrence equation:
$
T(n) =
\begin{cases}
3 &n = 0 \\
3T(\frac{n}{5}) + T(\frac{n}{6}) + n&n > 0
\end{cases}
$
provide a tight asymptotic bound for the solution
I've been trying to understand how the recursion tree is m... |
I am reading Sipser's Introduction to the Theory of Computation, and encountered two propositions:
$A = \{0^k1^k \mid k ≥ 0\}$ is nonregular language (pumping lemma).
Any language that can be decided in $o(n\log n)$ time on a single-tape Turing machine is regular.
The author shows how to construct a Turing machine th... |
Given the following code:
int p = 5 , q=2;
int f( int b, int c){
b = 2 * c;
c = 3 + p;
return b + c ;}
print f(p,q);
print p;
print q;
I have found that the output values using call by value are:
f(p,q)=12
p=5
q=2
And as far as i know also the output using call by reference in this example ,gives the same values.Am I r... |
Consider the following example problem. Given a graph with edge weights, find a matching that maximizes the number of matched vertices, and subject to this, maximizes the total weight. This problem can be reduced to simple maximum-weight matching as follows:
Construct a graph in which the weight of each edge $e$ is $(... |
I apologize if this question is a duplicate as i cannot find a similar question in this community forum, please comment the post in which this may be a duplicate of so i can update this post :)
Im a computer science student currently taking on Introduction to computer science, we recently learned about Big O and its fo... |
Prove or refute.
Let $ L = \{ w \in \Sigma ^* :\ |w| \geq 1000 \} $. Let $ P $ be a non-regular language. Then $ L \cup P $ is regular necessarily.
I think it is true, but I don't have any idea about how to prove is formally. It is just that when the word becomes greater than 1000 it will be inside the language. Can ... |
I am now learning about automation and I am wondering if personal computers use NFAs or DFAs.
I believe it uses a DFA since when we are clicking on something it is in a way determined what will happen. Any thoughts? :)
|
I am envisioning a priority queue that is a bit strange. It represents wanting to do a depth-first left-to-right walk of a tree, but allowing for parallel workers where there can be time between assigning a node to a worker and getting new child nodes back to explore, leaving the depth-first left-to-right property as a... |
Yet another question from an exe. in the Computability class taught by Z. Luria -
I'm not really sure how to prove the undecidability, moreover, didn't a finite language always decidable?
I mean we can build a machine $M$ that checks all the possibilities (In this case ${0, 1, 00, 01, 10, 11}$), That was my approach fo... |
This question is part of the undecidable lecture by Jeff Erickson.
$$\{\langle M\rangle\mid M \text{ accepts at least one string }w\text{ in space }|w|^2\}$$
We should prove that this language is undecidable. So what i tried is to create a new TM $M'$ where $M'$ moves $|w|^2$ steps to the right and than tries to accept... |
I am working on a project for my CS subject and the topic is Video compression. After theoretical aspect, I want to implement and describe one algorithm that does video compression. I am not sure if these type of questions are allowed here but: what would be the best (the easiest) algorithm to implement for an entry le... |
The naive approach, which is the first thing that came to my mind, is to use some sort of backtracking to generate all subsets of the given set of strings and then to find the subset with the maximum number of strings that satisfies the condition. But I don`t believe it is ok, because for large numbers of strings the e... |
Given a directed graph $G=(V,E)$ with positive weight function $w$, source $s$, destination $t$ and a nonnegative integer $\ell$, we want to find shortest path $\pi$ from $s$ to $t$ such that $\pi$ contains at most $\ell$ edges.
Let $d_{u,v}^\ell$ be the length of the shortest path between $u$ and $v$ with at most $\e... |
Below is a problem I made up and my solution to it.
Problem:
Given the following recurrence relationship, find $\Theta(T(n))$.
$$ T(n) = T\left( \dfrac{n}{2}\right) + n^2 $$
Answer:
To solve this problem, I use the Master's Theorem. I am using this link
as reference:
Wikipedia Article
\begin{align*}
a &= 1 \\
b &= 2 ... |
The problem that I currently went through is kind of text justification problem. The problem is given that there is a paragraph and a some blank lines. We want to print this paragraph neatly on the number of lines that hold a maximum of M characters each. So, if the paragraph is "Roses are red and sky is blue" and we w... |
I'm trying to figure out what is a straightforward algorithm.
The following pseudocode comes from section 4.2 of "Introduction to Algorithms, 3rd Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein"
Is it a straightforward algorithm?
Does a straightforward algorithm refer to the algo... |
I know that the pumping lemma is not powerful enough to prove a language is not context-free, but I don't understand how to show it.
I have the same question as this one
Show that the Pumping Lemma for CFLs is not powerful enough to prove that the language L = {aibjck |i ≠j ≠ k ≠ i } is not context free, but I couldn't... |
https://en.wikipedia.org/wiki/Binary_tree#Types_of_binary_trees says
A complete binary tree is a binary tree in which every level, except
possibly the last, is completely filled, and all nodes in the last
level are as far left as possible. It can have between 1 and 2h nodes
at the last level h.[18] An alternative defi... |
Define
$$\text{SQE}=\{S\ |\ S\ \text{is a system of quadratic equations with real solutions}\}$$
and
$$\text{VC}=\{G\ |\ G\ \text{is a simple undirected graph with a vertex cover}\ \leq k\}$$
I am trying to prove that SQE is NP-hard via the reduction $VC\leq_P SQE$.
My attempt:
Given a $G=(V,E)$, we want to construct s... |
Initial collection A = [1,2,3] should provide such combinations:
{(1, 2), (1, 3), (2, 3)}
I want to pop the first combination (1, 2), so after this I can pop only from {(1, 3), (2, 3)}
Collection A can grow in size. How example:
A = [1,2,3] : {(1, 2), (1, 3), (2, 3)}
pop (1, 2) from A combinations -> A = [1,2,3] : {(1... |
Recently I've stumbled upon a strange graph problem. Here is a brief description.
Given $n\times m$ matrix with $2n + 1$ rows such that each row contains $2m + 1$ characters "+", "-", "|", "."
First, last row, and first, last column are the borders of the maze.
Even coordinates, e.g. (0, 0), (0, 2), are filled with "... |
I am currently storing a $d$-dimensional polytope as a list of $d$-dimensional points.
In order to implement an algorithm, I need to find intersections between my polytope and $d$ equations, of the form:
\begin{align}
x_1 &= c_1 \\
x_2 &= c_2 \\
&\dots \\
x_d &= c_d \\
\end{align}
where $x_i$ is a coord... |
In section 1.2.11.2 of Donald Knuth's first volume of TAOCP, he gives an exercise at the end to prove that $g(n) = \Omega (f(n)) \iff f(n) = O(g(n))$ (exercise 13). His solution is simply: "we may take $L = \frac{1}{M}$ in the definitions of $O$ and $\Omega$." However, earlier in the book he states, "Every appearance o... |
I'm trying to make a Turing machine which accepts $ww^R$, for example $w = aababbabaa$ and I'm unsure as to how to make this work.
Below is an attempt for such Turing machine, but it gets stuck when the second to last b becomes B and the very last a becomes A.
|
Suppose a computer solves a coupled differential equations (with given boundary conditions) of which each equation deals with $2^n \times 2^n$ size of matrices as solutions. My question is
Does time-scaling for typical algorithm we use in Python packages (e.g. Scipy) grow exponentially with $n$? This sounds pretty obv... |
I'm looking at [1] that describes a GPU parallel radix sort algorithm. They describe multiple optimizations but in section 3 where the whole algorithm is described some things elude me.
First, the counting step is done for $n$ bits by $m$ work groups using as many work items (SIMD lanes) as possible for each work group... |
While studying I've encountered this question written above.
I am familiar to the closure properties of CFL, and even know that $$L=\{a^{j^2}|j\geqslant 0\}$$ ($a$ to the power of ($j$ to the power of $2$))is one that answers the question, but I don't know how to prove that.
If anyone could explain it to me, it would b... |
Prove that the following predicate is not computable:
$P_e(n) =
\begin{cases}
1 & \textrm{if } \phi_n(n) = e \\
0 & \textrm{otherwise}
\end{cases}$
Could someone explain how to approach this problem and what theorems could be useful here?
|
I've tried to use the step counting method to get the worst-case time complexity for binary search. But I seem to mess it up, as my final result would be O(n) and not O(log(n)).
My implementation:
fn binarySearch(array:[i32;20],target:i32) -> isize{
let mut min = 0; //c
let mut max = array.len(); //c
let mu... |
If we have only one submitted process and we are using RR CPU scheduling algorithm. Assume that the CPU burst time for this process is 10 ms and the time quantum is 2 , then there will be multiple context switches ? OR the process will continue running on the CPU ? The book "Operating system concepts" 9th edition , p... |
I have been given the following problem and was wondering if my solution is correct: Say that a variable $A$ in CFG $G$ is necessary if it appears in every derivation of some string $w$ where $w$ is in $G$. Let $$\text{NECESSARY}_{\text{CFG}} =\{\langle G,A\rangle \mid G\text{ is a CFG and }A\text{ is a necessary varia... |
EVG is defined as EVC = { <G,m,k>| G is an undirected graph and there is as et of m edges in G that are covered by at most k nodes}
If EVG was decidable in polynomial time how could we find the list of m vertices and k nodes that satisfy it in polynomial time?
Here's the best solution I found:
Run EVC repeatedly with k... |
I'm trying to get my hands on a set of these books, and it seems the most recent printing was in 2011. It's currently out of print, and going for crazy money. Meanwhile older editions from the 70s are available on eBay for much cheaper.
Is there any reason to hold out for an affordable copy of the newer edition? Or are... |
I want to write a compression algorithm for a specific use case that I have.
I have many arrays which are for the most part, very similar. Each value in the array is an integer and is related to the corresponding value in the previous array.
These arrays have a correlation coefficient of around 0.8 and they will be sto... |
Find an algorithm that decides, given 2 regular expressions $E_1$ and $E_2$ and a non-negative integer $k$, whether $|L(E_1) \backslash L(E_2)| = k$.
I know that regular expressions are closed under set difference so I can find a regular expression equivalent to the one above, and then convert it to a DFA and then brea... |
Is a thread's context stored in the process's PCB, or is a new PCB created for the thread?
|
I am learning data structures and algorithms currently, and want to understand how the following codes received their O-notations.
Code example #1:
for (int i = N; i > 1; i--) {
for (int j = 0; j < i; j++) {
for (int k = 1; k < N; k = k*2) {
doSomething(i, j, k);
}
}
}
The O-notation for how many t... |
Let $\Sigma = \{a, b\}$ I need to find a regular expression for this language:
The language where the number of $a$'s and $b$'s is equal and for every prefix of a word the absolute value of the difference between the number of $a$'s and $b$'s isn't greater than 2
But I can't seem to find an expression for this langua... |
I'm working with logic formulas of the form '0 & 2 | 0 & 3'. I was wondering if anyone knew of an algorithm that would take in such a formula, detect existing disjunctive relationships, and return a simplified version.
For instance, in this case, the algorithm should return '0 & (2|3)'.
Ideally, the algorithm should be... |
Consider the idea of an extended non-deterministic automation, where transitions can be
labelled by regular expressions and not simply by symbols of the input alphabet or $\epsilon$. Such
an automaton would work in the obvious way: if there is a transition from state $q$ to state
$q′$ labelled with a regular expression... |
I have an undirected fully-connected weighted graph of $n$ nodes, where $n=m\times m$. I want to visualize this graph on an $m$ x $m$ 2D grid. My goal is to place nodes connected with edges of higher weights together so that the placement maximizes the sum of weights of edges between neighboring nodes.
For example, if ... |
So I have a recursive algorithm which sums up the numbers from 1 to n plus one (hence the return 1):
public static int S(int n) {
if(n < 0) {
return 1;
}
else {
return n + S(n-1);
}
}
This algorithm has a time complexity of O(n).
Is it possible to derive an algorithm which produces the ... |
I've been thinking recently about the Golden State Killer case, in which a crime was solved by comparing a killer's DNA sample with known samples in a public genetic database. The cousin of the killer was in the database, leading to an arrest. I wanted to try to understand/formalize this process a bit further, but ran ... |
Context:
When trying to tame real-world datasets that contain outliers and noise, the interquartile mean is a handy tool: you sort the data, throw away the top and bottom 25% of the data and take the mean of what's left. (Of course, you can choose other partitioning than top and bottom 25%.)
Which led me to wonder: is... |
Wikipedia has an explanation for the viterbi algorithm, in particular it describes the following summary of the inputs:
What is the difference between O and Y? Also I am trying to understand what the output is
|
So I am studying apporiximation algorithms for TSP problem and there is a step that I don't get.
Essentially trying to solve TSP means we are looking for a minimum cost Hamiltonian path.
The well-known 2-approximate algorithm computes the MST , transverses it with DFS while noting down the vertices .
I don't get how fr... |
Section 4.3 of "Introduction to Algorithms, 3rd Edition
By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein" uses the following recurrence as an example to illustrate the substitution method.
$T(n) = 2T(\lfloor{n/2}\rfloor)+n \tag{4.19}$
That section says
Let us assume, for the sake of argum... |
Let $L$ be any context-free language. Is the set of all palindromes that are elements of $L$
also context-free?
I know that the intersection of context free languages isn't guaranteed to be context free, so I can't apply that here.
I also thought of maybe using the fact that $\{0^{n}1^{n}0^{n}|n ≥ 0\}$ is not context f... |
Suppose $L \subseteq \mathbb N$ such that, for the purpose of Turing machine
computation, numbers in $L$ are represented by strings over the alphabet $\{0, 1\}$ in the
standard binary notation. Prove that $L$ is decidable if and only if $L$ is finite or $L$ is the
image of some strictly increasing computable function $... |
To construct a reachability tree we start with the initial marking and then consider all enabled transitions and fire them one by one. That is, we find the marking corresponding to firing each.
I can't see why is this meaningful because if we were simulating the petri net then starting with the initial state we would f... |
I have tried to implement traditional binary search on an array. Now, if I set the mid index to be $mid = \frac{(right + left )}{2}$, my code does not run within time quota specified already, however, If I run it with $mid = left + \frac{(right - left )}{2}$ it works fine. Can you please give a hint what might be the s... |
Say we have this algorithm in Python.
def secret(S: list):
n = len(S)
while n > 0:
n = n // 2
for j in range(n):
if j in S:
S.append(j)
return S
I need to find the strictest upper bound (Big-$O$).
I have two approaches to solve this, which give me different solutions and I wou... |
this is my first question on this site and I would like to preface this by saying I am not very savvy when it comes to Computer Science. So, I will try to ask this the best I can.
I was doing some research on Polynomial time because that is what I was told hashing algorithms run on, correct me if I am wrong. So with th... |
I was reading about hash functions in crypto and a website had mentioned that they were collision free, which obviously isn't possible if there are infinite input values that are mapped to outputs of a finite length. So what happens in the event of a hash collision? How do crypto currencies overcome this problem?
Also,... |
I just need to check my understanding regrading two points .As was stated in the textbook "Operating systems concept " :
The compile-time and load-time address-binding methods generate
identical logical and physical addresses. However, the execution-time
address binding scheme results in differing logical and physical... |
I need to compute the product of two polynomials $f(X)$ and $g(X)$ over a finite field. The degrees of these polynomials are $n^2$ for some integer $n$. However, we also know that the polynomials are sparse in the sense that most coefficients are zero and furthermore, only $O(n)$ of the coefficients are non-zero.
Can w... |
I'm working on a project that's attempting to cluster books using machine learning. I'm using the K-Prototypes algorithm for clustering data that has both numerical and class-based data. Under the hood it uses the K-Modes algorithm for class-based book fields (such as genre), and K-Means for numerical data (such as yea... |
i have the following algorithm :
j = 1
while j ≤ n do
j = 2^j
where n is our input and is a non negative integer
I found the complexity of the algorithm to be O(1) . Can someone tell me if this is correct and if not can you tell me the right answer and explain the way you found it? Thank you.
|
Given $L_1,L_2$ which can be any regular / non-regular languages.
Let $L_1$ and $L_1-L_2$ be regular languages.
I want to know if $L_1\cap L_2$ must be regular or not.
So, I wrote $L_1-L_2=L_1\cap L_2^c$ which is regular.
From here I don't really know what to do, because $L_2^c$ can be wither regular or non-regular.
I ... |
I have been given the following problem and was wondering if my solution is correct (taken from the textbook exercise in the book Introduction to the Theory of Computation by Martin Sipser):
Given $$\text{ALL}_{\text{DFA}} =\{\langle A\rangle \mid A\text{ is a DFA and }L(A)=\text{Σ*}\}$$ prove that $\text{ALL}_{\text{D... |
I have been given the following problem and was wondering if my solution is correct (taken from the textbook exercise in the book Introduction to the Theory of Computation by Martin Sipser):
Given $$\text{A}_{\text{εCFG}} =\{\langle G\rangle \mid G\text{ is a CFG }\text{that generates ε}\}$$ prove that $\text{A}_{\text... |
I have been given the following problem and was wondering if my solution is correct (taken from the textbook exercise in the book Introduction to the Theory of Computation by Martin Sipser):
Given $$\text{INFINITE}_{\text{PDA}} =\{\langle M\rangle \mid M\text{ is a PDA }\text{and L(M) is infinite}\}$$
Prove that $\text... |
I am a computer science student, I am studying an algorithm course independently.
In the course I got stuck with this question:
$A$ 3-term arithmetic progression is 3 integers ${a < b < c}$ such that ${a + c = 2b}$. Given a set
of integers $A\subseteq\left\{1,...,n\right\}$, find an $O(n \log n)$ time algorithm that co... |
I need to store a list of strings in some files. In this moment, there are too many strings in too many files, which is a problem for me.
Here is an example of strings:
aaaaaaaa
aaaaaaab
aaaaaaac
aaaaaaad
aaaaaaae
aaaaaaam
aaaaaaan
aaaaaaao
aaaaaaap
aaaaaabc
aaaaaabd
aaaaaabe
aaaaaabf
aaaaaabg
....
aaaraaai
aaaraaaj
aa... |
I was reading that a quantity $x$ is $0$ upt to numerical precision. What does this statement formally mean -- especially in the context of numerical methods or real computers.
I looked up in google what that means but nothing useful came up. Then I read the precision page in wikipedia but it didn't really help:
In c... |
It is known that the language $\{a^nb^nc^n|n\geq0\}$ is not context-free (we can prove it using the pumping lemma, as shown here: Is $a^n b^n c^n$ context-free?). Yet, this answer claims it has found a context-free grammar for this language. My question is, is it possible to find a context free grammar for a not contex... |
Alright this is another day of my pursuit to learn about how crypto works. I have several terms that I have found linked together. I was trying to do research on how the Target Hash is determined and how a Nonce is decided. But I think I am getting lost in several terms and need helping making the connections.
I found ... |
The question is from my homework: Is the language $\{a^ib^jc^k\mid i,j,k\geq0\land i\neq j \land j \neq p\}$ a context-free language (CFL)? If yes, please provide a context-free grammar for it. I found this question quite challenging, so I decided to post it here.
My attempts:
First I tried to show the language is not... |
Several months ago I was doing research into calculating mining revenue for several crypto currencies. When trying to calculate BTC revenue I found this value 1/2^32 which was described somewhere along the lines of the probability of finding or solving a block. This value worked for finding revenue for several coins in... |
I consider decision version of 3SAT problem.
Main idea is to find congruent clauses and construct such maximum formula,
which satisfiability/truth table won't be changed.
In case of unsatisfiable formula, this "maximum core"
size equals to 8/6 * (n - 2) (n - 1) n, where n is maximum literal number.
Otherwise for satisf... |
I got stuck with quite a simple problem:
Given a positive number $X$ find the largest number $k$, for which exists the positive distinct integers $Y_1,…,Y_k$ such that $(Y_1+1)(Y_2+1)⋯(Y_k+1)=X$
Any of my approaches based on integer factorization or working with the divisors of the $X$ have failed. For example all my ... |
Linear search is solvable in O(n) time by a deterministic Turing machine. If we apply a nondeterministic Turing machine to the problem, can we solve the decision problem "Is $x$ in the array $A$?" in O(log n) time or even O(1) time? If my understanding of nondeterminism is correct then the answer is yes because it can ... |
Suppose we are asked to assign $N$ numbers into $K$ mutually exclusive groups. The partition has to satisfy two constraints for each group. The first one is that group $k$ must contain exactly $n_k$ elements. The second one is that the sum of all numbers in group $k$ must be in the range $(l_k, u_k)$. Of course we have... |
I have been given the following problem and was wondering if my solution is correct (taken from the textbook exercise in the book Introduction to the Theory of Computation by Martin Sipser):
Build a DFA that recognizes the following language knowing that E = {0, 1}, {w | w is any string except 11 and 111}.
My solution ... |
I have been given the following problem from the book Introduction to the Theory of Computation by Martin Sipser and was wondering if my solution is correct: Determine if a Turing Machine ever writes a blank symbol over a non blank symbol over the course of its computation on whatever string given on input, formulate t... |
Here is the my attempt:
Proof : Suppose $J = \{aa' \mid a \in A\} \cup \{bb' \mid b \in B\}$ such that $a'$ and $b'$ are the symbols that do not belong to any $w \in A \cup B$ and $a,b$ are strings.
We build a Turing Machine(Oracle) $M$ on input $w$ :
Query oracle if $wa' \cup wb' \in J$.
If YES, Accept. Reject Oth... |
I have been given the following problem and was wondering if my solution is correct (taken from the textbook exercise in the book Introduction to the Theory of Computation by Martin Sipser):
Given {<R> | R is a REGEX that generates strings with 111 as substring} shows that it is decidable.
My solution at the moment is:... |
I've faced this question while I was solving some past homework and I couldn't really figure out how I would solve it.
Question: Prove that $L=\{a^ib^jc^k\ |\ i\neq j,\ i\neq k,\ j\neq k\}$ satisfies the pumping lemma even though it's not a CFL.
Note: There's no need to prove that it's not a CFL.
The purpose of the que... |
ASSERT( P ) /* determine what is P */
A[i] = A[m];
A[k] = 2;
ASSERT( A[i] == x + 5 )
|
Both these algorithms determine if all the parenthesis in a string are
balanced and properly nested.
The first algorithm uses "a constant amount of memory, regardless of the length of
the string."
The second algorithm "may use O(n) memory but must use a stack".
I understand how the algorithms work but I don't underst... |
Prove/Disprove: If $L$ is finite and $R$ is not regular, then $R\cup L$ is not regular.
I think that this one is true, but I am stuck:
Since $R$ is not regular, it is infinite, so $R \cup L$ is also infinite.
Since $R$ is non-regular, it must be that $R \cup L$ is not regular.
It just doesn't feel complete for me...
An... |
This problem is from LeetCode.
You're given a string num representing the digits of a very large integer and an integer k. You are allowed to swap any two adjacent digits of the integer at most k times.
Return the minimum integer you can obtain also as a string.
My question is, why does the following greedy algorithm... |
I once had an idea for a multithreaded regex engine.
The first method that occured to me (there may be other ways to do it that I haven't thought of) was to split up the string being matched against into chunks and it would introduce parallelism by having the coroutines which are processing the string hand off to the n... |
Let there be given set of vectors $V = \{v_1, v_2, ..., v_n\}$ and set of vectors $S = \{s_1, s_2, ..., s_k\}$ where $n > k$. The set of vectors $V$ can be constructed by $S$ if the vectors in $V$ lie in the linear hull/span of $S$. In order for this to be possible, the vectors in $V$ must not be linearly independent (... |
The bisection width problem gives you a yes or a no -> if there exists a bisection of size at most $K$ for $G=V,E$.
Minimum Vertex Bisection problem gives you a bisection of the smallest size.
Bisection Width is NP-Complete, I want to prove Minimum Vertex Bisection is also NP-Complete by deriving a reduction from Bisec... |
In a traditional radix-balanced tree, the height of the tree can be determined quickly by counting the leading zeros of the number of elements of the tree, and indexes to node children can be determined by taking successive chunks of bits from the element index.
However, consider a radix-balanced tree which is almost f... |
I'm recently in to the algorithms and I'm having trouble finding the time complexity(Big-Oh notation) of the following algorithm:
for(int i=0;i<=n;i++){
for(int j=i;j<=n;j=j/2){
for(int k=0;k<=n;k=k*2){
//set of statements
}}}
Can anyone help me to determine the complexity of the following algorithm.
I found the inner... |
I'm trying to make a data structure $A$ that has the following features:
insert($a$) operation : insert given integer $a$ to $A$. It is assured that all integers are unique.
delete($b$) operation : delete $b$ from $A$.
smallestNotInRange($p$,$q$) : returns the smallest value $k$ such that $k\in [p,q]$ and $k \notin A... |
I am new to this community and I have a question regarding a problem I was trying to solve. Could anyone review my algorithm for solving this problem?
I want to emphasize also that the algorithm must use the Quickselect algorithm (i.e. https://en.wikipedia.org/wiki/Quickselect).
The question is :
Given an array A[1..n... |
I get that it depends from the number of probes, so by how many times the hash code has to be recalculeted, and that in the best case there will only be one computation of the hash code and the complexity will be O(1) and that in the worst case the hash code will be calculated a number of times equal to the size of the... |
Recently while studying arborescences in graph theory, I came across Edmond's theorem for $k$ edge-disjoint arborescences in digraphs
if a finite digraph is $k$ edge-connected from a vertex r for some $k \in N$, then it has
$k$ edge-disjoint spanning arborescences rooted at $r$
Now, I do understand what is meant by a... |
What wiil be grammar rules for the language L={a^n b^n c^n d^n; n>0}
|
This is a "revision" of this question, it contained an error I now see. In a nutshell, I was wondering if in the halting problem proof the decider $D$, after recognising its source code in the input fed to it, could leverage the fact it can look at the source code of $H$ to help its clone in the input make the right pr... |
Let $a$ initially be an empty string. One can transform $a$ into $b$ in the following way: $a$ becomes $a_{left}+$"$abc$"$+a_{right}$, where $a=a_{left}+a_{right}$ in a prior state. $a_{left}$ or $a_{right}$ can be the empty string. Given a string $b$, check if it is valid, i.e. check if it can be obtained from $a=$"" ... |
I am learning about time complexity now, and I am working with BST (Binary Search Trees).
This question needs some context and this is a follow up post to this post. Basically, I would like to compute the time complexity of the function below.
The function below refers to a BinarySearchTree where 'u.l' represents the l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.