instruction stringlengths 35 29.1k |
|---|
Let us $\Sigma = \{0,1\}$ and $f: \Sigma^* \rightarrow \Sigma^* \in FP$ for which is valid that $\exists k: \forall x \in \Sigma^* : \lvert x \rvert ^ {1/k} \leq \lvert f(x) \rvert \leq \lvert x \rvert ^ k$. Thus, we can say that the function $f$ is one-way function.
We have language $L = \{ w \; | \; \exists z \in \Si... |
I want to check whether a formula in finite LTL is valid on a finite, linear trace.
For infite traces I would create a Kripke structure of the trace and a Büchi automaton for the negated formula, and check if the intersection is empty.
Would this also work with a finite trace and formula in FLTL? I already tried addi... |
Let $Q$ denote the number of queries.
I have a $25 \times 25$ matrix in each cell of an array of size $n$. Let us denote this array by $A$. It's a special matrix, more specifically, all elements are $0$ are $1$ and only on cells adjacent to the main diagonal and on the main diagonal itself, allowing faster multiplicati... |
It seems intuitive that any natural problem that is NP-hard on trees, should be hard on graphs that are not trees. But perhaps this is wrong?
Question: Is there some natural decision problem on graphs that is NP-hard when we are promised the graph is a tree, but in $P$ when the graph is promised to not be a tree.
Thoug... |
I know that there are several problems for which a small change in the problem statement would result in a big change in its (time) complexity, or even in its computability.
An example: The Hamiltonian path problem defined as
Given a graph, determine whether a path that visits each vertex exactly once exists or not.
... |
I am implementing an online platform, where third-parties sell virtual goods to clients on a subscription basis. Let's take for example ebooks as a virtual good in this case.
How can the third-parties trust my platform? How can they know that I don't cheat with the number of subscriptions I report back to them? Do any ... |
I have a question about Linear Discriminant Analysis (LDA) for the purpose of Dimensionality Reduction.
So I understand for the algorithm to calculate for $k$ projection vector(s) you need to determine the eigenvector(s) that corresponds to the top $k$ eigenvalue(s). But can anyone explain what you do with those eigenv... |
I have a question. Please be nice; I come from the corporate world and my knowledge of computer theory is around a college freshman level.
My understanding from many popular-level sources (like Scott Aaronson's P vs NP for dummies blog post, or this New Yorker article) is that the P vs NP question asks whether a proble... |
Consider you have a permutation of $1$ to $n$ in an array $array$. Now select three distinct indices $i$,$j$,$k$, there is no need to be sorted. Let $array_i$, $array_j$ and $array_k$ be the values at those indices and now you make a right shift to it, that is $new$ $array_i$= $old$ $array_j$ and
$new$ $array_j$= $ o... |
I am trying to find the best time complexity of an algorithm that calculates the weights of all the nodes on a graph. The weight of the node is defined as the sum of the weights of the edges adjacent to it. I can argue that the algorithm is similar to the one which would calculate the degree of all the nodes and that c... |
I'm studying his paper and I was wondering how the community reacted to it. Yes, Average Case Complexity has come a long way since then, but I want to know if it was directly influenced by it.
|
I'm pretty new to the PDA topic.
How do I construct an NPDA for the language $$L= \{w : n_a(w)+n_b(w) = 2n_c(w)\}.$$
I've tried all the possibilities, but I still somehow end up accepting all words.
|
The Problem
I have a set of edges (a, b), where a and b are nodes in a directed, acyclic graph (DAG).
The number of edges is guaranteed to be the number of nodes - 1.
I am looking for an algorithm that finds a sequence of nodes [n_1, ... n_n] so that the sequence contains all nodes in the graph, and that all edges (n... |
I have a hash table that uses zobrist hashing to calculate the hash for various positions. The hash table is used to look up various transpositions. For some positions I do not want to allow any transpositions, but I still want to store the position in the hash table. So I'm trying to make the position's hash unique by... |
What are the obvious benefits of transforming variables with long tail distributions? To extend it more, why the machine learning algorithms will perform better afer such a transformation?
|
Construct a PDA for the language described by the following CFG:
$$ S \to [S] \mid \{S\} \mid \Lambda $$
How can I develop a pushdown automaton for this language?
|
I want to express the asymptotic time complexity for the worst case scenario of sorting a list of $n$ strings, each string of length $k$ letters. Using merge-sort, sorting a list of $n$ elements requires $O(n\log n)$. Comparing two strings of length $k$ has a cost of $O(k)$. Therefore, the cost would be $O(kn\log n)$.
... |
I was doing problems in "Leetcode" and found a problem that I could not solve.
Given a non-negative number $n$ and two non-negative numbers $a$ and $b$, consider every number $i$ such that $a \leq i \leq b$ and among those find the maximum value of $n \& i$ where $\&$ means bitwise and.
I could only solve when $a=0$ by... |
I want to ask that what is the time complexity of this function (triple nested loop)
.Kindly analysis completely so that I can understand.
function loop_nested(n)
r := 0
for i := 1 to n - 1 do
for j := i + 1 to n do
for k := 1 to j do
r := r + 1
return(r)
|
I tried to solve the recurrence relation
$T(n) = 6T(n-1) + n^3$ using the tree method, and figured out that the root will be $n^3$, the second level will be $6^1(n-1)^3$, the third will be $6^2 (n-2)^3$, and so on.
The formula as I understood it is: $\sum_{i=0}^n 6^i(n-i)^3$.
After entering this in Wolfram, the result ... |
I have an algorithm which is meant to solve the following computational problem:
Input: Sequence of positive integers
Output: A Sub-sequence of some desired length derived from original Sequence such that the sum of the sub-sequence's elements are the minimum sum possible
The Algorithm I have to solve this problem is i... |
Given that x objects (repetition allowed) can be arranged into y configurations, and that the population size is N, I am uncertain as to whether the size of the search space is |S| = |(y^x) * N| or |S| = |(y^x)^N|.
|y^x| comes from basic combinatorics: it is the number of ways to arrange |x| objects into |y| configurat... |
Wikipedia states on the page of the halting problem, "For any program f that might determine if programs halt, a "pathological" program g called with an input can pass its own source and its input to f and then specifically do the opposite of what f predicts g will do."
Suppose we have 2 neural networks, approximating ... |
I have an algorithm that visit all the nodes on a graph in distributed computing , the initiator is one site only , I want to change it so that the initiator can in the end of the execution know the nodes that have more than 3 neighbours ,
So the initiator is one site and the result expected is the list of the nodes th... |
I need to prove, that the $\#k-colouring$ graph problem is $\#P-complete$. I want to construct the reduction from $\#3SAT$ problem, so $\#3SAT \leq \#k-colouring$. The reduction between the counting problems consists of two parts. The first one maps instances of the first problem to the instance of the second problem (... |
The teacher explained to us this algorithm for deleting a node in a binary search tree, but I can't understand how it works when the node to be deleted has only one child (I already know how it works theoretically).
Algorithm:
abc_delete(T, z) // z is the node that must be eliminated
{
if((z.left == NULL) && (... |
Suppose we have a function f :: a -> b and a function g :: b -> a such that f . g = id. You might say that g is the "inverse" of f (and vice versa). Could we then pattern match on something like f x on the left hand side by replacing occurences of x with g x on the right hand side? For example:
-- Here, (- 3) is the "i... |
If a string(w) is accepted by an NFA, then corresponding to w,
can there be multiple paths each starting from the start state and ending at an accepting state?
|
Basically what I know is that 8086 can address up to 1 MB of locations which are divided in 4 segments(code, data, extra and stack) 64 KB each. But 64 KB * 4 is 256 KB, which doesn't add up to 1 MB(1024 KB). So what about the rest of space.
|
I read on Wikipedia the following:
Since NP-complete problems are in NP, their running time is at most exponential.
Is that correct? I thought a problem is in NP-complete if:
the problem is also in NP (i.e. accept verification in polynomial time)
Every problem in NP can be reduced to it in polynomial time.
These tw... |
We know that:
$k^n = o(n!)$
$n! = o(n^n)$
where $o$ refers to "little o notation" (i.e. bounds that are asymptotically not tight).
With that in mind:
Are there any defined or academically established classes for problems with complexity of at most $O(n!)$ and $O(n^n)$?
What is the set relationship for these classes... |
Someone told me this and I would be interested to know if it is true:
In the ieee 754 format approximately half of the positive numbers are in the interval [0, 1]
|
This is the problem that I have to solve:
given a node in a binary search tree, find the node
with the smallest key that is greater than the key of the given
node..
The algorithm that is often given is this one:
bst_successor(x)
{
if(x == NULL)
return NULL;
if(x.right != NULL)
... |
Suppose we have a symmetric matrix $A \in \mathbb{R}^{n \times n}$ that has $n-2$ equal eigenvalues and the other two are distinct.
Question: What would be the complexity of its inversion?
On the one hand, if all eigenvalues are the same, then the matrix is equal to $aI$. Therefore, the inversion is $O(n)$.
On the ot... |
I'm having a lot of problems trying to make a Turing Machine that accept that language, is it even possible to make it? and if so, how can I proceed to make the Turing Machine?
|
If we have a Turing machine with various $\delta(q_i, a_i) = (q_j, a_j, Direction)$ where Direction can be L or R(denoting the movement of head), can we encode it uniquely to some natural number(which can later be decoded to give us back the deltas) ? It doesn't matter if all the natural numbers map one-to-one to all t... |
Why do we need at least 2 Code Words of the max length in optimal Codes?
Any why do they just differ in their Prefix?
Could someone give me more insight into this?
Have to proof that for a given optimal Code C with max length L there are at least 2 Code Words of max length that just differ in their prefix.
I have nothi... |
Consider a problem where a "robot cleaner" is placed on a room modeled as a grid. Each cell in the grid can be empty or blocked and all accessible cells are connected, meaning, all empty cells will be accessible by the robot regardless of its starting position.
We are told that the robot cleaner can only take one of fo... |
How can I prove that the following problem is NP-complete?
I have a spherical container in which I have to introduce $n$ identical spheres. All of the little spheres have to be inside the container and they can't overlap each other. The idea is to minimize the container's ratio.
I know that this is a packing problem bu... |
I am trying to read a paper. I can’t understand the difference between data flow and control. Maybe control flow means OS's or hardware's steps taken for execution of statements whereas data flow stands for passage of data as a result of execution of statements. Link of paper is
https://www.usenix.org/system/files/osdi... |
Suppose that Alice has $n$ places to hide the gold $v_1, ..., v_n$ and that
Bob knows the probability of each place.
Bob has to ask Alice a series of yes/no questions to find the gold.
I have done it this way:
We order the places by probability highest to lowest.
Repeat the following:
Divide them by two so we have tw... |
I'm wodering about the relationship between the theory that studies irrational/transcendental numbers and computer science. For example, I found this paper (but was unable to get the full text)
Pseudo-random number generator based on irrational numbers
I found the paper because I started looking for a RNG that uses the... |
If we have say,key=‘0110‘ and =‘1100‘, how will ⊕key mod 2 be calculated and what will be the answer equal to?
|
I need to find an algorithm for the following problem. Any idea to which kind of algorithm to look for as starting point is welcomed. Should I look for a graph algorithm? Combinatorial problem? Mathematical or dynamic programming?
Objective:
I have a set of 48 classes with 25 students each. I need to divide each class ... |
This same question has been asked here so many times by several people. This is a problem which was asked in an entrance exam.
And I am having difficulties in digesting the correct answer of this problem. Why is my approach incorrect?
Here is my approach:
The divide part of the merge sort recursively divides the list o... |
I have a doubt about the Unit Type in the context of Type Theory and its use in different case scenarios.
To start with, a Unit Type can be seen as a nullary Product Type, namely Unit, with one only value term which is the empty tuple, (). Also, there exist a unique map from any type to the Unit.
Now, it happens that t... |
In the static RMQ problem, one has to answer queries about the minimum in a range of a fixed array. A classic variation allows updates of the form $A_i \leftarrow x $.
My question is : How fast can we update if we must answer queries in $O(1)$?
I can think of a solution which works in $O(\sqrt{n})$ per update :
We can... |
I got 2 decision problem that I need to answer if they are in P or they are NP complete:
1.Just like subset sum:
given the integers or natural numbers ${\displaystyle w_{1},\ldots ,w_{n}}$ does any subset of them sum to precisely ${\displaystyle W}$?
but now instead of $W$:
does any subset of them sum to $W'$ su... |
In Practical Foundation of Programming Languages by Harper
There have been many attempts by advocates of dynamic typing to
distinguish dynamic from static languages. It is useful to consider
the supposed distinctions from the present viewpoint.
Dynamic languages associate types with values, whereas static languag... |
I have an Independent Set problem, in which I have to check if given graph has a IS of given size $k$. I've already written a Vertex Cover algorithm a while back and I hope I can reuse it here. Those algorithms are closely related, since if graph $G = (V, E)$ has IS of size $k$ iff it has VC of size $V - k$. So am I ri... |
Regarding static typing and dynamic typing, Practical Foundation of Programming Languages by Harper says:
There have been many attempts by advocates of dynamic typing to
distinguish dynamic from static languages. It is useful to consider
the supposed distinctions from the present viewpoint.
Dynamic languages asso... |
I'm new to Haskell and have some general questions.
Question 1:
The Haskell expression (\x -> \x -> x) is the same as the λ-term λx.λx.x
The type of this expression is p1 -> p2 -> p2. What does this mean?
Question 2:
λyx.x is shorthand for λy.λx.x. In Haskell (\y x -> x) is shorthand for (\y -> \x -> x). Do (\x x -> x)... |
I have a dataset of 100 ID's, each ID with only a single unique face image. How can I develop an effective face recognition system to recognise only these faces?
I was thinking Deep Learning but the dataset is so sparse. It would be 100 classes each with a single data point (the image).
|
Let $A_j=\{(a^i_j,b^i_j)~:~ 0 \leq i \leq n,\text{and } a^i_j,b^i_j \in \mathbb{Z}^+\}$
Given sets $A_1,\ldots, A_{p}$ and a positive integer $k$, the problem is to check whether there exists one element $(a^{i_j}_j,b^{i_j}_j)$ from each $A_j$ such that $\sum_{j}^{} a^{i_j}_j \geq k$ and $\sum_{j}^{} b^{i_j}_j \geq k... |
I have the following context-sensitive grammar:
$$
\begin{align*}
&S \to xSy \mid a \mid b \\
&Xa \to aa \\
&Xb \to bb \\
&Y \to a
\end{align*}
$$
I know what it does, as it always ends in $a$ and is preceded by 3 $a$s or 3 $b$s. I'm just not sure how to write this in set notation and would appreciate any help. Would i... |
Suppose I have a system of linear equations. Using Gaussian elimination, I can determine whether a solution exists, and even find a valid solution.
During the elimination, I can combine rows together, to produce new rows with different number of variables. Is there a method to find all possible rows that contain exactl... |
The problem of finding the longest path in a graph is known to be not be possible in polynomial time, that I am aware of. I am also aware that using DFS or BFS can give the shortest distance between a given origin and destination in a graph. Is it possible to find a longest
path from a source vertex to a destination ve... |
Does $n+n^4$ grow faster than $n^2+n^3$? If so, why?
|
$$
T(n) = T(n-a) + T(a) + cn
$$
Now the solution says that the height of the tree $(h)$ is:
$$
h = \left \lfloor n/a \right \rfloor
$$
And I don't understand why. Maybe I didn't understand the withdrawal formula as needed.
|
I'm attempting to practice for an exam and I'm having some trouble on one of the practice problems. The problem asks to identify a variety of language as regular grammar, context-free grammar, context-sensitve grammar, or unrestricted grammar. It also asks that if the grammar is regular or context-free, to write out th... |
I'm practicing for an upcoming exam and am being tripped up by a review problem. The problem gives the following grammar:
$$S \rightarrow AB\$$$
$$A \rightarrow \epsilon | a | (T)$$
$$T \rightarrow T, S | S$$
$$B \rightarrow b$$
As far as I can tell, the only nullable symbol is $A$. It is the only non-terminal whose pr... |
I have 2 ways of solving Independent Set problem of fixed size $k$ for graph $G = (V, E)$:
- Vertex Cover algorithm running in $O^*(1.47^{V - k})$ (optimized recursive algorithm)
- Clique algorithm running in $O({V\choose k})$ (simple enumerate subsets of $V$ and check algorithm)
How can I determine which one has a low... |
I want to prove that $L(G) = \{01; 11110; 10101; 000\}$ is regular.
Is it correct if I write there exists a regular expression, which is: $(01|11110|10101|000)$?
How can I also prove it using a DFA?
|
Can we formalize the operational/denotational semantics of a Turing Machine? Is there any formalization in literature?
|
A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e., if a thread holds a lock l, then it cannot re-acquire lock l without releasing it. If a thread is unable to a... |
Suppose I have a matrix $M$ over $GF(2)$ with rows that represent a system of linear equations:
A xor B xor C = 1
A xor B xor D = 1
X xor A xor Z = 0
etc...
For a new external row, I want the ability to tell if it is a linear combination of the rows of the matrix, or not. I could do this by computing the augmented ma... |
I was reading radix sort in Introduction to Algorithms by CLRS . And it gave the following Lemma with its analysis
I understood the proof of the Lemma but confused on the part where they try to minimize $\left( b / r\right) \left( n+2^{r}\right)$ .
While choosing $r$ the first case was $b < \left\lfloor \ln \right\rf... |
I am looking for some interesting applications of regular expressions.
Can you name any unusual, or unobvious, cases where regexes find their application?
|
I recently completed a problem in which I was asked to generate a parse tree for the expression $+ \, 5 \, * \, 4 \, 3$ using the following grammar and rightmost derivation:
$$Expr \rightarrow + \, Expr \, Expr \, | \, * \, Expr \, Expr \, | \, 0 \, | \, \dots \, | \, 9 \,$$
While I have no trouble taking the derivatio... |
You are given a string S containing lowercase English characters. You need to find the length of the largest subsequence of S that satisfies the following pattern:
X1,X2,X3...Xn,Xn,...X3,X2,X1
where Xi is some character of S. The only constraint is that no adjacent character should be the same except Xn, that is Xi != ... |
As far as I've understood it, referring to this system as an 8-bit system points out that one can access 8 bits of data in one instruction.
While I understand that we're not saving vast amounts of time by calling it "one byte" instead of "eight bits", is there a particular reason why the latter is/was preferred?
|
Let k be a positive even integer.
Given a list of (k choose k/2) k-sequences, each with an equal number of 1's and 0's, is distinctness decidable in logspace if we're only allowed to read the input once?
In more detail:
Let a sequence have k bits.
Let each sequence have an equal number of 1's and 0's.
There are (k choo... |
I'm trying to figure out Time function and Big O of a nested loop code,
public static int example5(int[ ] first, int[ ] second) { // assume equal-length arrays
int n = first.length, count = 0;
for (int i=0; i < n; i++) { // loop from 0 to n-1
int total = 0;
for (int j=0; j < n; j++) // loop from 0 to n-1
... |
If a new technology is invented for storage devices, which is the same as or speeder than RAM (bandwidth&lanecy), is it possible to make RAM obsolete and consider the storage device as the main memory?
if that happened data and program would run directly from the storage device, or the RAM or its concept (especially as... |
So let's say I'm baking a cake and it has a few ingredients (including multiples):
ingredients = {sugar, sugar, baking powder, chocolate, flour, egg, egg}
I can go to a bunch of different stores to buy the ingredients. Each store has a different collection of ingredients to offer:
store_1 = {sugar, vanilla extract, ol... |
When you consider Cook reductions, then decision and optimization versions of the problems are polynomial time reducible to each other.
Focusing on Cook reductions, there exists a natural Karp reduction from the decision version of a problem to optimization version. Is the converse also true?
|
Consider the following problem:
You are given a finite set of numbers $(l_k)_{k\in \{ 1, ..., n \}}$ such that $\sum_{k=1}^n2^{-l_k}<1$. Describe an algorithm to find a set $(l'_k)_{k\in \{ 1, ..., n \}}$ such that $\forall k \in \{ 1, ..., n \}:l'_k\le l_k$ and $\sum_{k=1}^n2^{-l'_k}=1$.
(For what it's worth, this i... |
I have the following problem that I'm unsuccessfully trying to solve:
I have a directed graph with node demands. Unlike circulation with demands, these node demands do not "subtract" from the flow - the nodes merely demand that there would be a flow of strength k flowing through them. The graph is acyclic, however, it ... |
Let $Σ = \{0, 1\}$ and let $A, B ⊆ Σ^*$ be languages. Prove that if $A$ is NP-hard, $B$ is in P,
$A ∩ B = ∅$, and $A ∪ B ≠ Σ^*$, then $A ∪ B$ in NP-hard.
How can I go about proving $A ∪ B$ is NP-hard given the conditions? Any help would be appreciated.
|
I started to learn AI and I'm trying to solve the following problem like a search problem and I'm wondering which search algorithm would be the best in this case. Please give me at least some tips, I would be very thankful.
Problem statement:
$n$ vehicles occupy squares $(1, 1)$ through $(n, 1)$ (i.e., the bottom row)... |
I am trying to model some set operations which are only well-defined if one is a subset of the other. The way the sets are constructed, I'll have a series of constraints of the form $x \subseteq y$, including the two sets in question and some other ones too. I won't know anything about individual element membership, so... |
Let $G=(V, E)$ be an unweighted, undirected, and connected graph. Given two start vertices $s_1$ and $s_2$ and two end vertices $t_1$ and $t_2$ is there a path from $s_1$ to $t_1$ and $s_2$ to $t_2$ such that the closest number of edges between the two paths is at least $k$? Two paths are $k$ close if the minimum of th... |
def calculate_error(m, b, point):
x_point, y_point = point
y = m*x_point + b
distance = abs(y-y_point)
return distance
print(calculate_error(2, 0, (5, 5)))
I ran the code above and it worked. But I do not understand why it doesn't work when I tried setting point = x_point, y_point instead?
|
I can't figure out how to find a good asymptotic approximation for the following recurrence relation: $$T(n) = T(n/2) + T(n/3) + 1.$$
|
Given an undirected, unweighted, and connected graph $G = (V, E)$, what is the minimum amount of time it takes for party $X$ to go from $s_x$ to $t_x$ and party $Y$ to go from $s_y$ to $t_y$? At each unit of time, $X$ and $Y$ can either move to a vertex adjacent to their current position or not move at all. $X$ and $Y$... |
How would you convert the following grammar to a DFA that recognizes its language?
\begin{align}
&G = (\{S,A,B\},\{0,1\}, S, P)\\
&P\colon
&&S\rightarrow A1B\\
&&&A \rightarrow0A|\epsilon \\
&&&B \rightarrow0B|1B|\epsilon
\end{align}
And this is the DFA that recognizes $L(G)$:
But I don't really know how to generat... |
Let n be an even integer.
Let i be an input of length n.
Positions start at 0: the first bit is bit 0. The second bit is bit 1. etc.
The decision problem is, "Is bit n/2 equal to 1"?
The input is on a tape.
We have a single pointer to the input. We cannot overwrite the input tape.
We have finite amount of working-memor... |
Let n be an even integer.
Let I be an input of length n.
Positions start at 0: the first bit is bit 0. The second bit is bit 1. etc.
The decision problem is, "Is bit n/2 equal to 1"?
The input is on a tape.
We have a single pointer to the input. We may move the pointer left or right. We cannot overwrite the input tape.... |
I have a PTM with following transition:
$\delta(Z_0, \square , 0) = \delta(Z_0, \square , L, R)$,
$\delta(Z_0, \square , 1) = \delta(Z_0, \square , R, R)$
Suppose that this PTM executes n steps. What is the probability that the head
has moved k steps to the right on the work tape (in total, i.e., k is the difference
... |
I am supposed to find an algorithm solving the following problem:
Given a CFG $\;G=(V_N, V_T, R, S)$ and a nonterminal $v \in V_N$ determine if there exists a sentential form which begins with $v$.
I don't know anything about the form of the grammar and I can't convert it into Chomsky's form as it would introduce new n... |
The wiggle sort is nums[0] < nums[1] > nums[2] < nums[3] > nums[4] ...
For an input: nums = [1, 5, 1, 1, 6, 4], the expected output is [1, 4, 1, 5, 1, 6] and there can be many other possible outputs satisfying the aforementioned criteria.
I realised that the problem has a pattern:
nums[1] will be greatest among nums[0:... |
I have read that average case analysis makes some assumptions about the inputs to the data structure, and amortized analysis makes no such assumptions.
Does amortized analysis make any assumptions about the sequence of function calls to the data structure though?
I had had a dynamically sized stack (via an array) whic... |
So I'm trying to write an algorithm for computing the shortest path with constraints on the vertices you can visit in $O(m + n \log n)$ time. In this problem, we are given an indirect weighted (non negative) graph $G = (V, E)$, a set of vertices $X \subset V$, and two vertices $s, t \in V \setminus X$. The graph is giv... |
Let $A$ have $n/10$ rows, $10$ columns and $n$ overall elements
Let $B$ have 10 rows, $n/10$ columns and $n$ overall elements.
It is given that each row is sorted in ascending order,
Can you sort each of these in $O(n\log(n))$ or better using comparison sort?
I'm leaning towards k-way merge implementing a min-heap foll... |
Input:
a enclosing rectangle of size $(W, H)$
a family of rectangles $R= (R_1;R_2;\dots;R_n);R_i=(w_i;h_i)$
Output:
a scaling factor $s$
a 2D bin packing of $R$ in a rectangle of size $(sW, sH)$
I have a set of rectangles of various dimensions that I’d like to fit in an enclosing rectangle. This is a classic instan... |
I have come across the following problem but am unable to understand the solution for it. Hence I would like to know if it has a formal name then, I can search for it and read about it in more detail. Also it will help me ask better questions about it in such forums.
Problem Statement:
Given $n$ objects and two lists $... |
I am interested in these two consensus algorithms in the blockchain: PoET and PBFT.
I saw this question about PBFT algorithm.
But, my questions are: what is the difference between PBFT and PoET algorithm? Are they the same? If no, when to consider using PoET or PBFT algorithm?
Thank you.
|
How does having separate instruction and data memories help in implementing a single cycle datapath for a MIPS instruction set? I want to know why we can only use a datapath element once in a cycle for making the datapath capable of executing any instruction in a single cycle.
|
Been getting a lot more spam lately and this question came to mind.
We already use SSL certificates to authenticate websites, can we do something similar for email?
If so, why do I still receive spoofed emails?
|
I have to make an algorithm that finds all the topological orders(using predecessor counting) and the highest cost paths and their costs between 2 pairs of vertices. My algorithm looks like this for now:
def topologicalSort(self):
sorted = []
count = {}
q = deque()
for x in self.parseX(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.