instruction stringlengths 35 29.1k |
|---|
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... |
I want to find a reference for the following problem or a similar problem for my paper. I found a greedy algorithm for this problem, but writing such an algorithm in a paper is not common in my area, and finding a reference is the best solution.
We have a connected hypergraph. We want to choose a list of hyperedges sat... |
I checked my Mac, it shows the memory is 16 GB 2400 Mhz, does it mean that the bandwidth is $ \dfrac{16\times1024}{8} \times 2400$, is there any thing wrong with that calculation, because the value seems a little incredible, I am new to this kind of computer science, hope someone can help me.
Thank You
|
The Bellman-Ford algorithm checks all edges in each step, and if for each edge the following:
$d(v)>d(u)+w(u,v)$
holds, then $d(v)$ will be updated. $w(u,v)$ is the weight of edge $(u, v)$ and $d(u)$ is the length of best path was found for vertex $u$.
If in any step there is no update for all vertexes, the algorithms ... |
And how do I solve this?
I know this is a decimal and we have to convert it to an exponent. I want to know how I would solve this and the steps as well so I will be able to solve questions similar to this in the future. Thank you
|
I am reading basics of Exponential Time Hypothesis (ETH). There are two statements for it:
Statement 1
There exists no $2^{o(n)}$ algorithm for $3$-SAT, where $n$ is the number of variables.
Statement 2
If $\delta_q$ ($q \ge 3$) is the infimum of set of constants $c$ for which there exists an algorithm for solving $q$-... |
I'm not sure if this is off-topic but I was thinking about the following: many modern (object-oriented) programming languages are very similar at their core, i.e. they share language features like iterative functions, classes, objects, inheritance, polymorphism etc. Has anyone ever attempted to create a "unifying" (may... |
I have read that; if a polygon contains a hole in it, then the dual graph of a triangulation of the polygon not have to be a tree. But could not get it exactly. How is it possible, what is the relation with the hole in it?
If anyone could explain it with a polygon contains hole. I would be very happy and thanks in adva... |
I have an NP-hard problem and an optimization to deal with the problem.
I want to know that is it possible to distinguish between easy and difficult instances of the problem by the parameters of the optimization, like the number of iteration to solve them?
I am not sure that there exists any relation or not. But, I tho... |
Find if a given integer is in the series $1, 5, 2, 13, 10, \dots$ in the most efficient way, where the sequence is given by
$$
f(n) =
\begin{cases}
1 & n=1, \\
2f(\tfrac{n}{2})+3 & n \text{ even}, \\
2f(\tfrac{n-1}{2}) & n>1 \text{ odd}.
\end{cases}
$$
The series is infinite of course, and $x$ can be a number with at m... |
I am trying to prove that $\text{NEXP} = \text{MA} \Rightarrow \text{NEXP} \subseteq P/\text{Poly}$. I tried to approach the result via trying out the contrapositive, that $\text{NEXP} \nsubseteq P/\text{Poly} \Rightarrow \text{NEXP} \ne \text{MA}$ but I couldn't get anywhere. Can anyone give me a hint to proceed?
|
Show that if $SAT \in P/klog(n)$ then $SAT \in P$
Assuming that there is a a constant $k \in \mathbb{N}$ such that $SAT \in P/klog(n)$, I need to prove that $SAT \in P$.
Since $SAT \in P/klog(n)$, then there is a sequence of advices $\{a_n\}_{n \in \mathbb{N}}$ of length $|a_n \le klog(n)$ and a turing machine $M$ that... |
Hi I am currently learning about orthogonal range search and found two data structures with two different runtimes and wanted to proof that one always dominates the other.
So I found out about k-d-trees with a query time of
$$\mathcal{O}(n^{1-\frac{1}{d}})$$
and range trees with a query time of
$$\mathcal{O}(\log^{d-1}... |
Suppose $L_1$ is a regular language and $L_2$ a non-regular one, then:
is $L_1\setminus L_2$ REGULAR/NON REGULAR/BOTH OF THEM?
is $L_2\setminus L_1$ REGULAR/NON REGULAR/BOTH OF THEM?
|
Let's say we have a forest of imperfect binary merkle trees of different heights (this is an invariant). Only the numbered nodes store data, the rest store hashes. Here is an example with 4 trees, with heights 3, 2, 1, 0. Laid out with the leaves at the bottom, non-leaf roots labeled with letters:
A
|---------------\
*... |
I am trying to find a fast algorithm that can compute the number of hamiltonian paths in an undirected graph. I saw this on the web, but it sounds like this finds all hamiltonian paths starting from one specific vertex. (for example vertex '0' in this code)
One idea is to run the above algorithm for all of the vertices... |
I'm trying to give a general comparison of the time complexities of various thresholding algorithms. I have not taken an algorithms course yet, so please forgive any misunderstandings.
Otsu's method is performed on $N$ pixels with $L$ number of pixel intensities (e.g. an 8 bit greyscale image would have $L=256$). The a... |
I was reading a paper and I came across the term $L\notin i.o.Dtime(2^{n^c}/n^c)$. What is the meaning of this?
|
Let $f: \mathbb{R}^n \to \mathbb{R}$ be a convex function. Let $V \subseteq \mathbb{R}$ be some closed convex set. Consider the following convex minimization problem:
\begin{align}
\min_{\mathbf{x} \in V} f(\mathbf{x}) \label{minconv}\tag{1}
\end{align}
Let $\mathbf{x}^*$ be the minimizer of $f$, i.e., $\mathbf{x}^* = ... |
I'm pretty sure that the Turing machine state diagram I drew accepts all strings in the language $\{a^{n}b^{2n}c^{3n}|\ n\ge0\}$, but how do you verify this? Likewise, how do you verify that this machine rejects any string not in the given language?
|
I am trying to learn more about the CPU in embedded systems. As I am studying I learned that the IR (Instruction Register) is kind of a special register.
What I would like to know is how to know the width / size of the IR. So, what I mean is for e.g. if I have a 16-bits CPU with 18 address lines (that means max. 256 Kb... |
It's quite easy to show that there are only three recursive sets up to m-equivalence, namely $\emptyset,\{1\},\mathbb N.$ Can we state something "similarly short" for recursively enumerable sets, like there are only 4 recursively enumerable sets up to m-equivalence – $\emptyset,\{1\},K,\mathbb N$ (where $K=\{i\mid\varp... |
I wonder how can I construct 4 (distinct) codewords given the fact that code distance is 5. As far as I know that the code distance is the number of distinct bits between any 2 codewords. How to achieve this code distance for the 6 possible pairs from the 4 codewords available(of any bit length). I named, for example, ... |
Because of the covid-19 pandemic, our firm works semi-remote working. We want to that:
Every day 2/5 of staff should be in the office.
Everyone should go to the office 2 times a week.
Teams want to go to the office together. But teams are not very strict. Some people are in 2 teams. So there may be no best solution fo... |
Let there be a bipartite directed graph $G=(V,E)$.
Let's say we have a path cover of the graph. In some texts it is said that this path cover "induces" a flow on $G$. What does this mean?
How can we extract a flow from a path cover (and similarly, extract a path cover from a flow)?
|
I want to know whether there is a decision problem, written EasyProblem, satisfying the follow property:
For every valid instance $x$, $x$ is a Yes-instance for EasyProblem (if we construct EasyProblem as a nature problem). Formally speaking, maybe we can define EasyProblem as a language $L \in \mathrm{DTIME}(n)$ or e... |
Are the algorithms for picking between 2 numbers randomly a lot less computer intensive than the algorithms for picking almost any number randomly? The definition of random for our purpose is anything that's random enough to be thought as being random by the general population. I am thinking it is true, but I wouldn't ... |
I don't understand why I am getting the following execution times for the quicksort with a random pivot.
Times are in microseconds they are the average of five executions.
Random array: 9097
Sorted array: 4250
sorted backwards array: 4396
This doesn't make sense to me. It is obvious that th... |
We are given a Graph G where, s ∈ V and t ∈ V. w:E such that w represents the time from u to v. We have to calculate shortest path between s to t with a twist. The twist is the turbocharger which can be activated at any node u, such that time between u to v becomes (u,v)/3. The turbocharger has to be used just once. F... |
We want to calculate $A_1 \times A_2 \times \cdots \times A_n$, where $A_i$ has dimensions $d_{i-1} \times d_i$.
In the classical matrix chain multiplication problem, we wish to minimize the total number of scalar multiplications. In this problem, we consider the all intermediate matrices arising in the computation (in... |
I'm creating app that allows user to authorize by drawing dynamic gesture in front of camera (actually Leap Motion sensor, but that's not the point). Every person can save their own gesture as their password, so for every user I have a time series representing the gestures where single frame is an array of values that ... |
It is well established that palindrome language is non-regular. The one way to prove it is by means of pumping lemma. The other way is violating the closure properties of regular language. The strategy seems that pick a regular language and intersect with language L under consideration. If the result is a non-regular l... |
I'm studying The Algorithm Design Manual and I was having some difficulty in the proof exercises,
so I asked a question here.
Based on the answer I got in that question(which was not the a complete proof),I came up with a proof.
Prove the correctness of the following sorting algorithm.
Bubblesort (A)
for i ... |
I am learning about model of computation and I found this wikipedia entry that categorises and outlines various model of computation.
Now I want to know the programming languages that builds on these models.
I am aware that functional programming languages are built upon lambda calculus, and that imperative programming... |
I have $$T(n)=T(n-1)+n^{2}$$
And I know, by drawing the recursion tree that this is $\Theta (n^{3})$
However, if I try claiming that it's $O(n^{2})$ through induction:
$$T(n)\le c(n-1)^{2}+n^{2}\le cn^{2}$$
which evaluates to
$$c\ge \frac{n^2}{2n-1}$$
Which makes $c>0$ for all $n>1$ and concludes that the recurrence is... |
Given a sequence $a_1,\ldots,a_n$, find the shortest subsequence $a_i,\ldots,a_j$ such that $\{a_1,\ldots,a_n\} = \{a_i,\ldots,a_j\}$.
I came up with three solutions:
The most straightforward brute-force solution is $O(n^3)$.
We can optimizing brute-force solution, performing a binary search on subsequence length in ... |
I keep encountering citations of the following article:
Takahashi and A. Matsuyama, “An approximate solution for the Steiner problem in graphs,” Math. Japonica, vol. 24, no. 6, pp. 573–577, 1980
For example, Yahui Sun refers to it here as "a widely-used Steiner tree approximation algorithm".
But... w... |
I'm trying to optimize a system with a better algorithm for allocating storage. The system has 'N' writer processes and 'M' disks. (N < 30, M < 10. N can change, M is constant).
Any process can write to any disk and each process regularly writes a file every, say, 5 minutes, but the size of the file can be quite diffe... |
How to prove that language $L = \{G \; | \; \omega(G) \geq \frac{9}{10}\cdot n\}$, where $n$ - number of vertices in the graph, NP-hard?
$\omega$ - is a clique number.
|
I've got this question from a course:
Show how to efficiently find a certificate for each of the following problems assuming that the decision problem is efficiently solvable.
And it seems like this has been poorly explained and I am getting conflicting answers on how to answer. For explanation purposes I will consid... |
I have a sorted multiset (size < 100, real valued) and want to determine the $n^{\mathrm{th}}$ largest of all possible subset sums (including multiplicity in the sums).
Attempt at solving :
I have been looking at ordering the sums starting with the unbounded knapsack problem (UKP) with equal weights to find the sets of... |
Consider the language of all strings whose length is divisible by either $x$ or $y$, where $x,y \geq 1$.
After trying various values of $x$ and $y$, I noticed made the following observation:
If one of $x,y$ is a multiple of the other, then the minimal DFA contains $\min(x,y)$ states, and otherwise it contains $\operat... |
This is given vertabim in my lecture slides and it seems like I'm having difficulty proving this statement mathematically. I know that P is a subset of NP and NP-Complete is also a subset of NP. But what else do we have to prove for this statement?
|
Is it in in a deadlocked state?
In this graph, there is a deadlock initially I think. Since P1 is holding R1 and waiting for R2; P2 is holding R2 and waiting for R1 and R3; P3 is holding R3 and waiting for R1.
Or P1 and P2 are also in a cycle. So it is in a deadlocked state. Am I correct to claim that?
If one more ... |
Why do we create Universal Turing Machine explicilty to simulate the run of a word (say, $w$) on a Turing Machine $M$, given the description on it? Can't we just run $w$ on $M$ itself? I don't see the point of it.
|
Let $M(x,w)$ be a polynomial Turing machine with $|w| = poly(|x|)$, and $L = \{x | \exists_w M(x,w)=1 \}$.
Assuming that $P=NP$ I want to show that there is a polynomial algorithm $N(x)$ that finds a witness for $x$ according to $L$. Namely:
$\forall_{x \in L}M(x, N(x)) = 1 $
My idea was to decide the bits of a witness... |
On the page 1073 of CLRS(Introduction to Algorithms),
Given a circuit C, we might attempt to determine whether it is satisfiable by simply checking all possible assignments to the inputs. Unfortunately, if the circuit has k inputs, then we would have to check up to 2^k possible assignments. When the size of C is polyn... |
I have a machine learning problem where I need to find the most dissimilar subset of rows/columns of an $m$-by-$m$ symmetric similarity matrix $M$ which minimizes the sum of the elements in an $n$-by-$n$ submatrix $N$, where $n < m$. In other words, by minimizing this sum, we find the most dissimilar rows/columns in $M... |
I have a feeling that it's related to how different output layers are stacked up against one another? However, there's a missing link in that argument that I can't completely get to.
|
ReLU units are said to be necessary in CNNs to introduce non-linearity which convolution does not involve. This is needed, because many real-world forms of data are non-linear.
What does non-linearity refer to?
|
The famous 4-sum problem is to find 4 elements at unique indices in an array which sum to a given X. I was looking at one solution I found:
findFourElements(A[1], ..., A[n], X)
create hashtable mp
for each 1 ≤ i < j ≤ n:
mp[A[i] + A[j]] ← (i,j) // (i,j) is an ordered pair
end for
for each 1 ≤ k < l ≤ n:
if m... |
Point-free style is generally taken to mean a style of programming without explicit variables.
I have some intuitions on point-free style but I want to know what the formal mathematical definition is.
I feel like the informal definition should not be taken too literally. Universal quantification, labels/continuations a... |
As I know $L=\{w\in\{a,b\}^*\mid n_a(w)=n_b(w)\}$ is a deterministic context free language. I have drawn a push dawn automata for this language in the format of Sipser as the following
However, as you may know, in Sipser's format, the transition
$$\varepsilon,$;\varepsilon$$
means that "don't read any thing from the i... |
I've read various descriptions of the TGP, most of which seem vague or conflicting on the precise constraints of the problem. Specifically:
is it always or sometimes impossible to reach consensus
finite/infinite messages required
given unreliable communication, is actual message loss important or not.
As another poin... |
I just wanted to make sure I'm on the right track regarding this.
Here's the function that I'm dealing with:
import math
def Mystery2(A, f, l):
if f == l:
return A[f]
m = math.floor((f+l)/2)
x = Mystery2(A, f, m)
c = 0
i = f
while i <= l:
if A[i] == x:
c = c + 1
... |
I am looking answer for the question: Is every total, convergent function f: N → N is WHILE-computable?
In Wikipedia stand, "Every convergent function is computable." But I have no idea how to implement that to this question. How can I show or disprove this statement?
Thanks!
|
What's the meaning of $\log^{O(1)}(a+b)$ ? Is it simply $(\log_2(a+b))^k$ where k is calculated in constant time ? That is the base 2 logarithm usually in computer science when no other base is set, and the $O(1)$ at the log word means that the whole expression should be raised to the power of that number (which I name... |
It can be read on Wikipedia that MIS is NP-hard. However, is it also NP-complete?
This article says:
"Thus, the Maximum Clique Problem(MCP) and the Maximum Independent
Set(MIS) Problem are equivalent. In addition, both problems are
NP—complete".
However, a professor told me that MIS cannot be NP-complete because only... |
• How CPU identifies which device is sending the request?
• How CPU decide which action should be taken for each request?
|
I've already solved the recurrence exactly and found that $T(n) = n - 1$. Therefore, I know that $T(n) = O(n)$.
However, I'm having trouble showing that $T(n) = O(n)$ without solving the recurrence exactly.
My strategy so far has been to prove that $T(n) \leq cn$ ($c$ is a constant) $\forall n \geq 2$ via induction on ... |
I want to find the bit complexity of finding the $n$-th Fibonacci number using the matrix multiplication method. I know that it has complexity $O(\log n)$ if we assume that the standard operations have complexity $O(1)$, but if we now consider their true complexity, for example $O(n)$ for addition, I don't know how to ... |
So I'm thinking of a simple election prediction program to keep track of the minimum ballots the candidates must gain from the uncounted votes in order to win the election.
Assuming we are considering n states each with some different electoral votes. The candidate who has a majority receive all these votes from that s... |
I was reading about type unification and it moves through of substitution of variables. To me it looks like a search for an alpha equivalence... I mean, two types are unifiable if they are alpha equivalent, at last if they are in polymorphic form, is this right?
If I have forall a.a -> a and forall b.b -> b I can apply... |
I want to prove that the subset sum problem is polynomially reducible to the Knapsack problem. Overall I want to show that Knapsack is NP-complete.
There are two parts to showing knapsack is NP-complete
knapsack is in NP
If I show that the subset sum problem is polynomially reducible to the knapsack.
Then since subse... |
I have the following array that contains a day and the scheduled hours, i wanna know how to check if the given time falls in a period of that array, for example let's say the current time is 20:50 how to know if it's in that scheduled array?
{
"monday":[
"00:00", // Period number 1
"00:15",
"00:30"... |
I am trying to find an Algorithm to find the amount of elements in a BST which are greater than a certain number K.
I found it problematic as there are elements which might be greater then K but wont be found by traveling constantly to the right child, as there might be elements that are greater then K in the left sub-... |
Here is the problem, i have a graphical component that displays a tree. It takes as input an array of nodes and array of edges(eg:an edge has a source and target).
I will be performing complex tasks, such as building the tree dynamically from user input, removing nodes adding nodes, hiding a node's children, i would ne... |
I have to formalize the following sentence:
If any house is green then there exists a horse that is white.
I have formalized it the following way:
$$\forall(x)(\mathit{house}(x)\rightarrow \mathit{green}(x))\rightarrow \exists(y)(\mathit{horse}(y) \rightarrow \mathit{white}(y))$$
A friend formalized it in a slightly ... |
Hello I have a problem and would like a help to prove if it is P or not.
Given an array $\mathcal{A}$ of integers. Is there a permutation of the elements of $\mathcal{A}$ such that, $\forall i \in \{1, ..., |\mathcal{A}|-1\} : \mathcal{A}[i] \neq \mathcal{A}[i + 1]$?
Could anyone give me some direction on how to show... |
We know that $A ≤ B$, $B ≤ \overline{A}$ and $B$ is recursively enumerable. Is $A$ recursive or not?
I tried negating whats given, but didn't achieve much. I know that from the very first inequality that $A$ is also recursively enumerable. I assumed whether $B$ is also recursive or not to maybe get to a contradiction o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.