instruction stringlengths 35 29.1k |
|---|
How can the following recurrence equation be solved by one of three main ways:
$$T(n)=T(n^{2/3})+17$$
I have tried solving it by the iteration way. However it does not work for me since I can't find the equation with $i$, i.e the generic equation.
|
I was reading an assembly procedure that needed to align addresses on 4 bytes boundary for performance reasons so it has used the next statement that i formulated as a theorem to be proven.
Let $s$ be an integer that is not a multiple of 4 ($s \% 4 \neq 0$). $m$, the first next multiple of 4 such that $m \gt s$ is obta... |
I am learning about decision tables and am confused by the colouring in the text book's mark scheme for a question I'm working on. I can not see why some of the columns have been coloured grey. Rather than adding anything to my understanding, the colouring makes me think I'm missing some important point as I can't see ... |
Question: Show that for each even n, there exists a graph with n vertices, such that the ALG(algorithm) returns a vertex cover which is exactly twice the size of minimum vertex cover.
Define ALG: simple 2-approximation deterministic algorithm for the vertex cover problem in an unweighted graph.
Output of ALG: vertex c... |
What kind of data is stored in the RAM when it is fresh out of manufacture?
Apart from certain basic instructions (if yes, what are they), are there numbers stored as well or are most of the memory cells just empty?
|
Given an $n \times n$ shortest path distance matrix $D$. And a complete graph $G(D)$ on $n$ nodes, where edge $(i, j)$ has weight $D_{ij}$. Furthermore, the distance matrix $D$ is computed for a connected network $T$ of $n$ nodes and $n-1$ edges - i.e. the shortest path distance between two nodes in $T$.
About the netw... |
Consider the following image:
Starting at (0,0) top left, the objective is to find a dijikistra path to the bottom right.
We must go through each color exactly once, and once we go outside a color, we can't go back to the same one.
Here is a example of what I think is a optimal path:
As per dikisjtra algorithm, we u... |
I am reading the paper SV2P - Stochastic Varaiational Video Prediction (https://arxiv.org/abs/1710.11252). In it the authors use the loss shown in the image:
Why do we need expectation in the reconstruction loss?
I think that the loss is similar to the one used in the VAE paper.
|
DELETE(S, i): Delete integer $i$ from the set $S$. if $i \notin S$, there is no effect.
from a set of consectutive integers like $S = \{1,2,3,5,6\}$
Provide a data structure and an algorithm for DELETE that takes $O(\alpha(n))$ amortized time
not sure what what does $O(\alpha(n))$ amortized time mean?
I was thinking ... |
I modeled the function double_sided_breadth_first_search after the ideas in "improving Dijkstra" in Cormen et al, and the OCW course on algorithms. Note that I expand the smaller boundary, in an effort to improve efficiency. I have not seen this applied to bfs before. Does anyone know the name of this algorithm? Does i... |
I have a very fundamental question.
When one says data is stored in a table, I understand what row-store is, but are all values in a table stored in contiguous locations? If we are trying to join two tables, are the values in the two tables located in two separate contiguous locations and when we join them, they beco... |
Say I'm constantly given integers from the range $[1,2^{32}]$ in a random order and have to store these so that when a duplicate arrives I can deal with it. By the end of this algorithm all $2^{32}$ values will have been treated.
What's the best way to store which integers have been treated so far so that we can search... |
Let $L = \emptyset$ and $L' = \{a\}$ be two languages over an arbitrary non-empty alphabet $\Sigma$, $a \in \Sigma$.
$L$ can be reduced to $L'$: the reduction just transforms anything it is given into the word $aa$.
There is no way to reduce $L'$ to $L$: the answer would be always negative.
|
I'm trying to prove the correctness of this simple square root calculation algorithm using SPARK:
Y := X / 2.0;
while abs (X - Y ** 2) > Tol * X loop
Y := 0.5 * (Y + X / Y);
end loop;
return Y;
The preconditions are that both X and Tol are greater then zero and the postcondition is simply the opposite of the while... |
I have a problem in backpatching "if-else"
statements, for generating 3 address codes.
The grammar rule is :
S -》 if E then M1 S1 N else M2 S2
The semantic rules are : {
backpatch(E.truelist, M1.quad)
backpatch(E.falselist, M2.quad)
S.nextlist = merge(S1.nextlist, N.nextlist,
S2.nextlist)
}
Explanation :
M... |
As far as I know a 2-way set-associative cache works better than a one-way one considerably but going to 4 and 8-way caches leads to a marginal improvement. My question is: does increasing K (going more than 8) lead to better miss rate although marginal?
|
I came across this problem and am struggling to find a way to approach it. Any thoughts would be greatly appreciated!
Suppose we are given a matrix $\{-1, 0, 1\}^{n\ \times\ k} $, for example,
$$\begin{bmatrix}
1 & 0 & 1 & 0 & -1 \\
-1 & 0 & 0 & 0 & 1 \\
0 & 1 & 1 & 0 & -1 \\
-1 & -1 & 0 & 1 & 1 \\... |
I'm trying to implement the #2-SAT algorithm from the paper "Counting Satisfying Assignments in 2-SAT and 3-SAT" (Dahllöf, Jonsson and Wahlström, Theor. Comput. Sci. 332(1–3):265–291, 2005). A few lines into the algorithm description the authors denotes a sub algorithm and claims "The function $C_E$ computes #2-SAT by ... |
So i want to prove that if i choose a potential function for binary heap as any constant*size of the binary heap (n is the number of nodes) then my insert will not have O(logn) amortized cost and extract Max will not have O(1) amortized cost.Insert and extract max have O(logn) as worst time complexity for binary heaps.... |
A language $L$ belongs to $\mathbf{IP}$ if there exists $V,P$ such that for all $Q$, $w$,
$$w\in L\Rightarrow Pr[V\leftrightarrow P\text{ accepts }w]\geq2/3$$
$$w\notin L\Rightarrow Pr[V\leftrightarrow Q\text{ accepts }w]\leq1/3$$
I am trying to understand the claim that changing the $1/3$ to $0$ for the $w \notin L$ c... |
In chapter eight of "An Introduction to the Analysis of Algorithms" by Sedgewick (1996 edition) the coupon collector problem is introduced on page 425.
My confusion is how to identify the k-collections. A k-collection is defined as:
"to be a word that consists of k different letters with the last letter in the word bei... |
what is meant by support of a filter in context of image processing?
In the attached link of a short tutorial for detecting bar in an image by gabor filter,it is said that γ=1 helps in finding the support of the filter.
link1
|
I'm using kernel convolution in python to blur an image, but in addition to blurring it also turns the image darker. Could someone explain why it happens?
def convolve(pixel, kernel, i, j):
R = 0
G = 0
B = 0
if i<2 or j<2 or i>=height-2 or j>=width-2:
R = pixel[i][j][0]
G = pixel[i][j][1]
B = pixel[i][j][2]... |
Let $\Sigma = \{a, b\}$ an alphabet. Are the regular expressions $a^*a$ and $aa^*$ over $\Sigma$ equivalent? Even though concatenation is not commutative, in this case it seems like the statement is correct, but I am not sure.
|
At 30:42 of Norman Wildberger's Difficulties with real numbers as infinite decimals (II) lecture, he raises the question whether "certificates of boundedness" (of the runtime of the algorithm to compute a certain number of digits) should be part of a computable real number.
I thought the answer to that question would b... |
I have already shown that 3-colorable for an unrestricted graph is in NP, but I was thinking about the similar language defined as the set of all acyclic $G$, where $G$ such that $G$ is 3-colorable. In my proposition of an algorithm in P, I wasn't sure if my algorithm needs to verify that $G$ indeed contains no cycle o... |
I'm giving an array $A[0..n-1]$ and an integer $w$. The goal is to find indices $i,j$ that maximize
$$\Phi(i,j) = A[i] + A[i+1] + \dots + A[j-1],$$
subject to the requirements that $0 \le i \le j \le n$ and $j \le i+w$. Or, in other words, I want to find the sequential window of width at most $w$ such that the sum of... |
Description
Let us define a new problem with an instance $I = (G = (V, E), K, L)$, whereas:
$G$ is an undirected graph
$K \le |V|$
$L > 0$ is the maximum limit
Each vertex $v \in V$ has a weight $W(v)$
Each edge $e \in E$ has a length $W(e)$
Let $P(v)$ be a function that returns the minimum length of a path (basical... |
I have a target image $f(x,y)$ (where $x \in [0, 250]$ and $y \in [0,300]$), and a source image $g(x,y)$
I want to align $g$ to $f$ using the transformation :
$$\Psi(x,y;t_x, t_y, \theta) = \begin{pmatrix}\cos(\theta) & -\sin(\theta) & t_x \\
\sin(\theta) & \cos(\theta) & t_y\end{pmatrix}\begin{pmatrix}x \\ y \end{pma... |
According to this Quora post,
It refers to two things: A systems bottleneck, in that the bandwidth
between Central Processing Units and Random-Access Memory is much
lower than the speed at which a typical CPU can process data
internally. The 'intellectual bottleneck' in that programmers at the
time spent a lo... |
I'm new to complexity theory and am analyzing inclusions between complexity classes. Suppose we are given the following seven complexity classes
$DTIME(n)$
$DTIME(n^2)$
$DTIME(2^n)$
$DTIME(2^{2^n})$
$SPACE(\log^2n)$
$SPACE(n/\log n)$
$SPACE(n)$
We have that
$DTIME(n)\subseteq SPACE(n) \subseteq NSPACE(n) \subseteq DT... |
According to this paper written by Lamport, `selecting a unique leader is equivalent to solving the consensus problem'.
Based on the above quote, my question is: What is the difference between consensus and leader election problems?
My answer: I think that there is no theoretical difference between them. They are two ... |
I'm in an OS class now. I've been wrestling this problem for a while and can't convince myself of a solution. My professor is very busy and hasn't made time to help. Also, this question is from an example exam, not something I would be graded on.
In this question, we're given a virtual address to translate: 0xFEC. We'r... |
I have a set of compute tasks I want to schedule, these tasks have dependencies and a task may not be executed until all its dependencies are executed.
The problem can be represented as a directed acyclic graph:
The current scheduler ensures correctness, and capable of culling unneeded tasks such as k in the previous ... |
In an answer to a question regarding input validation in decision problems, @Apass Jack wrote
It is easy to check whether a problem instance is a valid instance or not for almost all decision problems people have been interested in. It is so easy and so common that people have become so sloppy or efficient that this v... |
I thought about finding a language with a polynomial verificator "larger" than $n^{555}$, but then I realized it would not imply the space needed for computation is the size of the verificator.
|
Wikipedia lists $O(M(n))$ as the best complexity (out of the algorithms listed) for division on two $n$-digit numbers, where $M(n)$ is the complexity of the multiplication algorithm of choice. This is the complexity of the Newton-Raphson division.
My question is this: what are some of the best known (wrt. running-time... |
The Bellman-Ford algorithm can be used to find a negative cycle in a general graph, in time $O(|V||E|)$. Is there a faster algorithm for finding a negative cycle in a bipartite directed graph, where the edges in one direction (from X to Y) are all positive and the edges in the other direction (from Y to X) are all nega... |
I'm proving the correctness of naive string matching using Hoare logic. I have the following pseudocode:
NaiveStringMatch(T,P)
<precondition: T is an array of n > 0 characters
P is an array of m > 0 characters>
for(s = 0 to T.length - P.length)
<invariant: forall 0 ... |
What is the term for the tree (or a part of the tree) of all possible paths in a graph that start from a given (source) vertex?
This is the tree that is implicitly or explicitly constructed when doing shortest path search. It appears, for example, in a lecture on search of an MIT Artificial Intelligence course, but I ... |
Beginner question: I am teaching myself the two passing techniques: Pass by Value and Pass by Reference.
Can Pass by Value change the states of an object? If yes, how? Which of the two techniques changes the states of an object?
Also, are Impure Functions based on Pass by Ref. and Pure Functions on Pass by Value?
I'd... |
I'm trying to figure out a way to implement this kind of a Turing machine that accept the following language:
$$\Sigma = \{ 0,1,2 \}, \quad\quad
L(A) = \{ abc \mid a=b \land c = a^R \}$$
I was thinking of a 3-tape Turing machine or using $\#$ symbol that separates the $a$, $b$ and $c$, but I'm struggling for the $c$ p... |
Referring to these notes regarding DFS - Click Here
They refer to the following claim that follows Definition 0.2. as observation:
A tree edge $uv$ with $u$ as $v$’s parent is a cut edge if and only if there are no edges in $v$’s subtree that goes to $u$ or higher.
However, I don't really understand why is that obvio... |
I am very confused as to which variables are captured by which λ in the example below:
(λa.λb.(λa.a)aba)(ab)
I am new to lambda calculus and the repetition of variables makes this example hard for me to understand and reduce. Any help would be appreciated!
|
Have a set of examples given to me, but I'm pretty sure they're all wrong. Can someone verify that my understanding of them is correct?
If set $Y$ can be solved in $O(2^n)$ and $Y \leq_p X$ then $X \not\in P$ is false
I think this means that since $Y$ is not polynomial time solvable, and it is reducible to $X$, then ... |
We see that there is a sign, exponent, and mantissa part for the notation. But, there is no location for the significant bit.
Why isn't it necessary to store an integer part of significant in IEEE754 floating point notation?
|
Finding the largest rectangular area possible in a given histogram is a well-known problem and have linear solution. I have a similar but different problem.
In my problem, we have $M$ rectangles instead of one rectangle in the previous problem.
So, my problem is to find the largest area under a histogram by $M$ recta... |
I'm looking for a formal and broad definition.
Intuitively, I would say that a problem where various checks have to be done is a search problem. Is this the only criteria? How can we know that a problem requires multiple checks?
Alternatively, I also think intuitively of problems with multiple paths as a search problem... |
Convert 0.625 to IEEE754 32-bit binary number.
0.625 x 2 = 1.250
0.250 x 2 = 0.500
0.500 x 2 = 1.000
So,
0.625 = 0.101
=> 0.625 = 1.01 x 2^(-1)
So,
S = 0
E = -1+127 = 126 => 01111110
M = 01 => 0100000 00000000 00000000
I am confused with the mantissa part.
Would it be
M = 01 => 0100000 00000000 00000000
O... |
I understand that it is possible to enumerate over all Turing Machines. My understanding of how this works is by fixing an encoding of natural numbers to TM descriptions, and then enumerating the natural numbers and checking whether each number describes a syntactically well-defined TM.
I am wondering how it is possibl... |
Is there any practical, efficient algorithm to check if a matrix over $\mathbf{F}_{p^n}$ is superregular?
It need not be theoretically polynomial, just roughly be implementable for $n=32$ and for matrices of approximate size $20 \times 100$.
Definition: A matrix is superregular if all its minors are non-singular.
In... |
Given: $N$ segments (arrays) of ordered integers, integers could be from $-K$ to $K$.
Example:
Segment 1: [-2,-1,0,1,2,3]
Segment 2: [1,2,3,4,5]
Segment 3: [-3,-2,-1,0,1]
You can represent them as [min, max]---it is equivalent:
Segment 1: [-2,3]
Segment 2: [1,5]
Segment 3: [-3,1]
How can I find an integer that belong... |
How would I tackle this equation?
$$10n^3 +3n = \Theta(n^3)$$
I know I have to solve Big $O$ and Big $\Omega$ but have no idea how to do this.
I got as far as
$$10n^3+3n \leq c_1n^3$$
$$0 \leq c_1n^3 \leq 10n^3+3n \leq c_2n^3$$
|
Let some problem $P$ is in $\textbf{DSPACE}(\log^2 n)$ and $Q$ is a problem in $\textbf{DSPACE}(\log n)$. I can claim that $P$ is polynomial time solvable as number of turing machine configurations for problem $Q$ is polynomial many.
Question : Can I say that $\textbf{DSPACE}(\log^2 n)$ is in polynomial time complexi... |
Prove by induction that if Quicksort with Explicit Stacking is modified so that the end-points of the larger sublist are stacked, and the other sublist is sorted first, then the maximum stack size is $O(\lg n)$.
This is because the smaller sublist has length $\le 1/2$ the length of the current list. But how can this be... |
I've been looking for the most unbiased algorithm to find out the feature importances in random forests if there are correlations among the input features.
Besides the most commonly preferred methodologies; gini-impurity reduction, drop-column importance and permutation importance, I found an algorithm called condition... |
I am reading Probability and Computing, by Mitzenmacher and Upfal, and the exercise 1.24 asks for a generalized algorithm for finding the cut-set of a Graph.
In this generalized version, instead of finding a set of edges that would break the graph into two components, it would break it in r components.
The approach use... |
I'm trying to implement a (Unweighted) Feedback Vertex Set approximation algorithm from the following paper: FVS-Approximation-Paper. One of the steps of the algorithm (described on page 4) is to compute a maximal 2-3 subgraph of the input graph.
To be precise, a 2-3 graph is one that has only vertices of degree either... |
Showing that the language $L$ with $\{1^n0^m |\space n \neq 2^m\}$ is not regular using Myhill-Nerode is easy: Let $i, j\in \mathbb{N}.i\neq j.$ It follows $1^{2^i}\nsim 1^{2^j}$ because $1^{2^i}0^{i}\notin L$ but $1^{2^j}0^{i}\in L$. Therefore $L$ has an infinite amount of Myhill-Nerode equivalence classes and is not... |
You are given a list of m constraints over n distinct variables x1, ..., xn. Each constraint is of one of the following two types.
An equality constraint of the form xi = xj for some i!=j.
An inequality constraint of the form xi!= xj for some i!=j.
I want to find an assignment, if it exists, for each variable such th... |
I'm curious about a potential relation between the following two languages.
$L_1 := \{\langle M_1, M_2 \rangle : L(M_1) \cap L(M_2) \ne \emptyset \}$.
$L_2 := \{\langle M_1, M_2 \rangle : L(M_1) \ne L(M_2) \}$.
Is it true that $L_2$ mapping reduces to $L_1$?
I've had many failed attempts to construct a reduction and... |
I am programming in C, so I do not want to implement a hash-based datastructure such as a hashset or hashmap/dictionary. However, I need to solve the following task in linear time.
Given two arrays $a$ and $b$ which contain the same set of distinct integers, determine for every element of $a$ the index of the same elem... |
If we had statements like: John is as tall as Mark, Mark is as tall as Sally, Chuck is as tall as Sally, Chuck is shorter than John.
Would there be a way to figure out that there is a contradiction in this set of statements using graphs?
My attempt at it was to symbolize each of the names, assuming they have different ... |
I'm reading Sipser's Introduction to the Theory of Computation (2nd ed.), and I am having trouble understanding one of the cases of Turing machine computation. Sipser describes the cases in terms of how one configuration yields another after a step of computation. For example, if the head is not at either end of the co... |
In Skillcorn, David B, "A Taxonomy for Computer Architectures", IEEE Computer, 21(11):46-57, Nov 1988, a taxonomy of multiprocessor architectures is described.
My teacher said that Skillikorn's Taxonomy allows us to design 30 different models, but only 7(9?) of them are reasonable.
What did he mean by that?
|
If $X$ is NP-complete and for some $Y, X\leq_p Y$ and $Y\leq_p X$ what can we say about $Y$?
My intuition says that this is only the case when $X=Y$ but I'm not sure how to justify this.
|
Minimum diameter spanning tree (MDST) problem is defined as following: given the connected weighted graph $G(V, E)$, weight function $w: E \rightarrow R, w(e) > 0\ \forall e \in E$, find the spanning tree $T(V, E')$ of $G$ such as maximal distance between vertices in $T$ is minimal.
I've done my research and haven't fo... |
I have a collection of news articles. I have performed tf-idf operations on them. I am using python as programming language so it was just the use of TF-IDF vectorizer function. I now have the document's tfidf representation. My aim is to cluster news articles using Particle swarm optimization.
As read in following re... |
Suppose I have a function with two input below.
$f(m,n) = \log {n^m} + 100n \log \log {m^5} + 150m + 4n^2 + 1000$.
Is it safe to say that $f(m,n)$ is $\mathcal{O}(m \log n)$, or is it $\mathcal{O}(n^2)$ instead? I think the first one is more representative as it includes the variable $m$. But that may not be the case i... |
I'm trying to learn about DSU, and I came across a point stating if two vertices belong to the same sub-set, then a cycle exists. In terms of implementation of DSU, I'm unable to make sense of this. Could you share a proof or explain this?
|
Consider the join: (σtitle=Overwatch Game)⨝ Event ⨝ rating ⨝ Player
What is the optimal join order?
Based on the schema on the following picture:
I am suppoused (and that's what I tried) to use Dynamic Programming to obtain the result.
Considering only Deep-Left-Join Trees, and use the expected size (in number of... |
One of my professors mentioned such algorithms exist but could not think of any offhand. Obviously any algorithm will be at least $\mathcal{O(1)}$, but are there algorithms not yet proven to have a lower bound greater than this, which do have a proven upper bound?
I'm interested in both problems and algorithms, but in ... |
I am working through a hard exercise in a textbook, and I just can't figure out how to proceed. Here is the problem. Suppose we have the language $L = \{a^ib^j: i \leq j \gamma, i\geq 0, j\geq 1\}$ where $\gamma$ is some irrational number. How would I prove that $L$ is not a context-free language?
In the case when $\ga... |
Consider a tiling of quadrilaterals in 2D that provide complete coverage of a particular region. N quadrilaterals are distributed across many parallel threads, typically in a way to keep groups of quadrilaterals together. In each quadrilateral we distribute np nodes, with some nodes located along the boundary of the ... |
We are looking into Fibonacci heaps in class at the moment, but I am stuck with this problem. Let $H$ be a mergable heap structure, by which is meant a data structure, where each element has a key, and that supports the following five operations (taken from CLRS):
MAKE-HEAP(): Creates and returns a new heap containing ... |
I heard that when one wants to write a program to make a crossword puzzle, he can use for example simulated annealing as in the thesis Crossword Construction using Constraint Satisfaction and Simulated Annealing
by Pavel Tomozov or random search as in http://raksy.dyndns.org/sqpack2.py. What is the difference of simul... |
I have a data set that is similar to this:
10,000 jobs with 200,000 applicants which are linked to a job.
I'm looking to cluster the shared jobs based on applicants that they share, am I reinventing the wheel looking to build this or is there a common solution?
Most of the example I found all require a "distance" but... |
I am trying to find longest common sequence for these two strings
SHINCHAN
NOHARAAA
The common sequence is NHA of length 3
But when I am trying to find out this through LCS matrix which I learnt from this link
https://en.wikipedia.org/wiki/Longest_common_subsequence_problem
Based on the explanation and this example g... |
According to https://link.springer.com/article/10.1007%2Fs001530050135 (Logics that define their own semantics, Imhof 1999) the logic FO[LFP] can define its own semantics, though the proof (of corollary 6.4) is somehow fuzzy. It is known from finite model theory that Datalog is equivalent to FO[LFP] (on ordered structu... |
After reading about it in the textbook and in the web, i was wondering about the "turing recognizable" concept.
so for instance, if i take a simple language like:"L = {< M > | M ACCEPTS < M >}", then it should be a turing recognizable language since there can be a turing machine that halts and accepts strings in it, an... |
I am aware topological sort and connected component algorithms are very related, but I have been looking for an algorithm to simultaneously compute both, rather than one after the other, and I am finding it surprisingly hard.
Assuming a directed acyclic graph, is it possible to simultaneously find the list of connected... |
In this recitation on MIT OCW, the instructor uses Stirling's approximation to calculate that
$\mathcal{O}({\log({n \choose \frac{n}{2}})}) = \mathcal{O}(n)$.
However, I went through the following steps to conclude that $\mathcal{O}({\log({n \choose \frac{n}{2}})}) = \mathcal{O}(\log{n})$. Where did I go wrong?
First, ... |
I'm self-studying, but I've gotten stuck already. If I'm given the logic table for a full-adder or any two-output table, how do I figure out the NAND-gate configuration, preferably methodically? Specifically, given the table:
x y z | 2^1 2^0
0 0 0 | 0 0
1 0 0 | 0 1
0 1 0 | 0 1
0 0 1 | 0 1
1 1 0 | 1 0
0 1... |
Given the following code.
public static int fc(int n, int p) {
if (p == 0) {
return 1;
} if (p % 2 == 0) {
int a = fc(n, p / 2);
return a * a;
} return n * fc(n, p - 1);
}
How to calculate the time complexity of this code in big-$\mathcal{O}$ notation? I already define the recurrenc... |
I was reading the Cormen, Leiserson, Rivest and Stein textbook, Introduction to Algorithms.
The book explained the three asymptotic notations literally very well.
However, there was this paragraph:
Technically, it is an abuse to say that the running time of insertion sort is $O(n^2)$,
since for a given $n$, the actu... |
I have a question about my solution to a problem from Hackerrank. The problem is, given $R,C,H,W$ with
$1\le R,C\le 100$,
$1\le H\le R$,
$1\le W\le C$,
an $R\times C$-matrix $L$ and an $H\times W$-matrix $S$, to find $i,j$ with $0\le i\le R-H$ and $0\le j\le C-W$ which minimize the sum $$\sum_{0\le k< H,0\le l< W}(L... |
The worst case height of AVL tree is $1.44 \log n$. How do we prove that?
I read somewhere about Fibonacci quicks but did not understand it.
|
int n;
cin >> n;
int sum = 0;
for (int i = 1; sum <= n; i++) {
sum += i;
}
If I assumed that $N = 100$, the loop will run $13$ steps, which is almost the square root of $N$, if $N = 10000$, the loop will run $141$ steps, which is almost the square root of $N$, but I don't know how to prove that, I only... |
I want to write a cfg for the following language:
$ L = {((ab)^n)^m }$ $m,n >= 0$
this language produces (abababababab) where: $n=2, m=3 \\ or \\ n=3, m=2$
I have no idea what to do with it!
|
Let's say Ω(g(n)) be a set representing the lower bound and O(g(n)) be another set representing the upper bound for some function f(n).
Can I say that θ(g(n)) is the intersection of these two sets?
The only reasoning I could give for it is that:
Ω(g(n)) is set of all the functions whose running time is at least cg(n) ... |
I thought the order of precedence of operators and quantifiers was arbitrary, but I don't really understand why those three have the same "strength" in relation to other operators (e.g., ¬ will have precedence over ∧, but not over ∀). This leads to the rule being that ¬, ∀ and ∃ will bind to the closest predicate on th... |
Suppose we are given a red-black tree with $n$ vertices with distinct keys and we want to store, as addition information in each vertex $v$, the biggest key out of the keys that are smaller than $v$ (or nothing if it doesn't exist). Can we insert a new element in this tree in $O(\log n)$ time?
I think that we can. My i... |
I have to manage shifts of a variable number of people inside several rooms for a week.
Every shift must be at least 1h long and the number of hours per person for the week should be nearly the same for everyone.
Every person could ask for specific shifts and this could be accepted if a suitable solution can be found.
... |
I got a task to create two functions one finds max $X$ and the other $Y$ in a polygon in $O(\log n)$.
The polygon is represented by an array of its vertices where each vertex is represented by its coordinates $(X,Y)$.
We also know that the first vertex in the array has the smallest $X$ coordinate and after that, all th... |
Heap supports insert operation in $O(\log n)$ time. And while heap supports remove min/max in $O(\log n)$ time, to remove any element (non min/max) heap takes $O(n)$ time.
However, red-black tree supports insert/remove both in $O(\log n)$ time. We can just remove the first/last element in a red-black tree to remove min... |
I am trying to have my Minimax AI chess players play against each other.
I was a bit confused about an implementation detail.
Let's call black my first minimax AI chess player that plays first.
white is the other minimax AI that goes second.
My question s about the turn. Should black maximize and white minimize OR shou... |
I've a typical parent ID based file system in database and files are physically stored on disks. What I want is to store files in blocks (4096K) of fixed size.
Chunking can be used I found, but how does a fixed size block storage file system may look like at high level in database?
Suppose I also want to update the sp... |
I am writing a computer vision related program and stuck on a problem. I have a system of quadratic equations
where M is a constant 3x3 matrix, is the 3x3 identity matrix, and we are solving for the 3x3 matrix R.
The first set of equations contains 6 independent equations which leaves us with 3 degrees of freedom of... |
I have this question I found regarding n-gram modelling in the textbook Speech and Language Processing:
Suppose we didn't use the end symbol </s>. Train an unsmoothed bigram grammar on the following corpus without using the end-symbol </s>.
<s> a b
<s> b b
<s> b a
<s> a a
Demonstrate that your bigram model does not ... |
Recap of the terms from the dictionary:
semantics: the study of meaning in a language (words, phrases, etc) and of language constructs in programming languages (basically any syntactically valid part of a program that generates an instruction or a sequence of instructions that perform a specific task when executed by ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.