instruction stringlengths 35 29.1k |
|---|
Let $X=R^3$.
Let $C=H=\{h(a,b,c)=\{(x,y,z) |x|\leq a,|y|\leq b, |z|\leq c\}, a,b,c\in R_+\}$ the set of all origin centered boxes.
Describe a polynomial sample complexity algorithm that learns $C$ using $H$.
Can you please explain what does it mean to describe an algorithm that learns $C$ using $H$?
What is the differe... |
Sorry for bumping this very old problem which already has answers on multiple SE sites, but I just cannot understand any of the answers.
Let $\Sigma_{bool} = \{0, 1\}$.
Then, $(\Sigma_{bool})^*$ is the set of all binary strings, as far as I know. I've seen many posts claiming this set is uncountable. But how is that po... |
The Dijkstra's algorithm is never used for a graph with a negative weight.
The following graph has negative weight but when the Dijkstra's single source shortest path algorithm run from vertex a, it computes the correct shortest path distance to all the vertices.
But when I solve it for the following graph:
I am not ... |
Let's say I have a bunch of lists of real numbers which we'll call a, b, c, etc. Moreover, let's say all of these vectors are correlated, in the sense that a[1] < a[2] implies that there's a better-than-even chance that b[1] < b[2]. I want to sort each one of these lists individually, returning a', b',... with the same... |
Consider the standard $k$-center problem i.e find $k$ disks of radius $r$ that cover all points in a point set $P$. This problem has a well known greedy 2-approximation algorithm where you (essentially) choose points from $P$ as the centers of each of the $k$ disks and each time you pick a point you pick the one that m... |
Let's say, if you could travel to the past, what would you teach your younger self? Which key points define efficient algorithms?
|
Can D simulated by H terminate normally?
The x86utm operating system based on an open source x86 emulator. This system enables one C function to execute another C function in debug step mode. When H simulates D it creates a separate process context for D with its own memory, stack and virtual registers. H is able to si... |
I found an implementation of suffix arrays here (not sure if it's the most efficient so if there's any better I'd be glad to know).
For a given string:
data = '1034408'*10
It generates the following suffix array:
suffix_array = [64, 57, 50, 43, 36, 29, 22, 15, 8, 1, 68, 61, 54, 47, 40, 33, 26, 19, 12, 5, 63, 56, 49, 4... |
I need to come up with an algorithm that finds differences in the sequence of each product's routing (or sequence of processes).
There are several processes aligned together and each process's been operated under specified equipment.
For example,
if there are four processes(A - B - C - D) until the final product and in... |
I was reading the paper on SMA*+, which is very interesting as it implements most improvements I thought of when reading the paper on SMA*. But I have 3 questions that I think are related to my misunderstanding of the cost evaluation of the re-generated nodes.
Can there be some memory saved by not fully expanding a nod... |
In the report "Shared Memory Consistency Models: A Tutorial" (https://www.hpl.hp.com/techreports/Compaq-DEC/WRL-95-7.pdf), the authors explain the difference between IBM370, Total Store Ordering, and Processor Consistency via Figure 10 (shown below).
I do not understand why the results for (a) are not possible with IBM... |
Let's say I have a struct Product with an unknown and variable amount of attributes-values. The attributes-values come from a user at runtime. One product with a unique combination of attributes and values form a product_variant.
For intance, user may create 4 attributes:
size (5 values)
material (3 values)
design (2 ... |
The paper on SMA*+ proposes a very interesting idea of having a culling heuristic different from the full path cost estimation (so called $f$-cost).
In the benchmark they use a culling heuristic equal to the $f$-cost: $c(n) = f(n)$. And I actually can't think of a valid reason to do otherwise. Ever. Are there really ca... |
There are 25 lights $\{l_1, l_2, \dots , l_{25}\}$ in off mode. On Day 1, every light is on. On the Day 2, every 2nd light. i.e, $l_2, l_4, \dots , l_{24}$, are off. On the 3rd day, every
3rd, i.e., $l_3, l_6, \dots , l_{18}$, are toggled (switched on if it is off/switched off if it is on). This process continues for ... |
Informally, we want to partition the edges of a graph into a few cliques. Given $G=(V, E)$, we want to find subsets $V_1,\dots, V_k\subset V$ such that $E = E[V_1]\dot\cup \dots \dot\cup E[V_k]$, where induced subgraphs are complete $E[V_i]=\binom{|V_i|}{2}$, and we want to maximize $\sum_i \binom{|V_i|}{2}$.
Is there ... |
What's the difference between a protocol and a distributed algorithm? My internship supervisor told me they are not exactly alike.
A protocol is more communication-oriented (e.g. TCP), whereas a distributed algorithm allows more complex interactions (e.g. a cryptocurrency system).
However, I still can't fully grasp thi... |
So would it be correct to say that the number of comparisons from level 1 to level 2 would be $2(n/2-1)$?
Or would it be more correct to say that the number of comparisons is $2^i(n/2^i-1)$?
|
I'm facing a task similar to what filesystems do. I have a bunch of continuous allocated space and I need to place pieces of variable length data into it, each piece of data can change size over time.
Now I could just place the pieces one after another as they come, then when they grow too big to fit I'd fragment the ... |
Say I have a for loop like this
for(int i=1;i<n;i=i*2)
{
for(int j=1;j<i;j=j*2)
{
cout<<"hello";
}
}
What is the time complexity of this loop?
I have approached this problem like this. The outer loop runs log(n) times and the inner loop runs log(i) times, so in total the complexity becomes $O(log(... |
I have a tree on $n$ vertices. Your goal is to find the adjacency list for it.
$n$ is known to you from the start. You can pick a vertex and ask for the lengths of the shortests paths from it to the other $n-1$ vertices (i.e. you input an integer $1\leq i \leq n$ and get $n-1$ integers $1\leq d \leq n-1$). The lengths ... |
So I want to prove that $$ \big\{\langle M \rangle : \text{ M is a TM and } L(M) \text{ is decidable} \big\}$$ is undecidable.
To do so I want to reduce it from$\ \overline{A_{TM}}$ with a function which looks like this :
On input $\langle M,w \rangle$ run $M$ on $w$, if $M$ accepts $w$ output $M'$ where $M'$ should be... |
When you perform a write on a multi-cpu system, relevant cache flushes are done to ensure that the other cpus see the change immediately.
BUT
That write was issued from an independent thread on a preempting operating system, so there never was any expectation that it would arrive at any particular time. All that cache... |
Assuming we have two trains that start in one source edge. I want to find an algorithm that finds two paths for these trains so that they won't meet in an edge at any given time. So we have the train ride T=$ \left(\left(v_{i-1}, v_{i}, t_{i}\right)\right)_{i=1}^{k}$, starting in v_0 to v_k and t_k as the arrival time.... |
I want to solve this problem using Many-One-Reduction, which involves, if I understood it correctly, reducing another problem on the problem stated in the title, i.e.
$$
H \leq_M L
$$
I would try reducing the Halting problem $H$ onto $L$, because we know that $H$ is not decideable. Would this be the correct approach? I... |
Let's say we have a b tree of order 4 and it has 3 levels. All nodes are completely filled. Now if we want to insert a key with maximum value ( than all keys present in the tree). For this, we have to go to the rightmost node at the last level. As this last level is also filled, now how can we proceed further as all th... |
I wish to approximate a sequence of rational numbers using a linear recurrence of order $k$ for some small $k$ (preferably as small as possible). The Berlekamp-Massey algorithm solves the exact version of this problem, finding the optimal such $k$, and even the coefficients of the linear recurrence generating the seque... |
⌊1/⌋ - represents the floor function Does the floor or ceiling function affect the complexity under which a function falls?
⌊1/⌋∈Θ(1/) or to Ω(log)
Found this interesting question in a Cornell paper
Thanks
|
I am working with a toy programming language for my thesis. It is lazy evaluating so I can have infinite terms (for example the "infinite natural number" inf := S(inf)).
There is a proof assistant build into my language so I want to write down denotational semantics for it.
Now I want to describe a Herbrand universe f... |
The following is the solution to an exercise in the book CLRS.
The question: Give a linear-time algorithm that given a graph G and an integer b, determines whether the value of the bottleneck spanning tree is at most b.
The algorithm:
To do this, we first process the entire graph, and remove any edges that have weight ... |
I am trying to verify whether it exists a path from $a \in A$ to $b \in B$ whose length is $\ge k$ in $\Theta(G)$.
This is what I have done:
Algo(G,A,b,K)
Init(G) // colour[v] = WHITE for all v in G.V
for each a in A do
if colour[a] = WHITE then
dist = BFS(G,a)
for each b in B do
if colour[b] = BLACK then
... |
Alghorithm : Quick sort .
idea : devide and conqure .
steps :
1- find the pivot point from array like first element .
2- partiotioning the array so that elements are smaller than pivot point are in the left side and ones are bigger in the right side .
3- sorting both sub arrays (recursion)
Question : i know all of the... |
This is an issue I encountered on several applications with different variants. But here is the common base for which I suspect to miss a more efficient approach.
There are $K$ different tasks to schedule on something (a product, some data, whatever...). Any order of actions is acceptable, but the cost (in time for exe... |
Concerning modern computers communicating with each other it is my understanding that computers are reading patterns in current flow and interpreting those patterns of current flow as ours 1's and 0's.I make the following assumptions here.Whether hard wired or wireless the communications start and end their journey as ... |
Prove or Disprove: There is $\boldsymbol{no}$ alphabet $\Sigma$ and closed formula (no free variables) $\varphi$ above $\Sigma$,
such that for any Model $M$ it holds that
$M\models\varphi\iff\,|D^M|=\infty$.
I'm not sure what is the classic way to approach this. I do think that the statement is correct. I tried the n... |
If so, for any OS more than 10gb, how does it run on a computer with limited ram like 4gb? If not, which part of OS is copied to the ram? Or is it dynamically loaded whenever certain part is needed?
|
Recently, I started to think of a problem involving the use of Twitter data that would involve finding pairs of users that participate in the most conversations. For example, with each tweet, you get the root conversation id along with a user id for that specific tweet. What I want to do is find pairs of users that par... |
My understanding is that in a programming language, built-ins are bindings that exist without the user having to make them. (Like + to its referent, for example.)
My understanding of a constant literal is that it is a variable whose name encodes its value. (Like 3, or {"Name": "Steve", "age": 47} in JS.
Is a constant l... |
If not, then why aren't all the pages loaded into the TLB so that TLB misses never happen.
|
My idea is to initialize a hash table (with chaining) with $n$ cells, having load factor $\alpha = 1$ hence having $\theta(1)$ expected number of values in each cell in the hash table, then go cell by cell, sort it, count the number of distinct values and add them to a global variable holding the count and return it.
T... |
Let's suppose that we have a light source. Which of the following are correct for the tree of recursive ray-tracing (ray tree) that create when we make the colors for each pixel in the screen.
Which of the following are correct:
a) if the scene contains one non-convex polyhedron (random shape and position) then we can'... |
I'm very stuck with this problem. Given $G = (V, E, A)$ a mixed graph where every edge in $E$ is directed and every edge in $A$ is undirected. Thinking as a max-flow problem, decide if it's possible to give a direction to every $a \in A$ in order to make $G$ an $eulerian$ graph.
The model I've thinking so far is to tra... |
Let's say I have $n$ sets of matrices
$$
A = \left\{\begin{pmatrix}
2 & 4 & 17\\
5 & 6 & 9\\
\end{pmatrix}
\begin{pmatrix}
2 & 4 & 18\\
5 & 6 & 9\\
\end{pmatrix}
\right\}
$$
$$
B = \left\{\begin{pmatrix}
13 & 20\\
3 & 16\\
\end{pmatrix}
\begin{pmatrix}
14 & 20\\
3 & 16\\
\end{pmatrix}
\begin{pmatrix}
13 & 21\\
3 & 16\\... |
In quick sort, in each iteration we are able to find correct index for an element (i.e. pivot element).
Is there any algorithm to find correct element for a given index ?
Here, correct index of an element means the final index of the element which would appear after sorting the array.
Reference:
https://en.wikipedia.or... |
I'm thinking to do this recursively using the fact the the left subheap is also a min-heap with its root being the minimum using some variation of Select$\left \lfloor \frac{n}{2} \right \rfloor$.
Select-Var($H$,$\left \lfloor \frac{len[H]}{2} \right \rfloor$):
if $H[1]$ has no children then return it
if $H[1]$ has on... |
Let $L\in CoNP$. Assuming that $L\in NPH$, what would we get?
So, as $L\in NPH$ then every language $A\in NP$ has a reduction $A \leq L$. This would mean that $\overline{L} \leq L$ as well. By reduction properties the same reduction applies for: $L\leq \overline{L}$. So $\overline{L}\in NPH$ and thus $\overline{L}\in ... |
I'm trying to find out if these algorithm still work if i replace the Euclidean space with metric space defined on the input point set. But i'm having some trouble figuring it out for some of them. I have:
k-means clustering using Lloyd algorithm, with random initialization
DBSCAN using the graph-approach
DBSCAN using... |
I want to develop LRU key-value data store and in that wanted to get rid of space to store the key itself. Instead wanted to store a 128 bit murmur hash. The structure of data-store that I want to explore is similar to CPU k-way set-associative caches.
So the algorithm I want to pursue is -
Compute a murmur 3 hash for... |
I'm trying to prove the if $$ is a $$-state synchronizable DFA, then it has a synchronizing sequence of length at most $^3$. first I have to prove that if a string syncs two states, then its length is at most $k^2$.
The question was answered here.
The proof of this a standard shrinking argument: if such a word is long... |
I am struggling with this question, because I came up with an relatively easy proof for mapping reduction:
if $A\leq_{M}B$ and $B\leq_{M}C$ then $A\leq_{M}C$. We know that $w \in A$ $\Leftrightarrow$ $f(w) \in B$ and $w \in B$ $\Leftrightarrow$ $f(w) \in C$.
Let $h = g \circ f$. since $w \in A$ $\Leftrightarrow$ $f(w)... |
For a sentence $\varphi$, we'll define $Spec(\varphi)$ to be the set of all $n\in\mathbb{N}$ for which there is a model $M$ with $|D^M|=n$, such that $M\models\varphi$.
Let $\Sigma=\{P(\cdot),R(\cdot)\}$, where $P,\,R\,$ are relations.
$\boldsymbol{Disprove:} $ There is a sentence $\psi$ above $\Sigma$ such that $Sp... |
When I read about Artificial Neural Networks (ANN), no one says what ANN is.
For instance, Wikipedia says:
Artificial neural networks (ANNs), usually simply called neural networks (NNs), are computing systems vaguely inspired by the biological neural networks that constitute animal brains.
This is a vague definition.... |
I am working on different methods to solve Recurrence Relations. I am using Iteration method and substitution method, which involves Induction, but I feel that sometimes Induction method creates a bit confusion, so I want to know that which of these two methods is more reliable?
|
So in the little I know about formalization of cellular automata, it appears there are 4 major categories of cellular automata:
1-dimensional (cellular automata on the line)
2-dimensional (cellular automata on the plane)
3-dimensional (cellular automata in the cube)
hyperbolic cellular automata
In the plane example, ... |
I was studying for an exam when I stumbled across this true or false statement:
In a system of 7 states diagram, a process could switch from ready state to exit state directly.
The answer to this question was "True".
After some digging into books, I found this:
Ready -> Exit: For clarity, this transition is not show... |
Universal codes are fairly well studied, and many asymptotically optimal universal codes exist for binary data (see https://en.wikipedia.org/wiki/Universal_code_(data_compression) especially https://en.wikipedia.org/wiki/Elias_delta_coding and https://en.wikipedia.org/wiki/Elias_omega_coding).
I know that no optimal un... |
I've recently seen a proof that the set of Turing machines $L = \{encode(M) |L(M) \text{is closed under reversal}\}$ is not decidable.
The proof used following idea:
Reduce from the $A_{TM}$ problem by taking input $\langle M, w \rangle$ and by constructing $M'$ such that $L(M') = \text{some language that is closed und... |
I am reading Algorithms Unlocked By Tom Cormen and find this concept a little confusing.
Why is it that we require loop invariants and how does it help in analyzing algorithms?
|
The paper A universal cellular automaton in the hyperbolic plane says:
Our simulation consists in simulating the execution of a register machine. It is known that two registers are enough to simulate a Turing machine, see [10], and so, by such a simulation, we shall obtain a universal computation.
It links to [10] wh... |
Intuitively I feel like this is a bit of a dumb question, and is probably related to my vague understanding of approximation algorithms and whatnot.
Suppose I have some minimisation problem $X$ where, for some $n$, the optimal solution is $x$. If I make an algorithm such that it finds a solution of at worst, $\lceil1.5... |
Problem Description
Note: I originally posted this question on Stack Overflow but was referred to this community instead.
I have a graph containing selectors and elements. An element can have multiple selectors associated with it. As a graph, it looks something like this:
In the example, any node prefixed with an S is... |
There is a problem that I am working on. I have shown that the problem is NP Hard, but I haven't been able to show that it is in NP. But the problem is also known to be in EXP. My gut feeling is that the problem is PSPACE-complete. I am leaving aside PSPACE-hardness for now. Even if I have to prove that the problem is ... |
I have just started learning formal languages and here is a question I am facing a little hurdle:
Construct a context-free grammar for $\{ a^{2n}b^{2n} \mid n \ge 0 \}$.
This was what I got at first.
$$S \to ab\mid aS\mid Sb\mid ab$$
Now I am getting this,
$$S\to \epsilon$$
$$S\to aaSbb$$
$$G=(V,\Sigma,R,S)=(\{S,a,b\... |
I'm finding contradictory information online where some places only consider auxiliary space and others define it as
Space Complexity of an algorithm is total space taken by the algorithm with respect to the input size. Space complexity includes both Auxiliary space and space used by input.
What parts of a function a... |
Given an AVL tree containing nodes ordered by unique integer I.D's and data as pointers to some struct, what would be the expected minimum number of elements that will justify the creation and maintenance of the tree? I know this is a broad question so let me give some more details:
Say I have the following pseudo code... |
Featherstitch (Frost et al., 2007) is an approach for representing data consistency requirements for disk storage. This question concerns a graph-theoretic problem (§4.1 in the paper) that its implementation requires, but the original authors sidestepped by using a relatively crude heuristic.
My take at formalizing th... |
Given the next alphabets: $\,\,\Sigma_1=\{R^2,P^1,=^2\}\,\,,\Sigma_2=\{c,f^1,=^2\}.$
Prove of Disprove: There's exists an algorithm, that given formula $A$ above $\Sigma_2$, builds formula $A'$ above $\Sigma_1$ such that:
$A$ is valid $\iff$ $A'$ is valid.
I could not come up with a solution, but I have two direct... |
I am studying computer science at university and we have an exam, which consists of several problems, one of which has to deal with pipelines.
My understanding is that one effective way to solve data hazards is to use pipeline bubbling - adding NOPs in order to stall the pipeline long enough to finish the operation, fr... |
I'm wondering if PRIMES, the language of all prime numbers represented in binary, which is $\{10, 11, 101, 111, 1011, 1101, ...\}$, belongs to the SPARSE class, a set of all sparse languages, that is, languages satisfying the property that the amount of words of length $n$ is bounded by some polynomial $p(n)$.
I believ... |
I found this question on a forum chat on and while looking at it I thought I can solve it using recursion,
A group of friends is split into cells in a room in a random
arrangement of m X n cell locations in a rectangular or square form,
such that each person in a cell can see all the people in their cell
as well as th... |
Given a sequence of states of a given cellular automata, is it possible to construct the rules of the automata & hence predict the next state? To be clear, initially the rules are NOT known but the output sequence is.
|
Define $K\_SCC = \{ \langle G, k \rangle \,:\, G \text{ has at least $k$ strongly connected components} \}$
I want to show that $K\_SCC \in NSPACE(\log n)$, using that $st-CONN$ and $\overline{st-CONN}$ are both in NL, where $st-CONN = \{\langle G,s,t \rangle \,:\, \text{there is a path from $s$ to $t$ in $G$} \}$.
Wou... |
From prof. Onut Mutlu's slides on prefetching, this example has been shown as software prefetching:
for (i = 0; i < N, i++) {
__prefetch(a[i + 8]);
__prefetch(b[i + 8]);
sum += a[i] * b[i];
}
On Wikipedia, it says that to determine the number of element of an array to prefetch ahead is calculated by $miss\_pe... |
Say I had a PDA with alphabet language {0,1}, and a stack language {P,Q,\$}. In the PDA I don't really care what the inputs are at the end and I just want to clear the stack back down to the special character. I could write out the transitions like:
1,P->e
1,Q->e
0,P->e
0,Q->e
e,P->e
e,Q->e
1,\$->\$
0,\$->\$
but that... |
Let $s$ be a string of length $n$. One of the classical solutions to the problem of finding the smallest period $p$ of $s$ (that is, smallest $p$ such that $s$ can be obtained as a concatenation of the several copies of $p$) uses so-called $Z$-function. In words, $Z=Z[0..n]$ with $Z[0] = 0$ and $Z[i]$ is the length of ... |
The title pretty much explains the question, but still: Is the language
$$L = \{xw^3x^{rev}\mid x, w\in\{0, 1\}^*\}$$
context-free?
I think it isn't and would motivate that suspicion by the following reasoning:
if we consider the two languages:
$$L' = \{xwx^{rev} \mid\ x,w\in\{0, 1\}^*\} \text{ which is context-free}$$... |
Why are priorities always from a fixed set of integers? In operating systems priorities are integers typically between 1..MAX. But what is the reason that this is the case, when it would obviously be easier to place a new task between priority 2 and 3 with priority 2.5 instead? The way it is now, my scheduling can run ... |
The introduction of https://www.sciencedirect.com/science/article/pii/0001870882900482 starts with the following sentence:
The word problem for commutative semigroups is effectively decidable.
I know what a “decidable” problem or, more precisely, a “decidable” language over an alphabet means: there is an algorithm th... |
In JavaScript, let's say, it is easy to build a string intermixed with single underscores by just joining the string parts.
let string = ['foo', 'bar', 'baz'].join('_')
In addition, it is straightforward to write a grammar that can have letters separated by at least one underscore.
grammar = letter letterOrUnderscore*... |
The problem is described below:
When m=2 and n=3, it is basically finding the distance between a point and a line segment in $R^3$.
But when both m and n are larger, do I have to use a generic optimizer to solve this, or this problem can be precisely solved with mathematics, like the case when m=2 and n=3?
What I have... |
(Topic summary under the line.)
Regex, at least the formal definition featuring only | and *, is used to describe words accepted by a given FSA, but it can be transformed into the corresponding state diagram (by constructing a NFSA with epsilon transitions from "modules" that correspond to the concatenations, alternati... |
I have been reading analysis of insertion sort in the "Introduction to algorithms" and faced a problem with understanding a specific summation notation when the worst case occurs.
I know how one can get formula for arithmetic series when we deal with while loop header, I mean 2+3+...+n equals to (n*(n+1) / 2) - 1. But ... |
I got this series of questions, each needs to either be proved or disproved (w/ example).
If $A$ is sorted in non-descending order, it is a valid minimum heap.
If $H$ is represented by $A$, therefore $A$ is a sorted array in non-descending order.
If $H$ is represented by $A$ (such that $A[1]$ is the first element), th... |
I am parsing bank statements where the transaction amount is ambiguous as to the withdraw/deposit nature and the balance is only given periodically.
My goal is to more efficiently, than brute force, find where the possible withdraw/deposit position should be.
For Example:
Transaction ID
Withdraw/Deposit?
Balance
... |
Context
Say I have a transposition table that uses keys produced by (e.g. Zorbist) hashing game positions.
The table has a finite recycled memory (key % p is the index of the key, p is table size and prime).
That is, at table[index(key)] (there) we store key and (game position) evaluation.
So, when fetching cached eval... |
I was watching this video How An Infinite Hotel Ran Out Of Room, by Veritasium.
The video says that it is not possible to fit names made of infinite strings of $\{A,B\}$.
We know we can fit infinite people in the hotel, we also know that there solution that works and solution that don't work. For example if you have in... |
Algorithms for clipping lines to a rectangle seem to have been invented by Ivan Sutherland in the late 60s.
At some point the rectangle was generalized to an arbitrary polygonal area, and these days can be any path (including bezier curves, etc.)
It seems that Weiler and Atherton may have been the first to generalize p... |
Earlier I was having a technical test when I stumbled across this question:
I know that probably in modern systems, the OS and the MMU is responsible for that. But the test was focused on Embedded Systems were no OS would be there, and the program will just compile directly and run immediately on the microcontroller.
... |
I was studying about algorithms and came across the SSSP problem which stated:
Given connected weighted directed graph G(V,E) and a node S, find the shortest path from S to all nodes of the graph.
The distance of a path between 2 nodes is clear. It is the sum of the weights of the edges that make up the path.
But I don... |
I'm trying to generate some history-dependent model with machine learning, whose underline physical model has a clear definition of its "internal state variable" (a state derived from historical inputs) and how this variable interacts with the inputs to get the outputs. Mathematically this reads: $y_t=f(x_t,h_t)$, $h_t... |
I was going through the L-System Wikipedia (https://en.wikipedia.org/wiki/L-system) and it mentions that L-Systems are very similar to unrestricted grammars / string re-writing. After going through the Wikipedia, I can't see any difference between the two? does anyone know what they might be?
|
Famously the intersection of context-free languages need not be context-free. On the other hand the intersection of context-sensitive languages is context-sensitive.
So this leads to the question: what is the closure of context-free languages under finite intersections? Does this class of formal languages have a name? ... |
I was wondering what are the main differences in terms of efficiency of convex hull algorithms?
Brute force algorithm is inefficient due to iterating over every three vertices in our set and its time complexity is $O(n^3)$ and probably is never good to use.
But what about Gift wrapping, Graham's scan and Chan's algorit... |
The question is as follows:
Let G be connected, directed weighted Graph with non-negative edge weights and let s and t be vertices in G. Furthermore, let K be a subgraph of G with the same number of vertices but fewer edges.
The task is to add an edge that is in G but not in K such that the length of the shortest path ... |
Suppose, that I have a four-by-four matrix and I want to print each element of it.
matrix = [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16]]
for row in matrix
for elem in row
print(elem)
So, I have a questions:
a) Should I consider, that such iterating requires O(k + n) in terms of big O no... |
We can do this in $\theta(n^2)$ time if we calculate the average of all couples of nodes in the tree and compare it to the root, but this is too much time.
We can do this in linear time but with extra space by saving the in-order traversal of the left sub tree to array A, and the right sub tree to array B.
Now for the ... |
Cheers, let's suppose we have a MAX heap which does not allow duplicate elements. Is it possible for this heap to be a BST ? Choose the right answer(s) below:
A heap can never be a BST
A heap is always a BST
A heap can be a BST if there is only one node inside it (root)
A heap can be BST if and only if it has up to 2... |
This is a simple question I ran into in a remote interview:
Given a collection of letters, permute them (or one of its subset) into a string such that:
each letter can only be repeated for <= 11 times sequentially in the permutation
the string is lexicographically the largest
For one case, the collection of letters... |
If I select chrome browser, then I select Android Studio, do they directly open in Ready Queue (allocated to RAM main memory), what processes actually goes into job queue? Does Job Queue gets filled when RAM has no space available? What I want to ask basically is if I opened a word processor and a browser, do these pro... |
Can you help with a contex-free grammar for the language 0^n 1^m 2^k where n + 2k >= m?
|
I'm trying to understand the average run time of quicksort which is $O(n \log n)$.
I understand the intuition behind it: if we partition array $A$ to e.g. $\alpha n $ and $(1-\alpha)n$ then we essentially partition $\log n$ times and each partition performs $n$ comparisons. And this happens with high probability; e.g. ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.