instruction stringlengths 35 29.1k |
|---|
Consider a variation of the normal heap which we will call the x-heap
The x-heap of height $h$ has the following properties:
It will have $2^h$ nodes
A height of $0$ corresponds to the single root node
The format of the tree is a root with exactly one child, which in turn is the root of a complete binary tree
We def... |
Me and a friend were discussing how programming languages can perform asynchronous tasks, like waiting 15 seconds before performing another task, and we started a debate.
I know that computers have an internal clock that uses the CMOS battery that can keep track of time, but how does it know it has been 15 seconds sinc... |
I am currently in the process of proving some complexity bounds about k-DNF. However I am confused what the $n$ in the time complexity would refer to in this case (that is that I don't know how the "size" of a k-DNF is defined, nor was it defined in the assignment). Is it the number of clauses, the number of literals (... |
Let us consider Martin-Löf type theory with a cumulative hierarchy of universes
$$
\mathcal{U}_0\colon\mathcal{U}_1\colon\ldots
$$
If $A, B\colon \mathcal{U}_i$, we can form an identity type $A=_{\mathcal{U}_i} B:\mathcal{U}_i$. Using the axiom of cumulative hierarchy, we can derive $A, B:\mathcal{U}_{i+1}$, so we have... |
I am following Bottom up chart parsing algorithm from Natural Language Understanding book by James Allen. It is
I couldn't understand the 3rd step. I thought that when active arc is added the dot is advanced. But dot is indroduced in the third step. The example says that
This example shows dot is advanced. But step... |
Here is problem in Sprinklr Interview Experience | Set 5 (On campus – FTE for Product Engineer).
You are given a graph of $n$ nodes with $m$ bidirectional edges. Each edge has some value associated with it. Vertex $1$ is source vertex. You have $K$ wildcards. In the path from vertex $1$ to vertex $i$ ($2 \leq i \leq n... |
It just occurred to me that things like "greater than or equal to" and other "logical operators" are also just simple functions, such as gte(a, b) == a >= b. This makes me wonder why these are treated as "special" in databases and why they are not just functions like SQL functions. Wondering if there is some advantage ... |
What I am trying to do is for a diet app that I am planning to build. The goal is the users will input their desired macros (carbs, fat, protein) and the system should find all recipes that match the provided macros. It does not have to match it exactly, just the best match.
Another idea is users provide their daily ca... |
I use Meshroom (based on the framework AliceVision) to reconstruct a scene based on photographs (e.g. a bottle on a table in a room). The software captures the bottle, but also the table and the whole room, so I have a huge model in the end. I also a have a ground truth model of the bottle.
My goal is to align the whol... |
I'm having a hard time trying to understand how to solve this recurrence relation using the Master Method:
$$T(n) = 10T\Big(\frac{n}{2}\Big) + \frac{n^4}{\log(n)}$$
First, we have:
$a = 10,\ b = 2$ so we have $n^{\log_2^{10}} = n^{\lg10}$
Now we need to find how $f(n)$ compares to $n^{\lg10}$.
And here I'm stuck. What ... |
I am trying to implement "Contraction Hierarchies" algorithm and reading the white paper and watching video lectures [6,7]. But still I can't understand proof for the following lemma:
Lemma 1. $d(s, t) = min(d(s, v) + d(v, t) : v $ is settled in both
searches $)$.
Proof. We only give a proof outline for self-contained... |
$$
\delta(q,a) = \begin{cases}
\delta_1(q,a) & q \notin F_1 \text{ or } a \neq \lambda \\
\delta_1(q,a) \cup \{q_1\} & q \in F_1 \text{ and } a = \lambda.
\end{cases}
$$
Look at the second line of the function definition. It's a transition function. $q_1$ is the starting state. What does that union mean here? Union of ... |
To show that problem is NP-hard, we take a known NP-hard problem and reduce it to the problem whose NP-hardness we want to prove.
The reduction we need is polynomial time reduction.
But If I take known NP-hard problem and reduce it to some unknown problem by Turing reduction then what I can say about the unknown probl... |
I'm studying AVL Trees in my programming class and we got this exercise dealing with right, left, left-right and right-left rotations as a way to check if we understand the theoretical concept of AVL Trees. We're given the numbers $100,50,25,10,37,32,200$. Creating an AVL Tree until $37$ wasn't that difficult but then ... |
$ L = \{xyyz\in\{0,1,2\}^{*} : y \neq \epsilon \wedge \exists_{a \in \{0,1,2\}} |y|_a \equiv 0 \}$
I think this languages is regular. I write regular expression:
$(1 + 2 + 0) ^ {*} (11 + 22 + 1212 + 2121) (1 + 2 + 0) ^ {*} \cup (1 + 2 + 0) ^ {*} (11 + 00+ 1010 + 0101) (1 + 2 + 0) ^ {*} \cup (1 + 2 + 0) ^ {... |
Let $A$ a $n\times n$ matrix, and X the full matrix of $n\times 2^n$ binary vectors (you can choose the order of the columns of X).
What is the fastest way to compute the product AX?
|
Even though grammars can do what regular expressions do, why are regular expression employed instead of grammars in lexical analysis?
|
In Chapter 23 of CLRS, the following quote appears:
We also assume a limit on the size of each word of data.
For example, when working with inputs of size $n$, we typically assume that integers are represented by $c \lg n$ bits, for some constant $c ≥ 1$.
Here is how I understand the text:
I searched on the Intern... |
So there are One Instruction Set Computers, having only one (complicated) instruction like addleq, "add and branch if less than or equal to zero". And then there are extremely complicated Instruction Set Architectures (ISAs) with 100's of instructions like x86.
Most computers today I think use the x86 architecture, tho... |
Given set of points (in the plane), find in a linear time the smallest width annulus (annulus is the region between two concentric circles) that contains all the points.
Because of the time constraint we can't use any type sort/tree, also I've tried to think about using selection algorithm, but I can't think of a way t... |
I am having difficulty writing this formally. I know that by L'Hospital's rule we can reduce it to $\lim_{n \to \infty} \frac{n+1}{n}$ which is a constant and hence $n = \theta (n+1)!$. But I am not sure how to write this formally.
|
My study group and I have had some back and forth on one exercise and I haven't found any matching solution online. The task looks as follows: Prove that $L$ is not regular given
$$ L = \{ a^k b a^{m-1} \mid k,m \in \mathbb{N} \} $$
Questions:
How does $m-1$ affect my choice of the word to be pumped? There must be a w... |
In the textbook Introduction to Algorithm, third edition, by Coremen et al. (CLRS), the following introduction has been given about divide and conquer algorithm strategy
In divide and conquer, we solve a problem recursively, applying three
steps at each level of recursion:
Divide the problem into a number of subprob... |
CPU's are to an extent designed with in mind the software that people will write for it, implicitly or explicitly.
It seems to me that if you look at the design of instruction set architectures, they are very "imperative", in the sense that each instruction encodes an imperative style command. It also seems to me that... |
Given a 2-dimensional maze where you can give 4 commands "move up/down/right/left". Knowing the maze but not where the person is, how to find the minimum sequence of commands that guarantees exiting the maze? I'm looking for a single sequence of commands that will work no matter where in the maze you start from.
Assum... |
Let us write $\{ A_1, \ldots, A_k\} \rightrightarrows^n \{B_1, \ldots, B_m\}$ for a relation $R$ if for all $\langle a_1, \ldots, a_k\rangle$ we have $\left\lvert \pi_{B_1, \ldots, B_m} \sigma_{\bigwedge_{i = 1}^k A_i = a_i} R\right\rvert \le n$ (and $A_i$, $B_j$ are attributes from the schema of $R$), i.e, for any cho... |
I was searching for a difference on both ways of proving that a language is not regular but I didn't came up with much.
Let us take the following as an example:
$$ L = \{ a^n b^n \mid n \ge 0\} $$
Could someone tell me the differences between both theories and how to prove the language I brought is not regular accordin... |
What data structure has the best asymptotic running time for nearest-neighbor search on multidimensional data? I am interested in both preprocessing time and query time, but let's restrict attention to data structures with logarithmic average query time; how low can we make the average preprocessing time? By average,... |
Consider a Directed Acyclic Graph in which every node has a value and a cost and edges do not have any weight. I need to find a path containing nodes such that sum of values of these nodes is maximized, but sum of cost over all these nodes must be at most C.
I am thinking of some modification of Dijkstra's algorithm. A... |
I know about the concept of the "model" of a logical proposition in the context of mathematical logic: It is a mathematical structure in which that proposition is true.
However, it's not clear to me what a "model" of lambda calculus is. Wikipedia states the following:
To formulate such a denotational semantics, one mi... |
Let's define a replace query on some string $s$.
Consider a string $s$ of length $n$ over alphabet $C = \{ c_{0}, c_{1}, c_{2}, \dots, c_{k}\}$. Also consider $l, r \in \{0, 1, 2, \dots, n - 1\}, l \geq r; \quad c_{i}, c_{j} \in C$. The replace query $\left(l, r, c_{i}, c_{j}\right)$ replaces all occurrences of $c_{i}... |
I assume the reason space makes a difference in F# is due to reserving a certain function, when minus is in front of a number without space, however what are the reasons for this? I can't seem to find any functions related to this
|
$L = \{x \in(a,b,c,d)^* \mid -10 \leq ( |x|_a + |x|_b) - ( |x|_c + |x|_d) \leq 10 \}$
I don't have any idea. Can someone help me.
|
$L = \{y \in (a+b)^* \mid ||y|_a - |y|_b| \leq 10 \}$
Any idea? I have problem with this kind of task.
|
I'm looking at the following question from this handout:
The class of decidable languages is closed under union
My question is, does this hold in reverse? Is there a phrase for this?
Basically, if $L_1 ∪ L_2$ is decidable would $L_1$ and $L_2$ be decidable as well?
I believe it does, by making one machine $M$ to emul... |
Disclaimer. What I'm going to ask about below may seem to be "Topological sorting". To my understanding, it is not. The latter runs in linear time, while I'm looking for a modification of the regular sort, which is at $N\log N$.
Remark. I'm doing the sort in the reverse order, to use the analogy with heights and masses... |
The letters $\mu$ and $\lambda$ are usually used to represent, respectively, the length of the tail of the graph and length of the cycle in the graph. But Menezes on note 3.8, page 91 (or PDF-page 6), seems to have swapped their roles.
$\mu$ and $\lambda$ in Floyd's cycle detection algorithm">
There's nothing wrong wi... |
for (i = 2; i < n; i = i * i) {
for (j = 1; j < i / 2; j = j + 1) {
sum = sum + 1;
}
}
I know that the outer loop can run for a maximum of $n^2$ times and the inner loop will run for $\frac{n^2}{4}$ times.
|
I have this problem
A firm has $q_j$ jobs of type $j$, where $1 \leq j \leq n$. It also has $[n] = {1,2,...n}$ machines. Machine $i$ can service any job of type $j$ where $j ≤ i$. The cost of running machine $i$ is $f_i +m_i·q$ where $f_i$ is the fixed cost of running the machine and $m_i$ is the marginal cost of servi... |
So I'm aware that the singleton language is in fact regular for all x ∈ Σ*, but I do not understand why it is. A formal proof would help, but also getting some intuition as to why it is regular would also be appreciated! As of now I'm just aware of it as a property, but I don't have a good grasp on why it is regular.
|
Here is the problem which I thought was simple dynamic programming, which is however not the case.
Given an $N \times M$ matrix of numbers from 1 to $NM$ (each number occurs only once), find a path from top left to right bottom while moving right or down only. If we sort all values visited in this path it should be le... |
Given the alphabet $\{0,1\}$, generate a regular expression with the following language: $$ \{w\in \Sigma^* \mid w \text{ has odd length and its middle symbol is }1\}. $$
I'm having trouble finding a solution for this regular expression. I think it's impossible because you need to have an even amount of 1's and 0's o... |
I have a list of "players" of a "tournament". Any two adjacent players may "compete", which results in the loser being thrown out of the tournament. Winning is not transitive. The winner of a given competition between two players is known, but the order of competitions is not. Suppose that I have some tournament of the... |
Sorry if my title or question is unclear. I lack the vocabulary to formulate it properly.
I've got a classical tree structure with several layers.
I have to manage authorization for each user, as not every user has access to all elements, so each user has their own view of the same tree.
What is the best way to store t... |
As part of a solution to an earlier question, I am interested in the following problem.
I have a 2-D matrix $M$. I want to preprocess it in linear time so that I can answer queries of the following form in constant time:
Given $i_1 \leq i_2$ and $j_1 \leq j_2$, what is the minimum of $\{ M_{ij} : i_1 \leq i \leq i_2, ... |
[The q is a play on the title of this 2007 survey of Haskell.]
tl;dr I have a couple of connected questions about Haskell's overloading mechanisms. I'll ask first then explain why. I'm looking at the discussions when overloading was 'discovered' around 1988/1989, and imagining how would some of the alternative designs ... |
This is the illustration of the AC-3 algorithm for four queens from exhaustive study of essential constraint satisfaction problem techniques based on N-Queens problem by Md. Ahsan Ayub, Kazi A Kalpoma, Humaira Tasnim Proma, Syed Mehrab Kabir and Rakib Ibna Hamid.
I am confused whether this is pure AC-3 or AC-3 with b... |
Let's say I have the following string:
XXXXXAYYYYBYYYYCXXXXXDYYYY
We can see that the substring XXXXX is 5 characters long, and repeated 2 times. So it covers 10 characters. This is the longest repeated substring
However, there's the substring YYYY which is 4 characters long, and repeated 3 times and therefore covers ... |
say you have a min-heap. Popping removes the root and replaces it with the value of one of the leaves and then heapifies. couldnt this last heapify result in an unbalanced tree? is there something you have to do to maintain the balance of the tree?
|
So you can store a binary tree without pointers using a 1-D array:
Binary Trees can be represented using 1-D array in memory(Fig 1).The rule to store binary tree in array are :
The values of binary tree is stored in an array called as tree.
The root of the tree is stored at first location i.e. at tree[0](0 index).
... |
I am trying to find out how much data we produce to project how much we will produce in the future. I find stuff like this and this:
There are 2.5 quintillion bytes of data created each day at our current pace, but that pace is only accelerating with the growth of the Internet of Things (IoT). Over the last two years ... |
I am trying to determine whether $f(n) = \sqrt n$ is in $O(g(n))$, $\Omega(g(n))$, or $\Theta(g(n))$ where $g(n) = \log^2 n$.
The answer says that only $f(n) = \Omega(g(n))$ is correct, but why isn't $f(n) = O(g(n))$ correct as well?
The formal definition is $f(n) = O(g(n))$ means $c*g(n)$ is an upper bound on $f(n)$... |
I am unable to understand the logic behind O(n) solution of this classical problem- Maximum length sub-array having given sum (negative numbers included),
I read that it can be solved in O(n) time complexity and O(n) space complexity, but the logic behind it is still unclear to me. I have read this solution:
Initializ... |
Neural networks use specific activation functions, commonly used ones are tanh, ReLu.
I have seen that people have experimented with continuously parametrices activation functions, for instance here. Here, the additional parameter $\alpha$ which interpolates from logarithmus to linear to exponental, is optimized during... |
How do I build a pushdown automata that accepts the language over the alphabet $\Sigma = \{a, b\}$, defined by the strings $w$, such that $|w|_a = |w|_b$?
I'm sorry I can't give any approach of what I did, but it's because I don't even know where to start with this ex. in particular. I tried to search anything on my bo... |
I need to prove or disprove the following statement.
If $A_n ⊆ \Sigma^*$ is regular for each $n \in \mathbb{N}$ then $\bigcup\limits_{n=0}^{\infty} A_n$ is regular.
I know that if two languages are regular, then the union of the languages is also regular. I don't think that really applies to this problem, because ... |
Let us have a sorted array of n numbers and we would like to find a well spaced set of C of them, More specifically, we want to get a subset $ S\subset T$ with |S| = C and with $min_{i,j \in S,i\ne j} |i-j|$ as large as possible. Come up an algorithm for fining the best S.
What is the correct output if the sorted arra... |
There are two fast algorithms for maximum matching on general graphs:
Micali and Vazirani in $O(E\sqrt{V})$.
Mucha and Sankowski in $O(V^{2.376})$.
Can these be also used for maximum weighted matching on general graphs? Note that Edmonds' Blossom algorithm can be used to solve both problems.
|
I've been fiddling around with a project that does some normalization of lambda calculus(-like) expressions and I stumbled upon that
(λ λ ... λ n (n-1) ... 2 1)
(De Brujin notation) is just the identity. I've generalized this a little to realize I can do stuff like
(λ λ λ λ 4 2 1) = (λ λ 2)
So basically if you can id... |
I can see that $L$ has to be context-free but not regular here as regular languages are closed under concatenation and intersection. But $L\cap L^2$ looks too weird. I couldn't think of any $L$ that gives rise to meaningful $L\cap L^2$.
Any hint would be appreciated!
|
Does anyone know how to make this into a truth table and a logic circuit?
(x•y)+x
If so please send me the answer.
|
Consider binary trees with some abstract values at the leaves. A tree t2 is said to be "derivable" from a tree t1 iff the set of values in the leaves of t2 is included in the set of values in the leaves of t1. In particular, some values can be removed and some can be duplicated.
I'm looking for a minimal set of somewha... |
I'm looking for an algorithm to decide if a given first order formula over a fixed vocabulary admits a logically equivalent existential one (i.e. a formula in prenex form where all quantifiers are existentials).
Is it known if such an algorithm exists or does not exist? At least when no functions symbols are admitted? ... |
In the book "topology via logic" by Steven Vickers, topology is introduced for computer scientists, with the idea that topology captures the idea of approximate information.
I am somewhat confused by the explanation. In particular, I'm confused by how it relates to sigma-algebra's, which are also a way to express appr... |
Given a sorted array $A[1,\ldots,n]$ and element $x$ that located at
position $k$. We know $x$, we don't know $k$. Write an algorithm that finds $k$, in $O(\min(\log k, \log(n-k))$ time complexity.
Any ideas how to solve this?
|
When performing a local search, for example, a 2-node exchange in a metaheuristic (like GRASP), what is the usual stopping criteria for that procedure?
Some bibliography says that the local search stops when no further improvement can be found in the neighboorhoud of the current solution. My question is: whether it is ... |
I am trying to figure out how I can use aggregate functions to solve this problem. For example if I had the table
enrolled(student-id, course-id)
123 897
123 645
589 452
009 897
If I wanted to find the number of courses each student is enrolled in, how would I go about doing that? I was thinking of using the count fu... |
Given N points on a grid, find the number of points, such that the smallest maximal Manhattan distance from these points to any point on the grid is minimized. Also, determine the distance itself.
The points are inside a grid, –10000 ≤ Xi ≤ 10000 ; –10000 ≤ Yi ≤ 10000, N<=100000.
In the example below the points are (1... |
Consider a $2$-party communication model in which $A$ wish to send to $B$ an $n$-bit string. It is very easy to prove that any deterministic protocol for this problem requires $\Omega(n)$ bits to be transmitted. It is also well-known that any randomized protocol for this problem also requires $\Omega(n)$ bits to be tra... |
Is it possible without any forms of eval or stored procedures to execute a query, which interprets logical expression, encoded in some way in a table (or two tables) of relational database?
For example, one table can contain a mapping for variable names into their truth values (V1), and another table or two (L1 and L2)... |
I'm interested in methods for proving a set is at some level $\Sigma^0_n$ (or $\Pi^0_n$) in the arithmetical hierarchy, and in particular, proving it is at the level with the smallest $n$ possible.
I know that a set is in $\Sigma_n^0$ if it can be expressed as a sequence of $n$ quantifiers (starting with $\exists$ and ... |
I am trying to understand the fact that integer division is no more difficult than integer multiplication. I found some references - here and this lecture note. Wikipedia says if there is a way to multiply integers in time M(n), then we can divide them in CM(n). When I think of division a/b as finding
integers d and r ... |
This question is building up on an older one, here.
But now let's say we keep $Σ=\{0,1\}$. Is the TM that accept anys ($1^x \mid x \gt 0$) recognizable?
That means 1, 11, 11111, 1111111, and so on are all accepted.
I believe the TM is unrecognizable. This is because for it to be recognizable, we would have to halt. Ye... |
So I've been doing regular languages a while and still need a better understanding of why all finite languages A ⊆ Σ* are regular? Is there a formal proof of it or is it just because a DFA can represent any finite language since the states would be finite as well?
|
Super-recursive algorithms are theoretical super-recursive algorithms are a generalization of ordinary algorithms that are more powerful, that is, compute more than Turing machines.
In this entry it is said:
A symbol sequence is computable in the limit if there is a finite, possibly non-halting program on a universal ... |
In my lecture I saw the problem of
$\text{EXACT-CLIQUE} = \{\langle G,k\rangle : \text{the largest clique in $G$ is of order $k$}\}$
I understand this problem is obviously not in NP as we would need to check all cliques, but if we consider the complement of the problem, (i.e. is the largest clique not of order $k$), w... |
Maybe my question doesn't make sense, because I lack some more thorough understanding, but I was curious if arithmetic was Turing complete?
As I understand it, a "model of computation" is a mechanism where you can compute outputs from inputs. Thus a "computation" is just a mapping from inputs to outputs.
So if say the ... |
I am doing a problem where I need to prove that no 2-state DFA decides the language
A = {x ∈ {0, 1}*| bnum(x) is divisible by 3}.
It's seems pretty obvious at first, because aren't there only 4 DFA's with two states that define it? Also, since x is divisible by 3, the DFA would need to have 3 states to define the remai... |
The product of 2 independent sources $(S_A,P_A)$ and $(S_B,P_B)$ is defined as
$$
(S,P)\text{ s.t. }S = \{s_As_B|s_A\in S_A,s_B\in B\}\text{ and }\ P(s_As_B) = P_A(s_A)\cdot P_B(s_B)\,\forall s_A\in S_A,s_B\in S_B
$$
and the MinAveCodeLen is the minimum average codeword length which is equal to the average codeword len... |
The original nondeterministic FSA I have is:
After converting this to a DFA I get:
If I use the Myhill-Nerode theorem on the current DFA, I get all pairs marked, so this is already minimized. But I think this is incorrect.
I want to minimize this DFA. How should I do this using the Myhill-Nerode theorem, since some o... |
Let $\Sigma$ be the set of all permutations in $S_n$. What is the minimum number of states in a DFA accepting the language of all words over $\Sigma$ which multiply to the identity permutation?
For example, if $n=2$, then $\Sigma$ consists of two mappings, the identity mapping $\iota$ and the transposition $\tau$. The ... |
A binary tree is a rooted tree with the root having an indegree of 0 and all other nodes of 1. The outdegree is 0, 1 or 2 for all nodes.
How do you call a rooted tree if the number of branches per node is arbitrary (outdegree of n) but the indegree 1 for all nodes other than the root node?
|
As the title states, is determining if a Turing machine runs in constant time decidable if one assumes it halts?
The decision problem, more formally:
Given a Turing machine $M$ where it is assumed it halts on all inputs, determine if it runs in $O(1)$ time.
Is this decidable?
|
So I have a DFA which I would like to convert to a regular expression. As you can see it has multiple accepting states and the start state has incoming input 'a' from q2 and 'b' from q4.
I want to convert this into a regular expression using State elimination, and I know that I need to first create a new state call i... |
A family of hash functions $H_w$ is said to be weakly universal if for all $x \ne y$ :
$$P_{h \in H_w}(h(x) = h(y)) \leq 1/m$$
Here the function $h:U \rightarrow [m]$ is chosen uniformly from the family $H$ and we assume $|U| > m$.
A family of hash functions $H_s$ is said to be strongly universal if for all $x \ne y$ a... |
I am doing Week_4 of https://www.coursera.org/learn/discrete-optimization/
stuck in solving TSP.
As there are a lot of methods to solve this problem, I am currently coding
Guided Local Search as described here.
This basically penalizes the longest edge and repeatedly searches that neighborhood until no improvement foun... |
Let's say I have a 64 kB Cache provided (i,e 2^18) which is direct mapped and block size is 16 byte = 2^5
Now, in the solution it says
m=size of cache in blocks = 4096 = 2^12. This hasn't been provided in the question. So, how do we assume / derive size of cache in blocks was 2^12.
If this is a static value, then doe... |
Given a Diophantine equation $p(x_1,x_2,...,x_n)$,
Can I find a reduction from $\text{dioph}(\mathbb{N}) \leq \text{dioph}(\mathbb{N}_e)$?
$\mathbb{N}_e$ is the set of even numbers.
So I have to find a manipulation of $p$ such that I only have even numbers as solution.
How can I do this? Unfortunately I have no Idea.
|
Here is an interview problem about balls rolling towards buckets from Sprinklr Interview Experience at GeekforGeeks.
You are given $n$ balls on the table and all the balls are rolling towards the one end of the table with velocities $V_1, V_2, \dots, V_n$ and there is a bucket placed at that end. The distance of the b... |
In Quicksort we devide the array in to about an half (not worst case) and we have left and right sides so it is 2T(n/2), now why in the end it is T(n)=2T(n/2)+n as we may need to go over all the array to arrange it to left and right sides?
|
I'm coming to you today because I have some trouble to understand how works D flip flop in depth. Two weeks ago we started at school learning sequential logic and so register and everything that come with. We saw how to build a D flip flop using RS Asynchronous flip flop like this one :
Then we made a synchronous ver... |
I have started studying the Pareto efficiency notion in Game theory. The definition I am familiar with is this:
Strategy profile $\mathbf{s}$ Pareto dominates strategy $\mathbf{s}'$ if for all $i\in\mathcal{N}$, $u_i(\mathbf{s})\geq u_i(\mathbf{s}')$, and there exists some $j\in\mathcal{N}$ for which $u_j(\mathbf{s})>u... |
Section 29.4 "Duality" of CLRS (3rd Edition) describes the way of reading off an optimal dual solution from the last slack form of the primal as follows:
Suppose that the last slack form of the primal is
$$
\begin{align}
z &= v' + \sum_{j \in N} c'_j x_j \\
x_i &= b'_i - \sum_{j \in N} a'_{ij} x_j, \; i \in B.
\end{... |
Is it possible for a regex pattern to return all the 2^n combinations of characters of a string as matches?
For example, if the string is abcd,
then the regex should return the matches:
a
ab
ac
ad
abc
abd
...
...
(16 matches)
I was trying this regex for the string abcd:
(?:.*?)|(?:.*)|(?:.*)|(?:.*)
But this is only r... |
I already know how to find the MST of a connected graph. This MST will have the least total weight and will connect all nodes in the graph.
However, this is a problem I have to deal with:
Given a weighted graph $G=\{V,E\}$ and one of its subgraph $H$. Find a subset $E'$ of $E$ such that
If we clear out every edge out... |
Assume that I have the adjacency matrix representation of a graph in $0,1$ values. Does converting it to a corresponding adjacency list representation always have a time complexity of $O(n^2)$?
|
I do understand how minimization of DFA works where there are 2 words lets say $\{a, b\}$. However, I came across this minimization of a DFA over the language of $\{a, b, c\}$ $\left(\Sigma, \{q_0, q_1, q_2, q_3, q_4\}, \{(q_0, a, q_1), (q_1, a, q_1), (q_1, b, q_2), (q_2, c, q_3), (q_3, a, q_4), (q_4, a, q_4), (q_4,b,... |
I am reading Long-term Temporal Convolutions for Action Recognition and under the Section 3.1, I read this:
To investigate the impact of long-term temporal convolutions, we here study network inputs with different temporal extents.....
and then
As illustrated in Figure 2, the temporal resolution in our 60f network c... |
Following is the definition of codata stream:
codata Stream where
hd : Stream −> A
tl : Stream −> Stream
For simplicity I assume I have just a binary stream. Now I would like to define a function flip : Stream -> Stream , that reverses the order of the stream elements.
Defining: hd(flip S) = head (S) is pre... |
Given a tree of $N$ vertices, each colored in one of the colors $1,\dots,N$.
Let’s call an edge a separator if when the edge is removed from the tree, all vertices of each color stay connected.
The goal is to find all separators in a tree in $O(N)$ time and $O(N)$ memory.
My first approach was to use Farach-Colton an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.