instruction stringlengths 35 29.1k |
|---|
I am confused about the precise definition of the DPLL algorithm. Various sources tend to define DPLL differently:
In pages 110-114 of the book Handbook of Satisfiability(Editors: Biere, A., Heule, M., Van Maaren, H., Walsh, T. Feb 2009. Volume 185 of Frontiers in Artificial Intelligence and Applications) it defines i... |
For a given set of coordinates (lat/lng) I need a path which will visit each coordinate only once. The path needs to be selected to minimize the number of times the haversine distance between two subsequent points along the path is greater than X (ex: 200 miles).
The practical application:
I have airports on a map. I h... |
I've got this question from an exercise and i'm not sure if it is possible to do so
Think of new data structure Q with priotry queue which allow us to find the median in $O(1)$ and the data structure need to support the following operations:
Insert(v,Q) which insert into Q (no time complexity constrain here)
Delete-Me... |
I am given a set of items S = {a1,a2,a3,...,an}. Each item has a corresponding M dimensional bit vector indicating the properties of that item. For example, if item x has corresponding vector: {0, 1, 0}, then item x does not have property 1, does have property 2, and does not have property 3.
I am also given a M dimens... |
Is there a general rule to convert a CFG to its CFL?
For example, how do I approach the following question?
What is the language generated by the following CFG?
$$ S \to aS \mid Sb \mid \epsilon $$
As per my understanding, $S\to aS$ is $a^*$ and $S\to Sb$ is $b^*$.
But how do I make sure that the language is $a^* b^*... |
I've head the lecture today and we saw this theorem:
$\mathsf{NP}^{\mathsf{NP}}=\Sigma_2$
But without a proof.
Here are the definitions I use:
A language $L$ belongs to $\Sigma_k$ if there is a deterministic Turing machine $M(x,y_1,y_2,\dots,y_k)$ such that:
There exists a constant $c$ such that $|y_i|=|x|^c$ and $M... |
I am wondering if there is a way to solve a recurrence time function with the master theorem if no $b$ exists. Like in this case.
$$ T(n) = 2\times T(n-1)+4$$
|
Currently, I have a hard time to find out the solution to this problem:
Given a matrix $A \in Z^{m \times n}$, $b \in Z^m$, $c \in R^n$ and $\lambda \in R$. Is there $x \in R^n$ with $Ax \leq b$ and $c^Tx \geq \lambda$?
I was able to show that the given problem is $NP$, but now I have to show it is in $NP \cap co-NP$ ... |
I want to solve $$T(n)=3T\bigl(\bigl\lfloor \frac{n}{3}\bigr\rfloor\bigr) +2n\log n,$$
with base case $T(n) = 1$ if $n \leq 1$.
I am sure that the Master Theorem does not work. I am trying a lot with the substitution method, but I am very frustrated since I can't find a solid expression. Does any one have a good "hint"... |
Prove by induction that $T(n)=\Theta(n^2 \log_{3}n)$ where
$$T(n)= \begin{cases} 1 & \mbox{if } n=1,\\ 9T(\lceil n/3 \rceil)+n^2 & \mbox{otherwise.} \end{cases}$$
The base case for $n=1$ seems to work, but I am unable to do the induction step.
|
I was reading http://barrywatson.se/lsi/lsi_delta_reduction.html, where
((+ 1) 2) →δ 3 is a δ-reduction.
((+ 1) ((+ 1) 1)) is a not a δ-redex.
Wouldn't $((+ 1) ((+ 1) 1)) \rightarrow ((+1) 2)) \rightarrow 3$?
|
I am trying to prove the following claim:
Let $(G,*)$ be a cyclic group of size $m$ with generator $g$. Assume
there exists some adversary $A'$ of size
$T'=\frac{\left(T-O\left(\log m\right)\right)}{2}$, for some
$T$, such that $$\mathbb{P}_{b\gets
G}\left[A'(b)=\log_{g}(b)\right]>\frac{1}{2}.$$ Show that there exist... |
so I know we can have 2 busy adjacent nodes for the fit algo since there'll always be free memory available, but what about when it comes to 2 free adjacent nodes? Is it possible to have 2 adjacent free nodes and why? Thanks
|
I'm trying to understand how we can construct an admissible ordering of the computable (meaning, partial recursive) functions.
Initially my take on such an enumeration was from the point of view of an enumeration of programs. For instance, we could enumerate all possible Turing machines using some set of rules (for ins... |
I wanted to know that based on Kleene's theorem (a language is regular iff some FSA recognizes it), does every regex have a TM (Turing machine) that halts on exactly the same language?
Is this implication valid or are we not entirely sure about this? (ambiguous/unclear given the theorem). Kind of like the Church-Turing... |
Can we enumerate all probabilistic Turing machines (with bounded error), like we do for deterministic Turing machines (when using diagonalization arguments against deterministic Turing machines)? If not, does this mean we cannot diagonalize against BPP machines?
|
At the moment I use HdrHistogram to track approximate distribution of a stream of values. But I don't really need all percentiles, just three of them. Is there some algorithm to track specific percentiles? Precise algorithm with two heaps isn't feasible because of number of values.
|
In section 17.2 of the book "Combinatorial optimization polyhedra and efficiency" by Schrijver, he describes the Hungarian method for maximum weight matching in bi-partite graphs (with classes $U$ and $W$). He defines for a matching, $M$, $U_M$ and $W_M$ as the set of vertices in $U$ and $W$ missed by $M$. He then says... |
In this paper, it is mentioned that BPTIME does not have a time hierarchy theorem, unlike DTIME. To quote the part where the author explains why:
It must hold that for any $x$, either $\Pr[M(x) = 1] \geq \frac{2}{3}$
or $\Pr[M(x) = 1] \leq \frac{1}{3}$. It is undecidable to test whether
a machine $M$ satisfies this pr... |
I know , if P = NP then it can easily be proven that P = NP = Co-NP. But I was wondering,
if we assume P≠ NP, also then can it be proven that, NP =co-NP??
|
Suppose we have an instance P of the PCP, and there exists a match for it.
I am wondering if we remove all dominos that has the same string on the top and bottom, would there still be a match?
My intuition is yes, there would still be a match, but i don't know how to justify.
Can someone please give me some hints or gi... |
private static < T extends Comparable < ?super T >> int partition(T[] a, int first, int last) {
int mid = (first + last) / 2;
sortFirstMiddleLast(a, first, mid, last);
swap(a, mid, last - 1);
int pivotIndex = last - 1;
T pivot = a[pivotIndex];
int indexFromLeft = first + 1;
int indexFromRight = last - ... |
A program runs in a low-spec hardware utilizes coroutines writes to a single socket but how does the socket know when the data should be sent as there could more coroutines writing given N time.
I find this problem similar to The halting problem even tho contexts are different.
Does anyone know how could be a one find ... |
Show that if the discrete log problem is $(T,1-\epsilon)$-hard, then it's $(O(\frac{T}{\frac{1}{\epsilon}log\frac{1}{\epsilon}}-nlogm),\epsilon)$-hard
Let $G$ be a cyclic group of size $m$, and let $g \in G$ be a generator.
We say the the discrete log problem is $(T,\epsilon)$-hard if for every algorithm $A$ of complex... |
I was wondering how to create a TM that it's $L(M) = 10$, I think it would be recognizable, but I need help building that TM.
so far I have this pseudocode:
$$
N:" ∀x∈sigma^*
$$
$run$ $N$ $on$ $x$
if N acc $then$ $i=i+1$
if i==11 then $stop$
please help solve this
|
Given a certain x86_64 "vanilla" binary, without micro-architecture instructions, which can therefore be executed by any x86_64 computer, what are the conditions for the result to be deterministic ?
Can we assume that without parallelization, without the use of entropy-generating instructions, the result will be "bit-p... |
Are the two interchangeable or is there a difference?
|
If I have two tuples (a1,b1,c1) and (a2,b2,c2), where we know each is ordered from smallest to largest, how would I return a tuple that takes the minimum elements from both tuples and orders them from least to largest?
I tried to break down the problem for two tuples so:
a1, b1 and a2, b2 are two tuples and we can do
i... |
How would we find the three smallest elements in a list and return it as a tuple (a,b,c) using divide and conquer?
So far I've considered the following:
def sm(L):
# base
if len(L) == 3:
return L sorted
else:
# divide
How would I divide the list so that we guarantee the list to be of size... |
If an algorithm can solve a problem in X iterations using Y bytes of space, then another algorithm that solves it in less bytes than Y, will usually end up needing to do it in more iterations (or time) than X.
One can keep increasing the space/memory to reduce the cycles or cpu time, but will eventually get cursed by s... |
In the standard proof of the halting theorem, you are asked to assume that a TM_0() exists that takes another TM_1() and a string W and outputs whether TM_1() halts or executes forever right on string W, right? The proof seems to be to assume that such a TM_0() exists. Now a new TM_2() is taken that takes TM_0() as in... |
Let PCPk be a version of PCP where we can use at most k copies of each domino to create correspondences. Prove that for any finite k = 1, 2, 3 … PCPk is decidable.
I know this kind of PCP is called bounded PCP which is decidable. Does anyone know how to prove the decidability?
|
I'm trying to understand how vector clocks compare to DAGs for causality detection in a distributed system.
When trying to detect causality relations in a distributed system, a very commonly proposed technique is the use vector clocks. Vector clocks are presented as:
Timestamping is a common method of totally ordering... |
I have a task of hashing DNA sequences. Let the DNA be long sequences of four amino acids, which we will denote by the letters $A, T, G$ and $C$.
My hash function $h$ take DNA as an input and return the sum of amino acid numbers by some large simple modulus as a hash, and then add it to a hash table with a public key. ... |
Given the language $K$ $=\{<M> $ where $M$ is a turing machine ( that is on the alphabet {0,1}) and $L(M)$ contains at least one word of form $0^k1^l$ with $k,l\geq 0\}$
I would like to know if my proof makes sens. I am using the reduction.
Considering the function $f$ given $<M,w>$ ( where M is a turing machine and $... |
Can you build a solver from a verifier?
I see that if you start with an NP-verifier TM the answer is yes, you can build a solver TM. How about for circuits? Can you go from a circuit that implements a verifier for instances of size n that is of size polynomial in n to a circuit that implements a solver for instances of... |
If you have a solver for an L in NP do you have enough information to build a solver for co-L in Co-NP? Meaning, is there a procedure that can take you from a solver for one to a solver for another?
|
Suppose we have an array$[1..n]$ and run linear search to find $x$, on it with following specification:
probability of existence $x$ in first half of array is $p$,and probability of existence $x$ in second half is $3p$ and in each half probability of any element to be x is equally likely.Calculate Average case linear s... |
I am currently learning category theory and a saying that I see a lot is that X is the algebra of something (e.g. Monoid is an algebra of something). Can someone explain to me what that means? Thanks!
|
Suppose we have observations with associated labels $\{({\bf x}_1, y_1), ({\bf x}_2, y_2), \dots, ({\bf x}_n, y_n)\}$ where ${\bf x}_i \in \mathbb{R}^d$ and $y_i \in \mathbb{R}$.
Can we efficiently find a separating plane of the observation space $\mathbb{R}^d$ such that the sum of the variances of the labels of the o... |
given a graph G = (V, E) of n vertices, decide whether G is k-colorable. if I were to have an oracle that solves for 3 color, how do I use it to solve the k color graph problem?
|
I am struggling to find how can I know the number of errors that can be corrected and detected using (n=10) bit code with a (k=550) codewords.
As far as I know, to calculate the number of errors to be corrected and/or detected someone must know the Hamming distance between 2 codewords. However, I do not have any releva... |
I have a pattern $P$ of length $m$, i.e. $P = p_0, p_1, \ldots, p_{m-1}$
which I want to build a simple jump table for (not considering special optimizing cases for now).
I only want to build a jump table based on matching suffixes of $P$ (the bad character rule is not relevant here).
The problem is to build a table su... |
I came across some code and I'm trying to crack the case as to what it does:
for $0 \leq f \leq l < len(A)$, the function is
def foo(A, f, l):
if f == l:
return A[f]
m = (f+l) // 2
x = foo(A, f, m)
c = 0
i = f
while i <= l:
if A[i] == x:
c += 1
i += 1
if c > (l - f + 1)/2:
return x
... |
Problem: Given a line segment on the cartesian plane, determine where and which order it intersects a regular grid. This sounds simple, but is actually quite a tough problem. It's related to, but distinct from, both Bresenham and supercover.
More specifically, consider:
A line segment with start $(x_1, y_1)$ and end... |
What is the SetHorspool string searching algorithm with pseudo-code so it can be easily implemented in a language of choice?
This has been implemented in 2 libraries I have come across:
https://app-db.com/seqan/1.3/SPEC_Set_Horspool.html,
http://stringsearchalgorithms.amygdalum.net/.
But there seem to be very little ... |
For Curiosity Sake, I was wondering if there was some history behind the naming of "Las Vegas" and "Monte Carlo" classes.
I've searched on the internet for quite some time now but I did not find a proper answer, is it just because they are probabilistic which gives them the "gambling" nature, or is there something more... |
L=4; N=4; N_l=2; P=10;
w = ones(L,1);
beta = ones(L,1);
%p = zeros(L,1);
H = sqrt(.5)*(randn(N_l,N)+1i*(randn(N_l,N)));
u_l = sqrt(.5)*(randn(N,1)+1i*(randn(N,1)));
u_i = sqrt(.5)*(randn(N,1)+1i*(randn(N,1)));
v_l = sqrt(.5)*(randn(N_l,1)+1i*(randn(N_l,1)));
u_l = u_l./norm(u_l,2);
v_l = v_l./norm(v_l,2);
u_i = u_i... |
I have stumbled across this question about the Random restart algorithm in search problems:
Random restart is technique which used for:
a)algorithms for search in space state when they get stuck
b)algorithms for informed search for better solution
c)algorithms for uninformed search for better solution
d)algorithms for ... |
ALBA={⟨M;w⟩ | M is linear bounded automata which accepts input w}
Show that ALBA is PSPACE-complete.
How I would try to solve it...
We need to prove ALBA belongs to PSPACE. So I would construct TM A which accepts <M;w>. Simulate M till qng^n steps or when it halts. If it halts: Accept <M,w> if M accepts w, otherwise ... |
I have a homework where I have to construct two way deterministic pushdown automaton that accepts this language:
{ww | w ∈ {a, b}*}
Does anyone have any idea? Thanks a lot
|
I am currently trying to implement a Tabu Search algorithm for the binary knapsack problem. Part of my goal is to have a variety of different configurations of attributes used and stopping conditions.
This means I need different ways of creating neighbours of my current solution. The obvious method is to pick some obje... |
Could it be that three languages $A, B, C$ such that $A \subset B \subset C$, and $B \in P$, but $A$ and $C$ are $NP$-complete?
|
I need to construct a CFG for the following language$$L = \{ w \in \{0,1\}^*\text{ } |\text{ } w = w^R \text{ and } |w| \text{ is even}\}$$
I know that the two middle position should always be the same. E.g. $11,00,0\underline{11}0,0\underline{00}0,\dots$ Each position on the opposite sides of the middle points should ... |
I want to solve $$T(n)=3T\bigl(\bigl\lfloor \frac{n}{3}\bigr\rfloor\bigr) +2n\log n,$$
with base case $T(n) = 1$ if $n \leq 1$.
I know that the solution is(with the help of the Master Theorem) $$\Theta(n*log^2(n))$$
I tried without the Master theorem and witht the help of the substuition method I got the following expr... |
A Finite State Machine cannot accept the language
$$L = \{ 0^n1^n \mid n > 0 \} $$
because it will require infinite amount of memory to remember the number of zeros. But a Push Down Automaton can recognize it with an infinite stack.
Why are we allowing infinite storage for the stack of PDA but not for the states of an... |
I am quite familiar with Ford-Fulkerson algorithm but I am having a trouble to apply the algorithm to the following problem. Can someone please give me some hints or better instructions how to use FF method to this problem?
Let O be a set of n objects. It is required to form a set G of m groups. There are three possibl... |
How to prove the NP-hardness of the language $\{G \mid \alpha(G) =\frac{1}{3} |V(G)|\}$?
Here $G$ is a graph, $V(G)$ is its vertex set, and $\alpha(G)$ is the independence number of $G$, which is the maximum size of an independent set.
|
suppose for $n$ elements we using mergesort.
each number compared at most $O(\log n)$ = False
in average each element compared with $O(\log n)$ elements = True
there exist an element compared with $\Omega (\log n)$ elements = True
is there anyone can share idea about these facts (i.e: why first is false and others is t... |
How do I prove the following proposition?
Let $T$ be a tree, and let $S$ be a subset of the vertices. If $|S|$ is even then we can partition $S$ into pairs $(x_i,y_i)$ such that the paths $x_i-y_i$ are edge-disjoint.
|
Consider the language $L = \{\langle M \rangle: \text{ $M$ accepts at most two single-letter words}\}$, where $\langle M\rangle$ is the encoding of Turing machine $M$.
We need to determine, without using Rice's Theorem, whether:
$L\in \text{R}$, i.e., $L$ is decidable.
$L \in \text{RE}\setminus \text{R}$, i.e., $L$ is... |
$F(z_1,...,z_n)$ is a Boolean expression. The assignment of variable ($x_1,...,x_n \in {0, 1}$) is the answer of $F$, if $F$ for that assignment equals to $1$.
If that case is true and the conditions are met, then both of them are considered to be NP-Hard.
A) The number of answers of $F$ in $DNF$ format.
B) The number... |
Trying to prove the following problem:
Given a graph $G=(V,E)$ and vertex $s\in V$, prove that: $\forall (u,v)\in E,\ |d_{s}(u)-d_{s}(v)|\leq1$ where $d_s(v)$ is the shortest path from $s$ to $v$ in BFS.
What I did: Let assume that it's isn't true, meaning there is $(u,v)\in E$ so $|d_{s}(u)-d_{s}(v)|>1$. Lets run BF... |
I see a lot of interest online to the problems of finding shortest paths, longest paths, and all simple paths. I'm interested in implementing a state-of-the-art algorithm to find all (simple) maximal paths of an directed graph without weights for an open-source package.
It may be useful for me to quickly demarcate some... |
This is a follow-up to this question. Even though BPTIME does not have a time hierarchy theorem, the reasons that prevent it from having one are essentially bypassed by PromiseBPTIME. Thus, does PromiseBPTIME have a hierarchy theorem? If so, how does it look like and how to prove it?
|
We are given the 2D coordinates of 2 points: the first point is where the ray starts and it goes through the second point. We are given another ray in the same way. How do we determine if they have a point of intersection? I would like to know the general algorithm and its explanation, don't mind about the extreme case... |
Is $L = \{ a^ib^j : 0 < j < i < 2j\}$ context free?
If so, can there be a pushdown automaton described for it?
If not, does the pumping lemma apply?
|
I am not sure about the answer. Intuitivly I would say that there are alphabets for which there are no non-regular languages. In particular I am thinking of languages with only one element. But I am not sure.
|
I was asking myself if it is not possible to decide the language where a TM M gets the Godel number of a TM M' as input and the checks if, let us say, the TM M' has a certain amount of transitions.
My idea was that it is decidable because we have an countably infinite amount of Godel numbers and the number of TMs which... |
I am currently studying the textbook Principles of Program Analysis by Flemming Nielson, Hanne R. Nielson, and Chris Hankin. Chapter 1.4 Constraint Based Analysis says the following:
1.4 Constraint Based Analysis
The purpose of Control Flow Analysis is to determine information about what "elementary blocks" may lead t... |
I am new to Algorithms and Competitive Coding. I read an exercise paper given by my teacher as below:
The director of a hospital want to schedule a working plan for a nurse
in a given period of N consecutive days 1,..., N. Due to the policy of
the hospital, each nurse cannot work all the days 1,..., N. Instead,
there ... |
Prove that $TQBF^{\exists}_2$ is complete for the class $\Sigma_2$.
Where the input for $TQBF^{\exists}_2$ is a totally quantified boolean formula: $\exists_{x_1\in\{T,F\}}\forall_{x_2\in\{T,F\}}\phi(x_1,x_2)$ and it is in the language iff the truth value of the totally quantified expression is True.
My way of thinki... |
I need to prove that for every given graph, that doesn't contain negative cycles, there is an order of edges so that Bellman-Ford algorithm will finish running after one iteration.
I could only solve it to graphs that are DAGs using topological sort, but couldn't find a way proving it for every graph.
|
How do you find the highest product of X items?
This should optimize for runtime complexity and protect from overflows from large products.
Inputs
An array of both positive and negative Ints representing potential products to the solution
An Int representing the number of products required for the solution
Output:... |
I'm trying to find an algorithm that uses the multiplicative weights algorithm to obtain a set of $O(\log n)$ classifiers that classify a set $X=\{x_1, x_2, ...,x_n\}$ where the set of labels is $l \in\{0,1\}.$
The original question goes as follows:
Suppose we have a set $X=\{x_1,...,x_n\}$, each with a label $l_i\in ... |
I am learning about embedded and operating systems. I would like to know the order of control flow that occurs when a user-space C application calls a function, for example, printf().
I am slightly confused as to which order is correct:
printf() -> User-space library -> system call -> kernel driver
printf() -> User-spa... |
This is a question on a practice final.
Which of the following statements are true? If it is false, what is the underlying reason behind that?
I. If 3-CNF-SAT is in P, then Clique is also in P.
II. For decision problems $L_{1}, L_{2}$ in NP, if P is not NP, $L_{1}$ is at least as hard as $L_{2}$, and $L_{2}$ is at... |
In my thesis, I'm dealing with SLAP (storage location assignment problem) -- which is finding optimal distribution of products to location slots in a generic warehouse. My aim was to implement multiple evolution algorithms (GA, DE, ABC & PSO) to solve this problematic and do a comparison. Since the mentioned problemati... |
I'm just getting my head round Merge Sort, and I was wondering whether the use of the sentinel value was considered good practice in the real world, or mostly an algorithmic conceit?
I get that it simplifies the comparison operations in pseudocode, where "infinity" is a valid value. With real-world arrays, though, the ... |
i am analyzing a series of GPS points (with time stamps) which are noisy meaning have an accuracy of about 15 meter radius (sometime even more), and i need to extrapolate the distance the vehicle has gone via those GPS points, what is a good algorithm / method to solve such issues ?
|
Ok, I dont understand whats the difference between:
write code for stack operations and write adt for stack operations?
lets say the operation is push() and pop(). So what different code is to be written for adt?
|
Complexity Zoo defines coNP/poly as
Complement of NP/poly
Thanks to Emil, I understand it as
"the class of decision problems whose complement can be solved in polynomial time by a non-deterministic Turing machine that has access to a polynomial-bounded advice function."
(A polynomial-bounded advice function is a functi... |
Given the options of:
Red
Orange
Yellow
Green
Blue
Violet
You want to find your favorite color by comparing all pairs to each other, like so:
Red vs...
Red vs Orange = Orange
Red vs Yellow = Red
Red vs Green = Red
Red vs Blue = Red
Red vs Violet = Red
Orange vs...
Orange vs Yellow = Orange
Orange vs Green = Orange... |
All the methods I know which shows a given language $L$ is $RE$ but note $REC$ deep down boils down to the cantor's diagonalization arguement in one way or the other, and most commonly it boils down to reducing it to membership/halting problem.
Is there any other fundametnally different way of showing some language is ... |
I'm wondering if the following language is $L \in \mathsf{R}$, $L \in \mathsf{RE} \setminus \mathsf{R}$, $\overline{L} \in \mathsf{RE} \setminus \mathsf{R}$:
$$L=\{<M,w> \,\mid M \mbox{ Loops on input } w\}$$
to be clear: We say that a TM loops on a string if during its run on the string it repeats the same sequence of... |
I have the following grammar, which I know it is regular because it can be represented by a finite state automata:
\begin{array}{l}
\mathrm{S} \rightarrow \mathrm{X} \mid \mathrm{Y} \\
\mathrm{X} \rightarrow \mathrm{a} \mathrm{Y} \mathrm{b} \mid \mathrm{ab} \\
\mathrm{Y} \rightarrow \mathrm{b} \mathrm{X} \mathrm{a} \mi... |
Before asking the question, I should say that I am not sure here is a proper community to ask this question or not.
I have an NP-hard problem and an optimization to deal with the problem. Recently, I have found that the problem has a phase transition where, before a threshold for a property, the problem can be solved ... |
I was given the task to make an algorithem that can compute the number of prime's of the form 4k+3 under some n, it should be able to compute how many number's of this type are there under 10^8 (100 million) in less than 10 minutes, any ideas?
Iv'e tried using variation's on the Sieve of Eratosthenes and lagranages met... |
Hi I cannot understand why the best case for line 3 is n-1 and why it isnt just always n?
I tried to write this in python to understand when it would be n-1 and the answer is always n. I am assuming that the loop counter in pseudo-code is evaluated one more time than the body is executed as is said in the Cormen book.
... |
I need a FIFO QUEUE that can do Insert and Remove from Queue in amortized $O(1)$ but extract min in $O(log n)$. is it possible?
When just find min is important (not removing) there is lots of $O(1)$ solution for all operation.
Update: All given times is amortized cost.
|
Here's a statement of the set partition problem:
The set partition problem takes as input a set $S = \{ a_1, a_2, ..., a_n \}$(all positive integers). Can $S$ be partitioned into two sets $A$ and $B$ such that the sum of the numbers in $A$ is
equal to the sum of the numbers in $B$?
Here's a statement of a variation of ... |
In short, what is the proper function notation/mapping for this type of functions?
From Wikipedia regarding maps:
In the communities surrounding programming languages that treat functions as first-class citizens, a map is often referred to as the binary higher-order function that takes a function $f$ and a list $[v_0,... |
We have a finite set of words $D$, and denote $Pref(D)$ to be the set of all prefixes from words in $D$ and $l(D)=max_{w\in{}D}|w|$ is the length of the longest word from $D$.
Problem statement:
Given: $D$ subset $\{0,1,...,\sigma\}*$ $\;\;\leftarrow$ finite set of words $a-z$. We will have queries of the following typ... |
Is the graph above bidirectional? The image in wikipedia confused me a lot, before I heard about something called as bidirectional graph, I would say the above one a directed graph, but I am not sure now.
|
$M$ is an MST of the Weighted Graph - $GR$.
Let $A$ be a vertex of $GR$ then $M-${$A$} is also MST of $GR-${$A$}.
Let $A$ be a leaf of $M$ then $M-${$A$} is also MST of $GR-${$A$}.
If $e$ is a edge of $M$ then ($M-${$e$}) is a forest of $M1$ and $M2$ trees such that for $M_i, i=1,2$ is a MST of Induced Graph $GR$ on v... |
I was hoping to solve the following recurrence by performing a simple substitution followed by the master's method:
$$T\left(n\right)=T\left(n-1\right)+n^2$$
I did
$$S\left(2^n\right)=S\left(2^{n-1}\right)+\left(2^n\right)^2$$
Thus
$$S\left(m\right)=S\left(\frac{m}{2}\right)+m^2$$
Which using the master's method yields... |
How to prove the $NP$-completeness of the language $L$ = $\{$$(G, k)$: the vertices of an undirected graph $G$ can be partitioned into $k$ pairwise disjoint sets of pairwise different sizes so,
that all the corresponding induced subgraphs have a Hamiltonian cycle}.
I had no problems how to prove that this language is i... |
Prove that the following grammar is ambiguous; S → a | S + S | S S | S* | ( S )
checking ambiguity in grammar. the subject of this question is compiler construction and automation. would you please help me find the answer we only have to figure out whether its ambiguous or not
|
How is does type theory (coq, lean, agda), and logic programming (prolog, datalog) differ from each other.
Logic programming is a way of declarative specifying an algorithm, using classical 1st order logic and the implementation of the computation of that algorithm does not have to be specified.
Type theory is a way of... |
A k-query oracle Turing machine can query its oracle for at most $k$ times. How could I show that assuming $\text{NP} \not= \text{coNP}$, we have $\text{NP} \cup \text{coNP} \subsetneq \text{P}^{\text{SAT},1}$ (query only once)? I tried to show this strict inclusion directly or its counterexample but to no avail... The... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.