instruction stringlengths 35 29.1k |
|---|
What is the best way to avoid using goto statements when writing the pseudocode for an algorithm?
I want to avoid it and use another way to replace it.
|
We are studying the Travelling Salesman problem in my high school class, and I am wondering what the Big O complexity of the TSP is when you MUST start and end at the same city. For example, given 4 cities labelled A,B,C,D and you MUST start and end at A, what is the big O notation for this? Is ((n-1)!)/2 for both symm... |
In Le Ny et al.'s paper On the Dubins Traveling Salesman Problem (https://tinyurl.com/y59f7d8x) the authors prove, among other works, that the Dubins Traveling Salesman Problem (DTSP) is NP-hard. I will give here the basics of the proof, after which I will ask my question regarding this proof.
The authors reduce Exact ... |
I am writing a thesis about automatic GUI testing. In order to find the fittest strategy I am using GP. I am using tournament selection to select chromosomes for the next generation and elitism to make sure the strongest elite(s) will proceed to the next round.
Basically, I have 2 questions:
a) Many papers use 7 as tou... |
I came across following problem:
Barrier is a synchronization construct where a set of processes synchronizes globally i.e., each process in the set arrives at the barrier and waits for all others to arrive and then all processes leave the barrier. Let the number of processes in the set be three and S be a binary sema... |
I've been trying to understand the pumping lemma, and how to apply it to a language such as a^nb^mc^m where n >= 0 and m >= 0. The pumping lemma states that:
For any regular language L, there exists an integer n, such that for all x ∈ L with |x| ≥ n, there exists u, v, w ∈ Σ∗, such that x = uvw, and
(1) |uv| ≤ n
(2) |v... |
In Introduction to Algorithms (CLRS) 3rd Edition, page 299, the section attempts to prove:
The expected height of a randomly built binary search tree on $n$ distinct keys is $O(\lg n)$.
We define "randomly built binary search tree on $n$ keys" as:
a binary search tree that arises from inserting the keys in random or... |
My task is to develop an algorithm for the optimal arrangement of cylindrical objects in cartons. The algorithm is to have the task of placing as many products as possible into cartons, at the same time not exceeding the capacity of the carton and the permissible weight specified for the carton. Initially, I accept one... |
I have two random variables, X and Y, and Y is a positive real number. I can sample from $p(y|x)$, but I need to sample from $p(x)$, which I know to be proportional to $\frac 1 {E[y|x]}$. I could estimate $p(x)$ from the mean of a lot of samples from $p(y|x)$ and then use a Metropolis algorithm, but sampling from y i... |
I am trying to calculate the First and Follow of the following grammar
S->ABC
A->Aa
A->aB
B->Bb
B-> epsilon
C-> Cc
C-> Epsilon
I have calculated the firsts and it is all good
Follow(A) = {a,b,c,$}
What is confusing me is the follow of B, I get Follow(B) = Follow(A)
But on the other hand, I have a solution for the gra... |
In the parsing tables of SLR(0), LALR(1) and LR(1) I have seen that shift moves and reduce moves have separate columns from Go-to Moves. What is the logic behind this?
|
$3SATplus$
Input: 2 CNF formulas $F_1$, $F_2$ where all clauses have exactly $3$ literals.
Question: Does every truth assignment satisfy at-least as many $F_2$ clauses as $F_1$'s?
Assume $3SATPLUS \in NP$
Prove $3SAT \leq_p$ $3SATplus$
The reduction is as follows
$F_1 = (x \lor \bar{x} \lor x) \land \dots \land (... |
this question was originally written in mathoverflow, but a comment recommended me to rewrite it as a CS question.
This is not a mathematically formalized question. I'm sorry for that but think it's more like mathematics than philosophy.
When we proved a theorem A which says "B is undecidable", we don't try to prove ne... |
In stack-based memory allocation: is memory allocated at compile time? If so, then how can we allocate space for, say, n number of recursive calls made during the execution of the program?
|
In the textbook of CLRS, 'ch. 34.2 Polynomial-time verification' it says the following:
Suppose that a friend tells you that a given
graph G is hamiltonian, and then offers to prove it by giving you the vertices in order along the hamiltonian cycle. It would certainly be easy enough to verify the proof: simply verif... |
There is evolving notion of stacked reinforcement learning systems, e.g. https://www.ijcai.org/proceedings/2018/0103.pdf - where one RL systems executes actions of the second RL system and it itself executes action of the thrid and the reward and value flows back.
So, one can consider the RL system RLn with:
S - spac... |
What is the amortized analysis of increment action in a ternary counter that is initialized to 0?
|
In Sipser's Intro to Theory and computation, He writes:
I don't understand the constraint on x. Shouldn't it be just y <=p? (Equal bc in the case when machine M runs through all states p) Making xy <=p, the theorem only wants us to consider the first p elements and the first repetiton. Why can't any repetition be cons... |
does anyone know of an efficient algorithm to compute the partition of a graph in N cliques?
Notice that N is the number of the cliques and not the size of them.
I have heard of the 2 cliques problem, but I'm interested in the more general version.
|
The problem of conjunctive query containment is known to be NP-Complete (originated at Chandra&Merlin 1977). Typically it's shown by reducing 3SAT or 3-colorability into this problem, and the other direction is typically proven by declaring it "trivial" (as it indeed looks trivial to see that the problem is in NP).
My ... |
I was programming the AKS primality test, and I have two questions.
Is it correct that if gcd(n, k)=1, then binomial(n, k)=0 (mod n)?
Is it correct that if gcd(n, k)>1, then binomial(n, k)>0 (mod n)?
|
Bottom up parsers in worst case take O($n^3$) time, and i believe that LR parser being a bottom up parser should also take O($n^3$) time, but i read on wiki that they are able to solve problems in linear time. How can this be possible?
|
Graph isomorphism solver Nauty has two main procedures, individualization and refinement, to get to a discrete partition. During refinement procedure, we take some cell of the current partition and attempt to further split the partition on more cells. What I found is that depending on the order of which you select cell... |
By definition:
A polynomial-time computable function $f:$ $\{$0,1$\}$$^*$→ $\{$0,1$\}$$^*$ is a one-way function if for every probabilistic polynomial time Turing Machine $PTM$ there is a neglegibible function $E$ $:$$\mathbb{N} → \mathbb{N} $
$ \ s.t. \ $ $Pr$ $x$ $∈$ $\{$0,1$\}$$^n$ $[PTM \ \ inverts \ \ f(x)] ≤ E(n... |
I recently read about the idea that the human brain might be a Turing machine (or Turing complete). If that is true then how is the brain able to reason that a certain problem is undecidable for e.g. the the liar paradox. I assume that a Turing machine will nor be able to reason that the liar paradox statement is a log... |
I'm not major in science at all and would like to verify whether my understanding is correct or not.
I just did some googling about the definition of protocol, such as in this, this one, this one and more.
And, I would like to know:
is a protocol a pack of algorithms and programming source codes? (in both the computer... |
In Python when we are building a recursive algorithm that uses backtracking a mutable type such as a list is great to use. It can be modified at each call in our recursion tree, then returned back to it's original state once all children have been recurred on. See the image below for an example.
However, when using a... |
struggling with this question from an exam:
input:
DAG G=(V,E). each edge $e_i$ has weight $w_i\in \text{{0,1,2,3}} $
Two vertices : s,t
Number: k
output:
A path from s to t with total cost k (if exists)
|
I might need some help with the following question.
Given a Partial Combinatory Algebra, we can define the fixed point combinator $Y := [\lambda^{*}xy.y(xxy)][\lambda^{*}xy.y(xxy)]$. How does this relate to Kleenes recursion theorem, aka. fixed point theorem?
In the setting of Kleenes first PCA, ie. the PCA of computab... |
I have a method to solve the $\mathsf{\#P}$ version of 3SAT in a way that seemingly reduces it to an $\mathsf{NP}$ problem. - I don't have a formal understanding of these terms so I will just show an example here.
How many solutions does $\phi=\left(x_1 \vee x_2 \right) \wedge
\left(\neg x_1 \vee x_3 \right) \wedge \... |
def f(n):
if n < 100000:
return 0;
for(int i = 0; i < n*n; i++){
return f(n-1)
}
What is the time complexity?
My answer is $O((n!)^2)$. Here's my thought process:
The for loop will be running $n^2$ the first time.
However, during the first loop (i.e., $i = 0$), it will call $f(n-1)$, hen... |
I want to solve this recursion:
$$T(n) = 5T(\frac{n}{5}) + \frac{n}{lg(n)}$$
My attempt and issue:
None of the cases for master theorem apply here.
I tried using Akra-Bazzi method (https://en.wikipedia.org/wiki/Akra%E2%80%93Bazzi_method) with
$f(n) = \frac{n}{lg(n)}$
The derivative of $f(n)$ satisfies the condition for... |
I am to prove that $L :=\{0^i1^{i^2}:i\in\mathbb{N}\}$ is not context-free. I presume that I can do this with the Pumping Lemma and the word $0^p1^{p^2}$, where we assume for a contradiction that $L$ has a Pumping Length of $p$, and here's my attempt:
Let $0^p1^{p^2}=uxyzv$ such that $xz$ is non-empty, $xyz$ is of leng... |
Construct a context-free grammar for the set of tautologies in $p$ - that is, the set of formulae in $\{p, \text{true}, \text{false}, \land, \lor, \lnot, (, )\}$ which evaluate to $\text{true}$ for any assignment to $p$.
My first step is to construct a CFG for all propositional formulae:
$$ S \rightarrow S \land S \m... |
Suppose you are in a middle of computation on a non accepting state and at this point, an input of 0 is rejected by the DFA. But, according to Sipser's formal definition, you must still draw an exiting arrow for input 0 from this nonaccepting state, which is just redundant. Why not draw no arrows at all for 0?
|
If we have directed modification of TSP, so that some routes are possible in one direction, given directed graph, could you compute number of possible tours?
What if we have supercomputer, does it make dTSP more feasible?
edit:The number of different Hamiltonian paths in undirected graph is (n−1)!/2 in fully directed v... |
In the book multiple view geometry, the epipole is defined as follows:
The epipole is the point of intersection of the line joining the
camera centres (the baseline) with the image plane. Equivalently, the
epipole is the image in one view of the camera centre of the other
view. It is also the vanishing point of... |
For any language $A$, define a language $L_{A}$ as:
$L_{A} = \{0^{n}: \text{Number of strings in $A$ of length $n$ is more than $2^{n-1}$} \}$
I am trying to construct an $A$ such that $L_{A} \notin P^{A}$. It should intuitively be true, as a polynomial time machine cannot query an exponential number of strings and che... |
I came across following problem:
Let two processes P1 and P2 are there:
+-----------------------+-----------------------+
| P1 | P2 |
| while(1) | while(1) |
| { | { |
| //s1 | //s3 ... |
I am watching an introductory course on computer science. At one part, it starts talking about unicode and how the bits 11111011000000010. He states that that codes for a laughing/crying face emoji.
However, he later on talks about how the pixels are each created through a number of bytes.He says the bytes 72, 73 and 3... |
A question from an exam:
Input:
A map of a country with distances (in km) on roads. some
cities have gas stations.
The map is given in the form of directed graph G=(V,E),
gas stations are a sub group D of V.
A person wants to get from city a to city b. he starts
with a full gas tank which lasts C km.
Out... |
I have an unweighted undirected graph $G(V, E)$ of diameter 3 and a subset $T\subseteq V$ of these vertices. I want to find the minimum tree $(V', E')$ that contains all vertices in $T$, minimizing the number of nodes $|V'|$.
Is it true that $|V'|\le 2|T|$? If $G$ is of diameter 2 it is easy to prove that this is true.... |
I have implemented huffman encoding in the form
struct node
{
node * left;
node * right;
double freq; // the frequency
string letter;
string binary_code; // the variable length code
};
that works fine, eg:
Data: electric eels
Compressed: -σ» //doesnt render in this text editor sorry
Decompressed: e... |
I am doing some reviewing for the term final on computability and found out this simple exercise. I am very fresh on theoretical computer science so if you do have an answer please make it simple.
The question is fairly simple: Is there any recursive function f whose code is unique? That is $comp(p_1, ) \doteq comp(p_2... |
I'm searching for a fast way to calculate
$$ g(k):=\max_{0<i<T-k} {\frac{1}{k} \sum_{j=i}^{i+k} f(j)}$$
for $ 0<k \le T $ given some discrete function $f$ defined on $ [0; T]$.
Is there algorithm to do it faster then naive $O(n^2)$? If so, how?
|
How do I decide if a language is decidable and/or semi-decidable?
I have theses languages:
a) { < M > | L(M) ⊆ 0*}
b) { < M > | L(M) contains at least one word of even length}
c) { < M > | L(M) is semi-decidable}
d) { < M > | L(M) is decidable}
My problem is, that I don’t quite now how to interpret this notation. I kno... |
Recently I saw 3 cps transformation rules, but no explanations were given.
expressions: $e :=x\left|e e^{\prime}\right| \lambda x \cdot e$
rules:
$$
\begin{array}{l}{[[x]]=\lambda \kappa \cdot \kappa x} \\ {[[\lambda x \cdot M]]=\lambda \kappa \cdot \kappa(\lambda x \cdot[[M]])} \\ {[[M N]]=\lambda \kappa \cdot[[M]](\... |
Does someone know how to solve the below?
Assume that the array $A$ is already sorted.
And show an $O(n)$-time algorithm that determines whether or not there exist indices $i,j,k$ such that
$A[i] + 4A[j] = A[i] + 5A[k] = 0$.
I came up with an algorithm that uses two double for-loop for each i, j and i,k. But the compl... |
There is an information source on the information source alphabet $A = \{a, b, c\}$ represented by the state transition diagram below:
a) The random variable representing the $i$-th output from this information source is represented by $X_i$. It is known that the user is now in state $S_1$. In this state, let $H (X_i|... |
Given a generating grammar, is it possible to reduce it to a context free form, if one exists. One method might seem to be if the context sensitive rules can be reached from higher generating points, in some sense. However, is this an interesting question worth worrying about? Are there practical situations, where ther... |
Determining whether two programs always return same output for same input is undecidable (easily reduced to the halting problem). My question is, is there a complexity class in which this problem is decidable for machines on that class?
Seems like it must be below PTIME, as Datalog is P-Complete and equivalence of Data... |
I have stumbled upon this language: $L = \{(M,m,n)|\exists x \in \{0, 1\}^n:M$ uses $m$ space on input $x$$\}$. At first, it looked like an undecidable problem, but I have failed to prove it, and now I am beginning to wonder whether it is actually decidable.
I have designed the following algorithm. Let $G_{M,x}$ be the... |
not sure if this is the right place to ask this but here it goes.
Let's assume I have some 2D points dataset consisting of facial landmarks, and I want to cluster these based on similarity so that I can refer to a notion of "prototype" of a facial expression.
As a measure between one point set and another I could be us... |
HAMPATH
Input: An undirected graph $G$ and 2 nodes $s, t$
Question: Does G contain a Hamiltonian path from $s$ to $t$?
HAMCYCLE
Input: A undirected graph $G$ and a nodes $s$
Question: Does $G$ contain a Hamiltonian cycle starting at $s$?
I wish to show HAMCYCLE is NP-hard. I'll show this by doing $HAMPATH \leq_... |
This is my solution for Leetcode 395, and I'm wondering how I can come up with its time complexity:
Input: string $s = s_1,\ldots,s_n$, integer $k$
Go over all symbols $s_1,\ldots,s_n$, one by one
For each symbol $s_i$, check whether it appears less than $k$ times in $s$
If all symbols appeared at least $k$ times, ret... |
I searched a lot trying to find a reference for the complexity of K-colorful coloring problem for a hypergraph but I cannot find it. Please if anyone has a reference for the complexity of the problem let me know. I think it will be NP-Complete
Let H = (V, E) be a hypergraph, and let ϕ be a coloring of H. A hyperedge e ... |
Say that I have the following set of variables:
[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
The values represent a list of variables from a dataset. Each variable has a certain level of correlation with the target variable $. The correlation increases or decreases depending on the sort of combination you us... |
If I stored the output for my algorithm as a data structure as a cell array. How can I express that when I am writing the pseudocode for my algorithm.
For example, I have a set of $n$ values like {2,4,6} and for each value, I run the algorithm and output a matrix.
I want to express in the pseudocode of my algorithm h... |
Are they using the words "feature", "attribute", and "decision variable" interchangeably in this paper about an optimization method for clustering (and if so, does that go against the general use of the terms)? I've been a bit confused especially about what they really mean when they say "decision variable" since I don... |
Given a weighted, cyclic, directed graph and two nodes I am looking for a connecting path which total weight comes as near as possible to a specific value which is greater than the shortest path.
Example in a real world scenario: Find a route from Washington D.C. to New York City which is 400 miles long, despite the sh... |
The VC-dimension of a hypothesis class $\mathcal{H}$ is defined to be the size of the maximal set $C$ such that $\mathcal{H}$ cannot shutter. This paper shows that the VC-dimension of the set of all Turing Machines with $n$ states is $\Theta(n \log n)$.
However, suppose that we take the set of all such Turing machines... |
I came across following problem:
A certain computation generates two arrays a and b such that a[i]=f(i) for 0 ≤ i < n and b[i]=g(a[i]) for 0 ≤ i < n. Suppose this computation is decomposed into two concurrent processes X and Y such that X computes the array a and Y computes the array b. The processes employ two binary... |
I am looking for information regarding the evolution of computing capability. Specifically I would like to know how many floating point operations were performed worldwide from, say, the deployment of ENIAC to the first moon landing... Or any other time interval before, say, the '80s. is this a question that I can esti... |
Particularly, we already have some oracle separation results such as $\mathbf{BPP}^A\neq \mathbf{BQP}^A$ [Simon], $\mathbf{NP}^A\not\subseteq \mathbf{BQP}^A$ [BBBV], and $\mathbf{BQP}^A\not\subseteq \mathbf{NP}^A$ [Bernstein and Vazirani]. But given that most problems are non-relativising, how does such oracle separati... |
The question in Proof of big-o propositions asked to prove:
$O(f(n))=O(g(n))\iff\Omega(f(n))=\Omega(g(n))\iff\Theta(f(n))=\Theta(g(n))$
The accepted answer starts the proof with:
Suppose that $O(f(n))=O(g(n))$. It is easy to check that $g(n)=O(g(n))$ ... and so $O(f(n))=O(g(n))$ implies that $g(n)=O(f(n))$.
I bel... |
How many final states exist in the minimal DFA that accepts the language $a^*b^* + b^*a^*$?
|
When I study the Arithmetic Unit, there is the below information:
there I have some questions:
Why the multiplier must store in the MQ and the product must divide into the high part and low part?
Why the quotients must store in the MQ? why the multiplier and quotients can not store in the ACC?
|
I think it will be best to explain the problem first and then explain what I am thinking:
I have a dataset similar to the following:
fruit,calories,cost
apple,100,1
apple,200,1.5
apple,150,2
pear,300,3
pear,100,.5
pear,250,2
orange,100,1
orange,120,1
orange,400,2
And I am trying to maximize my calories while keeping m... |
From this website, it states that the average case of Quicksort algorithm is
T(n) = T(n/9) + T(9n/10) + θ(n)
Im a bit confused. Is it supposed to be ?
T(n) = T(n/10) + T(9n/10) + θ(n)
|
I was wondering, given the usual stack memory functioning, whether it is possible for an array like primitive type allowed to grow in size to exist.
The functioning of such primitive type is as follows.
Any one function is allowed to have only one such primitive variable.
Appending to such primitive variable is allowe... |
This seems like a silly question, but I couldn't find a conclusive answer for it.
As far as I know, ZPP contains algorithms which run in polynomial time and either return a known-correct answer or abort (this definition is equal to the one where they either return a correct answer or run in exponential time). It is al... |
I understand that the worst space complexity of Bubble Sort is constant O(1), since all the space we need is the array where the elements were stored. But why is Merge Sort's worst space complexity O(n), linear? All space we need is the exact number of the elements, right? Please enlighten me.
|
I'm new to computer science, but I've studied physics for a while. I'm just curious, if one wanted to make a simulation of the law of conservation of energy, on a large scale, how would it be done? Most simulations take shortcuts for objects off screen, or may even skip them entirely during iterations. The objects may ... |
I’m trying to solve a problem very similar to the assignment problem, with a few twists.
The problem has a certain amount of workers, and a certain amount of tasks - workers is always >= tasks. Each agent has a cost to perform each task. The goal is to assign workers to tasks such that the total cost is minimized and s... |
If we are given only one NOT gate and any number of OR and AND gates, then, can we simulate more NOT gates?
|
Substructural logic is logic without some or all of the structural rules. Is substructural Prolog, substructural logic programming possible? My question is connected with article https://link.springer.com/chapter/10.1007/3-540-40030-3_8 Grammar Induction as Substructural Inductive Logic Programming - if substructural P... |
Consider a universe with two elements 0,1 and a second order formula, i.e. of the form "forall R exists S ... such that F", where R,S are relation symbols of some given arity, and F is some first order formula e.g. "exists x forall y R(x,y)&S(y,x)".
Further for simplicity assume that the quantifier-free part (the "matr... |
lately I'm reading about descriptive complexity, which I find is a fascinating branch of computational complexity.
I found many formulas in $\exists$$SO$ that describe problems with graphs but none that describes the 3SAT language.
Thinking about it, I came to an "atomic" description like this:
$\exists$$v$$\forall$$C... |
We are given undirected graph of $N$ nodes and $M$ edges, we want to count the number of possible ways to paint this graph in $2$ colors such that for each two nodes having the same color, there must be an edge between them.
I tried some examples on paper and I always got numbers of the form $2^x$, however I couldn't s... |
Niederreiter cryptosystem is usually described by a parity check matrix $H$ over $\mathbb{F}_{2^n}$.
The minimum distance $d$ is given by
$d := min\lbrace k \text{ such that there are $k$ linearly dependant columns in $H$}\rbrace$
Encryption in this case is done by encoding messages $m$ of weight less than $d/2$.
Now ... |
Not looking for code, just a general solution or pointers in the right direction. I think that my problem can be adapted into an instance of the knapsack problem. I made an attempt at it, but couldn't figure out something that worked. (I can elaborate on this more if necessary.)
Concrete scenario
The actual scenario is... |
NOTE - I can't find a good answer in the Similar question above ^
Given a DFA, is there a fast algorithm that determines whether it's minimal?
I'm looking for an algorithm that works faster than just minimizing the DFA and checking if the number of states changed. i.e, faster than Hopcroft's O(nslog(n)).
I already find... |
I have a set of deployed products $A$, $B$, $C$, ... Each product has a set of releases $A_1$, $A_2$, ... Right now suppose I am deploying the first release of each product. I would like to try to upgrade to the latest release of each product, if possible. Each product release can potentially depend on some range of re... |
A problem $X$ is $NP$-Hard if for all $Y \in NP$, $Y \leq_P X$. Further, if a problem $Z$ is $NP$-Complete, and $Z \leq_P X$, then I can prove (rather mechanically) that $X$ is $NP$-Hard.
I also found that, for a given X, say TSP, to prove it is $NP$-Hard, we often find a ($NP$-Complete) Z say $HAM-CYCLE$ (Hamiltonia... |
I'm reading about autoreducibility, which is the following notion:
A set $L$ is autoreducible
if there is a polynomial-time oracle Turing machine $M$
that accepts $L$ using $L$ as an oracle, with the caveat
that $M(x)$ may not query whether $x \in L$.
I encountered some results that are confusing me. In Using... |
It is said that practically all-zeros and all-ones subnets are not used.
Let us consider an a network $200.200.13.13/25$
Here Network ID is represented by using $25$ bits and Host ID using $32-25=7$ bits.
Binary Representation : $11001000.11001000.00001101.00000000$
Last 7 bits which represent HID are $0000000$
Suppose... |
In text books, for instance in the 3rd edition of Introduction to Algorithms, Cormen, on page 625, the weights of the edge set $E$ is defined with a weight function $w:E\rightarrow \mathbb{R}$.
Why is it defined in this way? Why do we need a function? I mean, we all know when working with a graph, that the meaning is j... |
I was wondering if anyone knew of an algorithm that when given a directed graph will split it up into separate Hamiltonian paths. I don't really mind about nodes that can't be added to a path but as few paths as possible should be made to include the most nodes.
Any ideas would be greatly appreciated.
|
Recently, my friend has submitted a paper and solved a problem with an exact method. Surprisingly, a reviewer asked him why he used an exact method instead of the popular metaheuristics algorithms! We replied to the reviewer based on our knowledge as follows:
"We use metaheuristics when solving the problem is hard and ... |
Do the functions of the collatz conjecture and their inverses model a Trapdoor Function?
If given a, b, a^-1, b^-1 and your choice of f(x), is it “hard in the average case” to find some secret x?
I propose that the probability:
Pr[f(F(f(x)))=f(x)] < n^-c
=Pr[(2^-n)^2] < (n^-(n-1))
Simplifies to:
1 < (log(2)) * ((log(... |
I have a loop:
for(int i = 1; i < N; i*=5) {...}
where {...} is some statement.
I'm trying to understand its run time. So, far I know that:
We start with $i = 1$
We finish when $i > n$
$i$ is incremented by being multiplied by 5.
So, would the run-time be $\log_5(n-1)$? The reason I'm not sure it's because I thought ... |
According the frame format of Ethernet
Minimum Frame Size should be :
7Bytes + 1Bytes + 6Bytes + 6Bytes + 2Bytes + 46Bytes +4Bytes = 72Bytes
Maximum Frame Size should be :
7Bytes + 1Bytes + 6Bytes+ 6Bytes + 2Bytes + 1500Bytes + 4Bytes = 1526Bytes
But it is said that the minimum frame size is $64Bytes$ while the max... |
N people attend a gathering and will be given candies at the end.
Each person gets at least one candy
Maximum number of candies any ith person can be given, is given in an array A[ ] of length N
Success of the event is calculated by a number as follows:
initial success=0
for i=2 upto N,
success = success + absolute ... |
In an image processing project (using opencv with python), I am trying to detect as precisely as possible the location of a rectangular object in a photograph. My final goal is to output the 4 corners of the object.
For example, an image could look like this:
In the first stage I am able to detect an approximate bound... |
I've been attempting to write a Bentley-Ottmann sweepline algorithm to transform a self-intersecting (complex) into a set of simple polygons.
There are some instructions on this page (see the heading entitled "Decompose into Simple Pieces") however my current implementation is falling short (see img below).
While I'm ... |
In the propositions-as-types paradigm, we are still faced with the question : what types are propositions ? I currently know 3 different answers :
Coq's sort Prop and its typing rule that asserts it is closed under products indexed by abtirary types
$$\frac{A : \mathsf{Type}_i \qquad x : A \vdash B(x) : \mathsf{Prop}}... |
There are a few possible approaches to proof automation in modern Coq.
Writing proof scripts with Ltac. This is the approach described in http://adam.chlipala.net/cpdt/, which the author uses to great effect in projects like http://adam.chlipala.net/papers/BedrockPOPL15/. It can significantly reduce the amount of proo... |
I came across following problem:
A system has n resources R0,…,Rn-1,and k processes P0,….Pk-1.The implementation of the resource request logic of each process Pi is as follows:
if (i % 2 == 0) {
if (i < n) request Ri
if (i+2 < n) request Ri+2
}
else {
if (i < n) request Rn-i
if (i+2 < n) reque... |
I have a tree as
Is it an AVL tree? it seems to balanced for me.
|
It is known that a PDA with two stacks is equivalent to a TM.
On the other hand a PDA with one stack is capable to recognise only context-free languages.
Hence there is a kind of a gap between the class of PDA with one stack and the class of PDA with two stacks which should be capable to recognise only context-sensitiv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.