instruction stringlengths 35 29.1k |
|---|
How to find the recurrence relation using domain range substitution method for the below:
$$
T(n) = 2T\left(\frac{n}{2} +1\right) + n -2
$$
I am unable to get a pattern with this relation as it is really confusing. I am guessing the below for $T(n/2 + 1)$:
$$
T\left(\frac{n}{2} +1\right) = 2T\left(\frac{n+2}{4}+1\right... |
This question is just for discussing algorithms please and not for proposing algorithms. I saw very similar post to mine, but still the answer explains definitions online for topological ordering.
Suppose we have a DAG (directed acyclic graph). Regarding the problem of finding shortest paths, Dijkstra's and Bellman-For... |
According to my evaluation ,the overall asymptotic running time of the below algorithm is O(n) ,since x (number of recursive calls) is 1, and y ( the number of splits) is 2 , and finally z ( the power of amount of work done outside of the recursion call) is 1, hence x<y^{d}, but my answer turned out to be wr... |
I was wondering if someone could please explain what the time complexity is for the code below.
I think it would be $O(n)$ because the algorithm will take as much time to execute as there are elements in $n$.
sample_list = [0, 1, 2, 3, 4, 5, 5, 6]
check_list = [] ... |
Hello my question is that if i have two for loops inside each other like this:
for(int i = 0 ; i < 100000; i++){
for(int j = 0; j < n ; j++){
\\-------------}
}
and another one like this:
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < n ; j++){
\\-------------}
}
where n can have any value ... |
I have the following implementation of Bubble sort where it calls a helper method named swap.
public static int[] bubbleSort(int[] array) {
boolean didSwap = true;
int j;
int unsortedUntilIndex = array.length - 1;
// i goes from 0 to array.length - 2
// j goes from 1 to ... |
I am confused as to why 2 threads waiting for a lock from each other will result in a deadlock. Let's say I have a Thread 1 that needs to execute contents in Lock 1 and then Lock 2 and a Thread 2 that needs to execute contents in Lock 2 and then Lock 1. Why does this situation result in a deadlock?
Once Thread 1 is don... |
This is not a difficult problem, but I would like please to discuss with you how I solved it:
Solving recurrence relation $T(n) = 5T(\frac{n}{3}) + 2n$, $T(1)=2$. What is the value of $T(9)$? This can be done directly by applying $T(9)$ to get 98. However, I did it recursively as follows:
$$
\begin{align}
T(n) = 5\left... |
On math.se, Sybren Zwetsloot has asked for help with an unusual optimal subtree problem. Here's my understanding of what he's asking:
We have a weighted bipartite graph on two sets $N$ and $B$, call them "nodes" and "buses", with $|N| \geq |B| + 1$. Furthermore (I believe), every bus $b \in B$ has degree $\geq 2$. We ... |
Given a $d$-dimensional vector $v = (v_1,\dots,v_d) \in \Bbb{R}^d$, we define $f(v) = \min_{i\in [d]} \{v_i\}$ to be the smallest coordinate of $v$.
Let $v^1,\dots,v^n \in \Bbb{R}^d_{\ge 0}$ be non-negative vectors (meaning $f(v^i) \ge 0$ for $i\in [n]$). I want to find non-negative $c_1,\dots,c_n \ge 0$ satisfying $c_... |
I have the below recurrence:
\begin{align}
T(n, 1) &= 3n \\
T(1, m) &= 3m \\
T(n, m) &= 3n + T(\tfrac{n}{3}, \tfrac{m}{3})
\end{align}
How to get a tight asymptotic bound for $T(n, n^2)$ assuming that $n$ is a power of 3?
Using the substitution method for $T(m,n)$, I get a very weird relation:
$$T(n,m) = 3n + \frac{m}{... |
If we have the following subgraph of a graph where I will just show 2 nodes please, where the capacity is 7 and 2 respectively:
Now, if we have received flow at node 1 of value 5, then we will have:
Problem: could you please explain why this will cause the capacity to be added to edge 2 and thus edge 2 will have now ... |
In the problem
find-all-anagrams-in-a-string,
one tries to find all anagrams of a string $p$ (of length $k$) in a
string $s$ (of length $n$) and return a list of the anagrams' starting
indices.
The solution is to use a sliding window of length $k$ and move that
window from the first index all the way up index $n - k + ... |
In a homework assignment, it's asked
For any alphabet $\Sigma$; for all languages $L$, $M$ on $\Sigma$
Prove that $\forall n>1$, $L^n=M^n\nRightarrow L=M$
The student and I tried in vain to make a proof for $n=2$ by exhibiting distinct $L$ and $M$ with $L^2=M^2$; so much that I now think the statement may be wrong. W... |
Context
I have an array of objects (or a list of dictionaries), sorted in order based on a property of each object, say, time. In JSON, it would look something like this:
[
{'details': 'some details', 'time': 69},
{'details': 'some details', 'time': 79},
{'details': 'some details', 'time': 107},
{'details': 's... |
Given two languages $L_1, L_2$ such that $L_1L_2\notin RE$,
is it always true that $L_2L_1 \notin RE$?
I wasn't able to prove it or find a valid counterexample.
|
I have some operations defined as SQL queries which takes data from various tables combines it with the data from a base table and generates new rows, which are written back to the base table. In the words, a set of operations which populates base table with new data based on existing data.
In the process of testing I ... |
In graph theory, a source of a directed graph $D = (V(D), E(D))$ is a vertex of it whose in-degree is zero.
The book CLRS makes these statements:
Given a graph $G = (V, E)$ and a distinguished source vertex $s$, breadth-first
search systematically explores the edges of $G$ to “discover” every vertex that is
reachable f... |
We just saw the Morris algorithm in class and we were asked the following:
In class, we saw a constant factor approximate randomized counting
algorithm with space complexity $O(\log \log n)$, where $n$ is the maximum
value of the counter. Prove that any deterministic algorithm that
provides a factor $1\pm\frac{1}{10}$... |
Here https://uk.wikipedia.org/wiki/RBFS and here https://www.eecs.yorku.ca/course_archive/2013-14/F/3401/slides/15b-RBFS.pdf it's said that
f[s] ← max(g(s)+h(s) , f[node] )
Why is it so? I can see a point in it, in a way that F-value is responsible for telling us what is the best accessible way along the path, and if... |
what algorithm would you use to solve this problem which I recently faced in an interview?
There's a council where people go to have meetings. A person comes at time x and needs to be in a meeting for duration y. The council has a set number of meeting rooms where 1 meeting room can only host one meeting/person. You ne... |
Consider a discrete memoryless channel $N$. We use a code to send messages over this channel.
Shannon showed that if we have a code $C$ with a finite number of codewords $|C|$ such that the average error is $\varepsilon$, then we can throw away half the codewords to obtain a code with $|C|/2$ codewords but now, the wor... |
I have a GPS dataset that corresponds to a route taken by a vehicle in a day. It consist of a set of coordinates. Then say I have a coordinate and I want to know how close this coordinate is to this route. So basically I am calculating the distance to each point on the route and get the minimum value. But I have to do ... |
This is a similar question to A variant of the house robber problem but instead of the general case, I'm wondering how you would solve the standard house robber problem, but when you cannot rob from houses on both the left and the right at the same time. The problem is modified from leetcode as follows:
"You are a pro... |
Could someone point me to a software/library which lets one to generate the Ising model/spin model for random $k$-sat problems or $k$-sat problem of a given structure?
I understand that it will be based on the following mapping from Chapter 3 of Saitta et. al. and the coefficients will be based on a quenched disordered... |
In this FFT algorithm (as per CLRS), in line number 4, shouldn't the angle be $-2\pi i/n$ and not $+2\pi i/n$?
The same algorithm is used in cp-algorithms as well, but in python, numpy.fft.fft uses $-2\pi i/n$ as the angle. Can someone explain which algorithm is correct and which is wrong?
|
I have an alphabet $\Sigma = \{a,b,\#\}$. I'm trying to write a regex that only accepts strings that have the same pattern before and after the $\#$ without using back references. For example, $aab\#aab$ is accepted, but not $aba\#aab$. How in the world do you handle this? I thought you could maybe do something like $(... |
I have two processors (two different physical processors) with base frequencies 3.2 Ghz and 4.0 Ghz.
I want to ask if there exist a method which I can use to the 3.2 Ghz processor for ML acceleration ?
I don't have a good gpu for this task.
Will it be slower than a GPU ?
|
I have come across the description of a function $F: \mathbb{N} \to \mathbb{N}$ where the function is defined one way for $n \in \mathcal{H}$ and another way for $n \notin \mathcal{H}.$ In this notation $\mathcal{H}$ is meant to denote the halting problem.
However, I am not sure what it means for an integer to be a mem... |
Consider the following algorithm: The given items are inserted one by one into a list by performing comparisons like a binary search for the right position.
Example: Imagine six elements are already sorted in descending order. We now compare the next element to one of the middle elements. Assume it's smaller than #3 (... |
$a^n$ is a regular expression.
$b^n$ is a regular expression.
their concatenation is $a^nb^n$ which is not a regular expression.
|
It is widely known that the emptiness of counter automata is undecidable since two counters are enough to simulate a Turing machine (see the classic book from Hopcroft and Ullman, for example).
However, what happens if we put a bound $k$ on the values stored by the counters? In this restricted model, the counters canno... |
My intuition is that you can't call a function that has not yet been defined, although I have yet to find a source confirming this.
Is this true?
Thanks, friends :)
|
It is well known that the subgraph isomorphism problem is NP-complete. And so a polynomial-time algorithm for solving it would mean P = NP. Thus I'm interested in whether a bounded version of the problem has a polynomial time algorithm that is known about. Many applications of graphs don't require more than say 50 ... |
A Graph is Eulerian iff $\exists$ an Eulerian Cycle or all the vertices of Graph have even degree.
What is an Euler graph?
Wiki has a definition for the Eulerian graph but not for the Euler graph.
|
Let's say I have a country with a set of cities, which I represent on the network graph below as a set of nodes. Furthermore, the weighed edge between pairs of nodes, represent the distance by road between them. I'll define the capital city as node A. There is no direct route between A and C so there is no edge between... |
I'm trying to determine an asymptotic bound on the cardinality of the following set of functions. It is the functions with $n$-bit inputs, $\{0,1\}$ output, and requires precisely $n^2$ NAND gates. I'm trying to show that this is $2^{o(n^3)}$.
I've thought about just counting all functions but that's too big, $2^{2^n}$... |
In a project I am working on, we are looking at multiple different (optimal with respect to some cost measure) triangulations of a fixed pointset $S$. I would like to cluster similar triangulations.
My first Idea was something like the edge flip distance, i.e. the minimal number of edge-flips in a quadrilateral needed ... |
I'm still very early in understanding some computer science basics. I find it easiest to learn things when I have some oversight of what I can expect. Is there any trend to the number of logical gates that processors have, from 1-bit to 2-bit, 4-bit, 8-bit, 16-bit, 32-bit, 64-bit. This processor, https://en.wikipedia.o... |
I'm trying to solve the following problem: https://cses.fi/problemset/task/1084/
My first idea to solve this was to sort the applicants and apartments in increasing order. Then, I iterate through all the applicants and for each one, pair it up with the smallest apartment that would satisfy them (if it exists). This gre... |
Kolmogorov complexity of a string is the length of the shortest algorithm that generates it. Here I'm focusing instead on randomly distributed strings $x$, with length $n$, with a probability distribution $P(x)$. What is the shortest algorithm, with access to a random number generator, that is able to generate a random... |
I have points in a 3d world where their position is defined by 3 integers: X, Y, Z.
I'm searching for an algorithm / data structure to store these points in a way I can quickly find (e.g.: O(log(N)) the neighbour points in any direction aligned with the world axis (X-/left, X+/right, Y-/bottom, Y+/top, Z-/front, Z+/ba... |
This is the variant of SSP: Given $n$ positive integer points $a_1, \ldots, a_n$ which are all at most $n$, does there exist a subset $\{a_i\}_{i \in P}$, such that its summation is exactly $n+1$?
My question is, for general $n$, is this problem NP-hard?
|
Even though the input I type is a "Y" or "N" string, I can't break out if this while loop. Can anyone tell me why?
public String yesOrNo(String message) {
String yesOrNo;
do {
System.out.print(message);
yesOrNo = input.next();
} while(yesOrNo != "N" || yesOrNo != "Y");
return yesO... |
I'm learning the basics of computers, and now trying to get some oversight of complexity of a CPU. Is there a rough trend for how transistors are allocated in a CPU? Intel 8008 for example, has 3500 transistors. In this image of it, I can see the space each component occupies. The ALU as example, each ALU slice is 20 t... |
The following question is from MIT-OCW 6.006, Spring-2008, Problem-Set 2, Q-3.c.
Suppose you have a hash table where the load-factor $\alpha$ is related to the number $n$ of elements in the table by the following formula:
$$
\alpha = 1 − \frac{1}{\log n}
$$
If you resolve collisions by chaining, what is the expected ... |
I have typically heard computer performance discussed in terms of FLOPS.
However, I have recently seen multiple references instead using OPS i.e. operations per second, typically in the context of Big Data.
What is the difference between FLOPS and OPS? Why use one over the other?
I appreciate that they are both metrics... |
Proove that for every infinite $L \in R$ there is a $L' \subseteq L$ s.t $L' \notin RE$.
How can I proove it? if sketched on venn diagram it doesn't make sense...
From my point of view everything that is in R suppose to be in Re. $x \in A $ and $A \subseteq B$ then $x \in B$. Why does it fail? and how am I suppose to... |
I know this is an amateur question but is it true to say that for any three nonempty languages $L_{1},L_{2},L_{3}$ over an alphabet $\Sigma$ we have $L_{1}(L_{2} \cap L_{3}) = L_{1}L_{2} \cap L_{1}L_{3}$ if and only if $L_{2} \subseteq L_{3}$ or $L_{3} \subseteq L_{2}$? Some theorems in mathematics lead me ask this. If... |
If we have all these optimized programs for very specific tasks, what would be the antithesis of them?
I've asked a programmer friend of mine, and they thought a good answer had to do with multi-dimensional arrays and nested for-loops in graphics programming. I just want to see what other answers there are.
Essentially... |
For the following recurrence relation:
$$T (n) = T (n/2) + n(2 - \cos n)$$
I see it based on values of $\cos$ function given that it output values in range, but this does not seem to have anything to do with solving the problem. I found a solution which says that comparing this to master method yields that this does no... |
I am studying Computer Architecture with MIPS-32. The example system has 32 registers with each register having a width of 32 bit.
If I would want 128 registers instead of 32 registers, would I have to increase the width of each register to 128 bit as well?
Or do I just need 64 bits, which is enough to address the new ... |
Is it possible to write a program that is able to recognize some source code as being its own source-code?
Biological organisms evolved the ability of kin-recognition, and later, self-recognition, early on. This led to the evolution of the immune system.
Of course the immune system does not go through the DNA of a pote... |
I understand this should be a relatively easy proof, but I can't seem to understand how to do it.
I know that, by Big O definition:
there exists some value $c_1$ where $f(n) \le c_1 \cdot h(n)$ for all $n \ge n_0'$
there exists some value $c_2$ where $g(n) \le c_2 \cdot h(n)$ for all $n >= n_0''$
and I have to find s... |
Let's consider this CFG-
S->AB [Here, **S** is the starting variable]
A->C
CB->Cb
C->a
Now, the question is- Check if ab is a valid string for the given string or not?
I thought an answer. And that is-
S->AB
->CB [A->C]
->Cb [CB->Cb]
->ab [C->a]
My question is, Can we generate string ab from this CFG in this way?... |
My question is about the paper Ensembling Ten Math Information Retrieval Systems.
I am interested in the task of finding answers.
Which of the ten system are able to answer questions using only dot products?
(I think CompuBERT is one of them, look)
|
I am reading the paper Space-Efficient Online Computation of Quantile Summaries and get really stuck trying to understand Lemma 3 onwards.
I am sorry it sounds like a lot of questions - this just outline my confusion throughout the proof - you don't have to answer these, an explanation of how the proof actually work wo... |
This question is about CompuBERT (new implementation).
I have read textual data have high dimensionality so I would like to know the behaviour of CompuBERT which uses a dot product for question answering.
If I increase the embedding dimension will CompuBERT suffer from the curse of dimensionality?
(I googled for the sa... |
Polynomials are usually written as a sum of powers (or various products of generators) and Google gives me lots of results on how to get from that to the form that is a product of degree-$1$ polynomials (where you can see where the polynomial vanishes), e.g.,
$$ x^2 - 1 = (x + 1) (x - 1) $$
I am looking for the other d... |
I was studying CRC and came across modulo 2 arithmetic. When we add two 1 bit numbers like 1 + 1, 0 + 1, then the result is summation modulo 2 which is similar to XORing of the two bits. My doubt is when this is extended to multiple bits why is the solution not summation modulo 2 i.e. one bit result either 0 or 1, inst... |
I want to implement an Index using a B+Tree as the underlying data structure. The index will have to support key sizes which are of order of my block size, what means I cannot save all the key as a pivot in the B+Tree inner nodes, since the branching factor would be too small which results in too many IOS for any read/... |
Based on the answer by Will Ness, I've been using a JavaScript adaptation for the postponed sieve algorithm:
function * primes() {
yield 2;
yield 3;
yield 5;
yield 7;
const sieve = new Map();
const ps = primes();
ps.next() && ps.next();
for (let p = 3, i = 9; true; i += 2) {
let ... |
This is from question 3(a) from http://www.cs.cmu.edu/afs/cs/academic/class/15210-s14/www/exams/exam2-practice-sol.pdf, which is: consider an undirected graph $G$ with unique positive weights. Suppose it has a minimum spanning tree $T$ . If we square all the edge weights and compute the MST again,
do we still get the s... |
Suppose I have a list that reflects the priority of web pages for recrawling:
l1 = [3, 2, 1, 4, 2, 5]
Now, I have tried to estimate the priorities with two different approaches and have obtained two lists:
l2 = [4, 2, 4, 3, 2, 1]
l3 = [1, 3, 5, 2, 4, 6]
I can use the Spearman correlation or C-Index to know which of l... |
My question is about the paper Ensembling Ten Math Information Retrieval Systems.
I already know the algorithms in the paper can answer questions only using dot products (look the post).
How can I optimize them?
Could you add here (and in the next paper you will produce) the complexities of time preprocessing, memory a... |
We say $x$ is a majority substring of $y$ if $y \in \Sigma^* x \Sigma^*$ and $|x| \geq \frac 12|y|$. If $B$ is a regular language, is the set of majority substrings of $B$ regular?
I was provided the following solution, but I don't understand it:
Let M be a DFA that recognizes B. Construct an NFA $N$ that accepts its ... |
The recursion is:
T(n) = 5T(n/2) + O(n)
I solved for the time complexity using Master theorem and found Θ(n^2). but, the question has asked to find the upper bound in terms of Big Oh. Is there any principle to convert it into Big Oh form? I read some examples where they substituted some values and deduced but I couldn... |
I am trying to understand how a router's forward table works. As such, I am working
on the following problem.
Problem:
A router’s forwarding table has the following entries.
\begin{array} {|r|r|}\hline Network \, Number & Next \, Hop \\
\hline 0.0.0.0/0 & 15.15.1.2 \\
\hline 192.140.20.0/24 & 15.15.1.8 \\
\hline 1... |
I am having a hard time wrapping my head around the time-varying edge cost of this question :
Suppose we have a connected graph $G = (V, E)$. Each edge e now has a time-varying edge cost given by a function $f_e$. Thus, at time t, it has cost
$f_e(t)$. We’ll assume that all these functions are positive over their enti... |
I have two recursive algorithms to solve a particular problem. I have calculated their time complexities as $O(n^2\times\log n)$ and $O(n^{2.32})$. I need to find which algorithm is better in terms of time complexity. I tried plotting graphs but two functions seem to be going together.
|
I am learning algorithm complexities. So far it has been an interesting ride. There is so much going behind the scenes that I need to understand. I find it difficult to understand complexity in recursive function.
my_func takes an array parameter A of length $n$. Runtime of some_func() is constant.
def my_func(A):
i... |
If so, I don't understand how, as a large part of back propogation is knowing what the 'real' answer is in comparison to 'predicted' answer. With 1 neuron in a hidden layer, we do not know the 'real answer' so theoretically it is impossible unless another technique is employed?
|
Given an array unsorted P of integers and a number m. I am trying to write a code that returns indices i, and j to satisfy 8P[i] + 7P[j] = M with time O(n log n).
I iterated over P[0] to P[n-1] and searched for P[j] = (M - 8P[i])/7 using binary search. Here, I can get the values of P[i] and P[j], but the original index... |
Consider there's an 5 elements list that foreach element are 2-bits. Forexample [01,00,10,00,11], if the list is sorted, we hope the output like this [00,00,01,10,11]
Maybe that case seems complicated, let's move to simple case.
Consider there's an 2 elements list that foreach element are 1-bit. Forexample [1,0], if th... |
Suppose there are 10 (4x4) matrices, where the elements in each matrix are dependent on one variable ($\theta$) non-linearly. All the matrices are independent of each other, so there are 10 $\theta$s ($\theta _{1}$, $\theta _{2}$, $\theta _{3}$, $\theta _{4}$,......). Now, let the input matrix be A, and an output matr... |
An array has elements from set {0, 1, 2}. A span SP of an array is any interval [start S, end E] such that the sub array must contain all elements from {0,1,2}.
For example: in Array A = (0,1,0,1,1,2,0,1) we can say SP=[1,6] and SP=[5,8] but [1,5] is not a span as elements in array from index 1 to index 5 (0,1,0,1,1) d... |
"A theory of type polymorphism in programming" introduced the Hindly-Milner type system whose punchline can be summarized "well-typed terms don’t get stuck". They do this by creating a relatively simple language with just enough features that an untyped stuck expression is possible. For instance, true false is stuck ... |
Let $G$ be a directed graph such that every edge is colored (red, yellow or green). I want to compute the shortest walk (possibly with repeated vertices) with the restriction that the colors are alternating: red, green, yellow, red, green , ..., etc (the starting color doesn't matter).
So far my idea is to create a new... |
This question is about the article Sub-Linear Memory How to Make Performers SLiM.
I googled for the fastest transformer and I think almost surely I found. It is called SLiM.
The problem is the authors use only GPUs and I don't understand much about GPUs.
I don't even know whether there are algorithms that run only on G... |
In Haskell, we can use the following code to define fibonacci numbers,
fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
And its time complexity is linear.
I cannot find a way to do it in lambda calculus or combinatory logic.
With Y combinator, it leads to exponential steps to evaluate.
Is it possible in lambda calculus? Is... |
I am trying to implement stacking orders
While the most optimal solution would be to consider picking up orders from nearby restaurants that have similar food prep time AND nearby delivery locations.
I'd like to start off with something slightly easier - that is stacking orders only from the SAME restaurants that have ... |
Let be:
Uppercase letters — non-terminal symbols.
Lowercase letters — terminal symbols.
Possible cases:
The number of words is 0 (infinite substitutions). Examples: $$\{S \rightarrow aS\}, \\ \{S \rightarrow aF, F \rightarrow aS \}, \\ \{S \rightarrow aA, S \rightarrow A, A \rightarrow FS, F \rightarrow t\}$$
The nu... |
I am working on chapter one of the textbook Computational Complexity: a modern approach by Arora, S., & Barak, B. They begin by defining a turing machine (TM) and then prove equivalence between variations of TMs. They make the following claim.
Claim 1.6 Define a single-tape Turing machine to be a TM that has only one re... |
Let's have a relation $R = (name, surname, age)$. I want to obtain a new relation with only the $name$ attribute. In relational algebra I would simply do $\Pi_{\mathrm{name}}(R)$ but in relational calculus the general way of doing that is
$$
\newcommand{\Set}[2]{%
\{\, #1 \mid #2 \, \}%
}
\Set{t}{\exists z \; (R(z) \... |
I keep reading that while bottom-up parsing of a left-recursive grammar can be done in constant O(1) stack space, for a right-recursive grammar, we have to push the entire input stream onto the stack before popping any of them off. Why is this?
Let's say that I consider a simple right-recursive grammar
List -> elt List... |
This question is about de paper Extending Multi-Sense Word Embedding to Phrases and Sentences
for Unsupervised Semantic Applications.
I am interested in the transformer part of the paper and the main structures of the algorithm is represented in the following image:
Before the main questions I have other questions whi... |
When I was reviewing a book, I saw that there's a sentence claiming "side effect is a term coming from the domain of functional programming". I would think that the concept existed before the invention of the functional programming paradigm, but the author is asking for a citation that I was not able to find. Does the ... |
$ \newcommand{\Set}[2]{%
\{\, #1 \mid #2 \, \}%
}$
I've been trying to find how to express relational division operation in tuple relational calculus. The only thing I found is this presentation where on the page 4 it is said that for relations $R = (A, B)$ and $S = (B)$ the division is
$$
R \div S \equiv \Set{t}{\ex... |
Consider the language
$$ L = \{2^k : k \text{ is prime}\}. $$
This language contains, for example, $2^3=222$, $2^5=22222$, $2^7=2222222$, and so on.
I know that $L$ is irregular and so there must exist a set of strings that are pairwise distinguishable with respect to $L$, but I'm struggling to come up with such a set ... |
I am learning computer network, and confused by the queuing delay. In my textbook, it says that when La/R approaches 1, and with random inter-arrival times, then the average queuing delay is closer to infite. Here, R
is the transmission rate, a is in units of packets/sec and all packets have L bits data.
In my view, if... |
Given two recurrences:
$T(n) = 2 T(n/2) + n \lg \lg n$
$T(n) = 4 T(n/2) + n \lg \lg n$
I'd think that both works for master theorem, but the solution is that the first one cannot use masters theorem while the second one works with masters theorem. The only difference here is the $a$ value (2 vs 4).
|
I have written a yacc program for generating palindromic strings consisting of 0s and 1s. Here is the rules section of the yacc program below:
%%
program: expr NL { printf("Valid string.\n"); exit(0); }
;
expr: ZERO expr ZERO
| ONE expr ONE
| ZERO
| ONE
|
;
%%
Here ZERO is the token representing 0, ONE is the token ... |
Let $W$ be an array of weights. Store all the weights of $W$ in bins such that in each bin a heavier weight always go before a lighter weight (if $w_i\in W$ is stored before $w_j\in W$ then necessarily $w_i > w_j$), and the original order of the weights in $W$ is preserved ($w_i \in W$ cannot be stored before $w_j \in ... |
I am trying to solve the following problem:
If all of the jobs listed below are scheduled FCFS (First Come, First Serve) with no switching overhead, the average turnaround time is going to be:
Arrival Duration
0 10
1 9
2 8
3 7
4 6
My calculation is: (10 + (10 + 9) + (10 + 9 + 8) + (10 + 9... |
I am currently trying to implement a algorithm for the game "Eternal Return: Black Survival" as a kind of exercise in Rust.
Since the game may not be familiar to many, here is a quick explenation so you can understand what I want to achieve.
Eternal Return is a Multiplayer Online Battle Arena (or MOBA) with battle roya... |
So first, just to make sure that I understand the proof, here is the proof as I understand it:
Take a program $H(x,y)$, which determines whether $x(y)$ will halt or not halt: if $x(y)$ halts then $H$ returns true, and otherwise it returns false.
If $H$ exists, we can construct a new program $H'$ which has one input $x$... |
In the Modern Operating System by Andrew Tanenbaum, Herbert Bos the authors provide their explanation of the concept of CPU utilization in the following way:
A better model is to look at CPU usage from a probabilistic viewpoint.
Suppose that a process spends a fraction $p$ of its time waiting for
I/O to complete. With... |
Is there any free/open-source environment, tasks, or dataset for evaluating deep RL algorithms in terms of safety?
all available environments (like openAI's) are environments for simple games. These can be useful in evaluating the algorithms in terms of sample efficiency, variance and speed of training. However, How c... |
I am trying to solve the recurrence $$T(n) = T(n-1) + (-1)^nn, \quad T(0) = 1.$$
I'm stuck in the summation:
\begin{align}
T(n) &= T(n-1) + (-1)^n n \\ &=
T(n-2) + (-1)^{n-1}(n-1) + (-1)^nn \\ &=
T(n-3) + (-1)^{n-2}(n-2) + (-1)^{n-1}(n-1) + (-1)^nn \\ &= \\ &\cdots \\ &=
T(n-k) + (-1)^{n-(k-1)} (n-(k-1)) + (-1)^{(n-(k-... |
I am required to show that the class of singletons $H_{sing}$ is learnable in the realizable case (without invoking the VC-dimension).
$H_{sing}$ is defined as
$H_{sing} := \{h \in \{0, 1\}^X : |\{x \in X : h(x) = 1\}| \le 1\}$
Also I need to prove if this class also learnable if $X = R$?
Can someone please help ?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.