instruction stringlengths 35 29.1k |
|---|
Let $G$ be a context-free grammar and $w$ be a string of length $|w| = n$.
Consider the language $A_{CFG}$ = { <$G$, $w$> | $G$ is CFG that generates $w$ }, where <$G$, $w$> is a string encoding of $G$ and $w$.
Now we have to show that $A_{CFG}$ is decidable, or in other words, there exists an algorithm that determines... |
Here is the problem:
Input:
A series of source/sink nodes at fixed positions with given outwards/inwards flow
Edges are NOT specified. The edges can connect any nodes.
The total source and sink flow match
A concave cost function that gives a cost per edge in terms of flow capacity
Expected output:
The minimum cos... |
Given the regular expression $(1 + \varepsilon + 0 )(1 + \varepsilon + 0 )(1 + \varepsilon + 0 )(1 + \varepsilon + 0 )$, how many distinct strings are in the language? How do you determine this from looking at the regular expression? Do I have to generate a table of all possible combinations or is there a more straight... |
This is a very basic question but I spent some time reading and find no answer. I am not computer science majored but have read some basic algorithm stuff, for example, some basic sorting algorithms and I also have some basic knowledge of how computers operate. However, I am really interested in the idea of a Turing ma... |
How were the GPT-2 token embeddings constructed?
The authors mention that they used Byte Pair Encoding to construct their vocabulary. But BPE is a compression algorithm that returns a list of subword tokens that would best compress the total vocabulary (and allow rare words to be encoded efficiently).
My question is: ... |
I have a bipartite graph made of two sets (SET 1 and SET 2) and I want to determine how many vertices from the SET 1 I can remove while still having
every vertex of the SET 2 connected to at least one vertex of the SET 1.
In this example, E and F can obviously be removed as D and C are connected 5 and 6.
But we could... |
I don't get how to intuitively come up with an example for an ambiguous grammar.
Let's take as an example this grammar:
Declaration ::= Type D ;
Type ::= "int" | "char"
D ::= "*" D
| D "[" number "]"
| D "(" Type ")"
| "(" D ")"
| name
I am told out... |
Imagine we have a set of numbers $\{x_1,x_2,\dots,x_m\}$. We want to compute the different ways to make a big number $P$ by those small numbers.
For example, if $P = 5$ and we have $\{1,2,3,4,5\}$ we can make $P$ by:
1+1+1+1+1 or
2+3 or
1+4 or ...
|
Let $T$ be a labeled tree with vertices $V = \{1, \dots, n\}$ and edges $E$. Define the length of an edge $e = \{ u, v \}, u \in V, v \in V$ to be $l(e) = |u - v|$, i.e. the distance between the nodes in the linear arrangement of the tree. Let the length sequence $L$ of $T$ be the sorted sequence of lengths of all the ... |
You all may know that simple Matrix Multiplication algorithm:
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
for(k = 0; k < n; k++)
C[i,j] += A[i,k] * B[k,j]
end for
end for
end for
When we want to parallelize it, we can, at first, parallelize the outer loop,
which is the most easiest thing ... |
I've got a question. How can i simulate Turing machine with a double-sided infinite tape by a Turing machine with one-sided infinite tape? The condition is, that the simulation of one step of the first machine must be equal to O(1) steps of second machine. Do you have any idea, how to do this?
|
Consider propositional logic over the connectives $\land$, $\lor$, and $\lnot$. Notation: $| \alpha |$ is the length of formula $\alpha$.
We are given a formula $\phi$. Cancel all cancellable negations in $\phi$ by applying all possible valid biconditionals (EDIT: such as the examples below) to get $\phi'$; for clarity... |
I understand that an NP-hard problem is a problem X such that any problem in NP can be reduced to X in polynomial time.
Does there exist a problem that is hard to solve but problems in NP cannot be reduced to it in polynomial time i.e. it does not satisfy the definition of NP-hard but is strictly not in NP? If not, wh... |
To illustrate my confusion let's say I'm given this unambiguous grammar in BNF:
S ::= T O x
T ::= empty
T ::= "if" E "then" T x "else" T
O ::= empty
O ::= "if" E "then" T O
Here is the corresponding derivation tree:
S
... |
I'm following the slides at https://homepage.cs.uiowa.edu/~tinelli/talks/FT-11.pdf where Tinelli explains how k-induction works in the context of SMT based model checking.
A parametric and resettable counter is given as a Kripke structure by the following formulas:
Variables:
$x := (c, n, r, n_0)$, where:
$n_0$ is a... |
I know that the hitting problem is NP hard, but is it possible to find the magnitude of the smallest set? Also, provide the runtime.
|
So, in quantum computing, each qbit has a 50/50 chance of being in either the state of 1 or 0 when you measure it. Simple enough.
But I've heard reports a while ago about some company having successfully added two relatively small numbers and gotten out the right answer the majority of the time. The question I am tryin... |
I read a statement which says
Almost all non-embedded processors, and many embedded processors, support virtual memory
Anyone who can explain the difference between both types
|
I have been studying Introduction to Theory of Computation by Micheal Sipser and I just complected it. Now I want to take this a step further what should I do next to increase my skills. I tried looking at some papers from FOCS but they were beyond my understanding. I want to know what should I study next.
|
So, I know that a normal r-b tree has a height of O(logn). What would happen is we let a red node have a red child if its parent is black?
Would the height still be O(logn)? Would you have to have a totally different insertion scheme to maintain the height?
|
This is a question from CLRS book. (Chapter 32, string matching, the question is the problem for the whole chapter, it's in the end of the chapter)
Let $y^i$ denote the concatenation of string y with itself $i$ times. For example,
$(ab)^{3}$ = $ababab$. We say that a string $x\in X$ has repetition factor $r$ if x =... |
So, we use Cantor's diagonalization argument to prove that the Universal Turing Machine is not a decider.
I understand the overall argument but have a problem regarding one caveat mentioned in my book.
My book says that some real numbers like 2.000... and 1.999... have different decimal representations but are actually... |
So i was reading a post on Minimum pumping length of regular language where Yuval Filmus has proved that a pumping lemma might have lesser number of states than a minimal DFA. But What about NFA's? Are NFA's able to give us minimum pumping length?
For example say we have a language L= $(10)^∗$, though for this minimal ... |
How can i write instruction in Main memory with using Machine language? I have a problem with righting instruction to store the bit pattern in the register R with value XY. Can anybody solve it?
|
I’m trying to understand the task performed by Google’s Sycamore that recently achieved alleged Quantum Supremacy. I’ve read the paper in Nature but the actual task that would have taken 10,000 years to compete is over my head. Is anyone able to explain it in simpler terms?
|
I am trying to find out how they calculated the time complexity of this small function .
I am studying for an exam and found this question and the final answer is given, but I am trying to understand how they got to this answer,
I tried solving this problem using Iterative but when I tried to find the number of Iterat... |
From what I see online, all seem to suggest that heapifying takes $\mathcal O (n)$ time, but it seems like it should always takes $\theta(n)$ time, even in the best case. Is something wrong with my pseudocode? Is there a more optimized way to do heapification?
Heapification(H[1...n])
for i <- floor(n/2) downto 1 do
k... |
Suppose that a problem $P$ is known to be NP-hard.
The input to the problem is a set of $k$ lines in 2D, a set of $n$ points, and $m < n$ pairwise distances among the points.
The goal is to place each point on one of $k$ lines, satisfying the given pairwise distances.
Disclaimer This problem might not be an NP-hard pro... |
Given an array with some elements in which elements can occurs multiple
times, so now how to arrange them in such order that no two same elements are together using minimum number of swaps.( it may not be possible to arrange all of them.)
|
I given the following code to write as AST:
{
a = 4;
while (a<10)
if (a<5)
a = a+5;
else
a = a+3;
}
Looking up the solution:
PROG
|
SEQ
_______________/ \_______________
SEQ ... |
Since duration of an instruction is just the number of cpu cycles needed times the time of a cycle, which is the inverse of the frequency, I do not get why the ratio of cpu benchmark of a two processors of a same trademark is not exactly the inerse of the ratio of the frequencies. Cpu is supposed not to loose time by b... |
I'm going over the paper Spatial Transformer Networks (link). On section 3.3 they introduce bilinear sampling kernel (Eq. 5)
$$
V_{i}^{c}=\sum_{n}^{H} \sum_{m}^{W} U_{n m}^{c} \max \left(0,1-\left|x_{i}^{s}-m\right|\right) \max \left(0,1-\left|y_{i}^{s}-n\right|\right),
$$
and it's partial derivative (Eq. 6)
$$
\frac{... |
I've been tasked with hashing arbitrary types in C++, with the caveat that A == B implies hash(A) == hash(B) even if equality of A and B is determined by a custom equality function ==.
For simplicity we can assume that == is an equivalence relation.
For example, the expected behavior of the hash function on std::vecto... |
For a job several years ago I worked with a team using technologies built around Virtual Finite State Machine models for system fault analysis and remediation. Since then, I've found it to be a generally useful approach for making control decisions in instances when control logic gets complicated and/or needs to be fac... |
Let $p_1, ..., p_n$ distinct prime numbers with $P = \prod_{i=1}^{n}{p_i}$ and $A=(a_1, ..., a_n)$ with $a_i = P/p_i$.
Problem
Show the SUBSET SUM problem $(A, \alpha)$ can be solved in polynomial (not pseudo-polynomial) time for every $\alpha \in \mathbb{N}$ and $P, p_1, ... , p_n$ unknown.
First attempts
$P$ and $ p_... |
Is every language accepted by a BAFDA regular? I am not even sure what the answer is. I tried thinking around canonical examples of non-regular languages (like $0^n1^n$ or $\{ww | w \in \{0,1\}^{*}\}$ provable by Myhill-Nerode or by the Pumping Lemma) but cannot think of a suitable BAFDA for any of them.
Update: I tri... |
Given a sorted array of numbers, is there a good algorithm for finding two numbers in that array whose product is as close as possible to a given number N?
I know that there is a good O(n) (?) algorithm for the related problem of finding two numbers that sum to a given number N. You begin with ptr1 at the start of the ... |
I was learning about polymorphic types but I couldn't understand the notation, can someone explain it means (context cs421 UIUC):
$$ \forall \alpha_1, \dots , \alpha_n . \tau $$
its supposed to be a type but I have no idea what it's suppose to mean.
Perhaps writing some of my thoughts or questions might be helpful in c... |
I am trying to figure out how $(x/y)$ in floating point arithmetic
$fl(fl(x) / fl(y))$ where $fl(x) = x(1-\delta_1)$, $fl(y) = y(1-\delta_2)$, $fl = (1-\delta_3)$
I have:
$= x/y \cdot ((1-\delta_1)/(1-\delta_2))(1-\delta_3)$
after arithmetic
$= x/y \cdot (\delta_3 \delta_1 - \delta_1 - \delta_3 + 1)/(1-\delta_2)$
Not s... |
Reasoner is forward chaining inference engine (https://en.wikipedia.org/wiki/Semantic_reasoner) as opposite to Prolog backward chaining SAT solver (for queries). Why there is reasoner for description logics and not for other logics?
|
What is the difference between $O$ (big oh) and $o$ (small oh) notations in asymptotic analysis? Even though I understand that $o$ is used for a bound that is not tight, is it allowed to use $O$ notaion for a bound that is also not tight? For example can I say that $5n=O(n^3)$?
I am also confused by what this statement... |
I am trying to find the fastest algorithm to find all the possible paths of length $N$ from a given node in a directed graph.
My solution is to do a modification of breadth first search from the given node for $N$ iteration. Its time complexity is around $\theta(V+E)$. But the problem is $|V|$ & $|E|$ becomes exponent... |
$L = \{\langle M, k\rangle : M\;\text{is a Turing Machine and } |\{w \in L(M) : w \in a^*b^*\}|
\geq k \}$
My Interpretation of language is that $L$ is a language which contains Turing machine whose language contains string greater than equal to $k$ and also strings belong to $a^* b ^*$.
My Analysis : Using Rice's... |
I asked this question on Stack Overflow, but I have not obtained an actual answer to the question.
Tarjan's strongly connected components algorithm is stunningly beautiful, and inexpressible in a literal way in any programming language that I know of.
Allow me to refer to the pseudocode in the Wikipedia article. The p... |
If we are using numbers and letters, there are $36^{10}$ unique combinations. Collision is already unlikely, but I need it to be impossible, so using hashing is out of the picture(?).
The use-case is users redeeming each one if they have been "activated" as redeemable. Think like Webkinz codes.
An inefficient solution ... |
I was studying polymorphic types and I was finding the distinction with monomorphic types difficult to pin down (context CS 421). From the course I linked the have the following (vague attempt) at a definition:
Monomorphic Types ($\tau$):
Basic Types: $int,bool,float,string,unit, \dots$
Type types: $\alpha, \be... |
I need to find the time complexity described by the following recurrence relation.
$T(n) = T(n/2) + T(n/3) + T(n/6) + n$
$T(1) = \Theta(1)$
The solution must be something like $T(n) = \Theta(f(n))$.
Obviously the standard form of the master theorem can't help me and any other special cases that I have found weren't use... |
I'm new to information theory and I am struggling to understand this problem. Let $p(x,y)$ given by:
How can we calculate $H(X|Y)$? I know $H(X|Y)=H(X|Y=0)+H(X|Y=1)$ but then I don't know how to go further.
|
Suppose I have the following set of bit sets:
[1,] 0 1 1 1 0 1 0 1 0 0
[2,] 1 0 1 1 0 0 0 1 0 1
[3,] 0 0 1 0 1 1 0 1 1 0
[4,] 1 0 1 0 0 0 0 1 1 1
[5,] 0 1 0 1 0 1 0 1 ... |
I am working on an interesting problem, which I believe can be solved algorithmically. I have a 6x8 on which I am attempting to arrange 48 color swatches, such that the transition from each swatch to its neighbor is as smooth as possible.
I can compute perceptual color differences using LAB-space encoding, so it is sim... |
Are type variables really only used in mathematical conversation about types? i.e. are type variables (meta-variables that only contain the type classification label) only exist in proofs for types but not in real programming languages? At least is this true for monomorphic types? i.e. I can't actually define:
$$ \text... |
Suppose we have $L$ being a context-free language. Let $L'=\{x \in \Sigma^* | xx^R \in L \}$, is $L'$ context-free as well? I know that if $L$ is regular then $L'$ is regular as well by constructing a DFA. Is it possible to create a PDA here as well? I am stuck on this or even if there is a counter example?
|
Consider the following (Context-Free) Grammars with only one production rule (not including the epsilon production):
$S \rightarrow aSb\;|\;\epsilon$
$\require{cancel} \cancel{S \rightarrow aSSb\;|\;\epsilon}$
$S \rightarrow aSbS\;|\;\epsilon$
$S \rightarrow aSaSb\;|\;\epsilon$
$S \rightarrow aaSaaSbb\;|\;\epsilon$
$S... |
Suppose we want to design a pushdown automata for $L=\{x \in \{a,b \}^{*}:|x|_a<2|x|_b \}$, can anyone check whether my automata works?
we have 4 states $\{q_0,q_1,q_2,q_3 \}$, three stack symbols $\{S,A,B \}$, start state $q_0$, accept state $q_3$, we have rules as following:
$q_0$ accepts nothing and push $S$ onto st... |
I don't know if it's allowed to traverse nodes in a min-heap.
Because, if traversal is allowed then for finding $7^{th}$ smallest element, only a constant number of nodes need to be checked, thus giving the complexity of $\Theta(1)$.
But if traversing is not allowed, then for finding $7^{th}$ smallest element, I'll nee... |
Given a context-free grammar and a maximum depth, how do I directly compute the Nth sentence without calculating or caching intermediary sentences?
Take as an example the following grammar:
(from http://www.nltk.org/howto/generate.html)
S -> NP VP
NP -> Det N
PP -> P NP
VP -> 'slept'
VP -> 'saw' NP
VP -> 'walked' PP
De... |
I am trying to create a context free grammar in Extended Backus–Naur form, which starts with a non-empty sequence of a's and is followed by a non-empty sequence of b's. With the special condition that the number of b's has to be unequal to the number of a's.
Thus, the grammar should generate words like:
aaaabbb
aaabb
... |
There are $n$ items with weights $w_1,\ldots,w_n$ and values $v_1,\ldots,v_n$. There is a knapsack with capacity $W$. A subset of items is called feasible up to heaviest item if, once the heaviest item is removed from the subset, the weight of the remaining set is at most $W$. The knapsack up to heaviest item problem i... |
Given a constant $n\in\mathbb{N}_+$, is the simple power function
$$
λ\,x\in\mathbb{N}_+.\,x^n
$$
logspace computable by a logspace transducer (which has a read-only input tape, a working read-write tape (on which the transducer is allowed to use $\mathcal{O}(\log (\text{input size}))$) cells, and a write-only output t... |
Let's assume I am trying to find a hidden treasure.
The treasure is hidden at an uknown position x. We know that the position x of the treasure is somewhere on the integer axis (in other words x is an integer). In order to find the treasure I have to take with me a detector. The detector can spot the treasure only if ... |
For example, given rules $\{ a \to x, a \to y \}$ and input $aa$ , I am usually allowed to derive strings $\{ xx, xy, yx, yy \}$. I would like to restrict this to only performing "consistent" rewrites, so that the language would be like $\{ xx, yy \}$. It is evidently possible to synchronize rewrites in distant parts o... |
How can I show that any binary search tree can be balanced with at most O(n log n) rotations (“balanced” here means that the lengths of any two paths from root to leaf differ by at most 1).
|
Are there some examples of simple or common problems which have (in a practical sense) quadratic complexity? I would have thought there were a lot of them, but upon further investigation, I can't seem to find any. (see https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations)
Bubble sort / ins... |
Would it be possible/legal to design a PDA that can use the stack as a way to keep track of the number of inputs seen? (i.e the size of the stack would act as some sort of counter).
What I was thinking:
First transition would require you to push a "1" to the stack
All future transitions would require you to pop the to... |
In one of my exercise sheets I have the following question;
Let $f,g\colon \mathbb{N}\longrightarrow\mathbb{R}$ be positive functions with $f(n) \in O(g(n))$. Prove or disprove; $\ln(f(n)) \in O(\ln(g(n))$.
I first thought this would be the case since $\ln$ is a monotonically increasing function (derivative is positiv... |
According to the nlab article about evaluation map if $X, Y \in C$, a closed monodical category then the adjunct to evaluation morphism $[X, Y]\otimes X \rightarrow Y$ is the identity morphism $[X, Y] \rightarrow [X, Y]$.
Is that correct and if yes why?
Because it seems to me that the adjunct of such has to be $X \righ... |
I am studying over my notes, and there is something I don't understand about $e_m$. We represent the floating point numbers as $1.d_1d_2...d_t \times \beta^e$. Now, my professor defines $\epsilon_m$ as the smallest $x$ such that $fl(1+x) > 1$. But then she writes
$$\epsilon_m = \beta^{1-t} \hspace{1cm} \text{ (for ... |
Prove that $n\log{n} − n$ is $\Omega(n)$.
I do know the answer:
$\log{n} ≥ 2, \forall n \ge 4$.
Thus, $n\log{n}−n\ge n ,\forall n\ge 4 \implies n \log n − n ∈ Ω(n)$.
But can someone please explain how its done. where did $2$, $\forall n$ and $4$ came from.
Then how was $n, \forall n \ge 4$ added.
|
Game Explanation: Suppose there is a game with cards that have numbers from 1 to n. Each card has a different number so there are not two cards with the same number. The deck is scrambled. We chose one card from the deck and we create a stack. Then when we chose the next if the card is a number lower than the top of th... |
Problem Link - Assign .This problem is known as assignment problem.
I read few solutions Here is one and they are trying to solve it using Bit-masking and DP .I tried and thought hard to understand how to solve it but i was unsuccessful ..
|
I came across the following problem. Given a set of $n$ positive integers $A$ and an integer $k$. Let $S$ be the set of integers that are the sum of $k$ distinct integers in $A$. Mathematically speaking
$$S = \{s ; \text{ there exists } P \in {A\choose k} \text{ such that } s = \sum_{a \in P} a\}.$$
The object of the ... |
Why is the threshold for detecting errors $2d+1$?
I am aware that the question has been asked before, for example here, but the answers provided didn't really justify why the formula contains $+1$.
So why is there $+1$ in the equation?
|
Let the language be : $$ L = \{ w \in \{a,b\}^* : \#_a(w) = \#_b(w)\}. $$
Now the PDA that I've designed for this language and seen at many other places is :
Let the PDA be denoted by M such that,
M = ({q0,q1}, {a,b}, {z0, a,b}, q0, delta, z0, q1)
Transitions for accepting L:
delta(q0, a, z0) = (q0, az0)
delta(q0, a,... |
In the simply typed lambda-calculus, I was told that behavioral equivalence is taken in terms of divergence because "divergence is the only side-effect of such language".
How should I understand this quotation? What does it mean that divergence is a side-effect? Perhaps that it is a phenomenon that is not directly enc... |
If Mantissa is a 1-dot-M fixed-point number whose most significant bit is always 1 then, how is the least significant bit calculated?
I know the least and most significant bit of the mantissa results in the following range:
1.0 <_ Mantissa <_ (2.0 - 1/2^M)
But specifically, I don't understand where the 2 comes from.
|
So I am currently thinking about a problem with a friend that deals with classifying a huge list of statements (I cannot give more information for privacy reasons). My friend ran a K-means clustering algorithm on it and there seem to be groupings. I wanted to do a supervised approach but unfortunately, there always see... |
I am doing a project in analysis of algorithm and I have been looking all over for something more complex than Perlin Noise is $O(n \cdot 2^n)$ because of the doubling in $n$ dimensions and array operations. Anyone know where there is more information? I have another month before our group gives the presentation.
|
I’ll preface this question by saying I’m having a difficult time even formulating the problem, so my explanation might be fuzzy and/or I might be missing obvious solutions.
I have a list of 479 books which I would like to sort based on a “Fuzzy” criterion such as “which books would I like to read before the others in t... |
I have an algorithm which depends on three variables an where the running time is in $\mathcal{O}(m+2 m\cdot n\cdot p+p\cdot(n+m))$ and I would like to simplified it. I proceeded as follows :
\begin{eqnarray}
\mathcal{O}(3m+2 m\cdot n\cdot p+p\cdot(n+m)) &=& \mathcal{O}(m\cdot(3+2n\cdot p)+p\cdot(n+m))\\
... |
I was trying to approach this proof, after multiple reads and attempts I am getting nowhere. If someone could help me out that would be great. Should I use the pumping lemma, if so how show I start, what word should I choose? Or should I use closure-properties and if so what irregularity should I show? I am genuinely s... |
Integer matrix multiplication with its transpose (A^T)A gives symmetric matrix, so, only one half of it should be computed. Besides, the formula for the resulting element rik=Sum[aijajk, j] reduces to the simple sum of the multiplication of the the corresponding elements from two columns rik=Sum[ajiajk, j]. As I unders... |
I would like to express $(\sqrt{n})!$ in terms of $Θ()$ notation.
My approach is the following:
$$(\sqrt{n})!=f(n)\Leftrightarrow$$
$$\log(\sqrt{n})!=\log(f(n))$$
Now from Stirling's approximation we get: $$Θ(\sqrt{n}\log(\sqrt{n})=\log(f(n))\Leftrightarrow$$
$$f(n)=Θ(\sqrt{n}^{\sqrt{n}})$$
So, $$(\sqrt{n})!=Θ(\sqrt{n}... |
I am an old Pythonista now learning C and how various data structures and types are implemented, such as binary trees and hash tables. Learning about the latter, leads me understand that the hash function servers the purpose of computing from the key the index in the array where the value is stored. I have also learned... |
According to the Wikipedia entry, a systematic code is one
in which the input data is embedded in the encoded output. Conversely, in a non-systematic code the output does not contain the input symbols.
Further down on the same page, it says:
For a systematic linear code, the generator matrix, $G$, can always be writ... |
PDF here shows a way to proof GI is NP-Complete $\implies \Sigma_2 = \Pi_2$.
In the last step, it writes following:
In other words, (1) is false in this case as required.
Book Computational Complexity also follows the same way and supplies the $\mathrm{\Sigma_2}$ formula:
$\exists{r \in \{0,1\}^m}\forall{x \in \{0,1\... |
Reading discussions of the recent quantum supremacy experiment by Google I noticed that a lot of time and effort (in the experiment itself, but also in the excellent blog posts by Scott Aaronson and others explaining the results) is spent on verifying that the quantum computer did indeed compute the thing we believe it... |
I have a basic understanding of knowledge representation systems, semantic networks and ontologies. But I can not relate my understanding to the reasoning.
How the reasoning is applied on ontologies and semantic networks?
|
During a technical interview I was asked about ways to make sure code/software design is functional before deploying to any servers and the only thing I could think of was unit testing. My interviewer pressed me for other ways but I couldn't come up with any alternatives.
|
On an array of $n = 2^k$ numbers, where $k$ is a non-negative integer, the $k = \log n$ order statistics $1, 2, 4, 8,\ldots, 2^k$ can all be determined in a total of $Θ(n)$ time in the worst case.
I think that this statement is wrong because the loop will take $k$ iterations. So, the time should be $Θ(\log(n))$. But,... |
I develop an application that makes extensive use of sparse matrix operations.
Recently, I found out that scipy takes a lot of time checking matrix sizes and what not, up to the point that the checks take more time than the actual operations. See the posted issue with some metrics here.
So I decided to start the dubiou... |
So I recently rediscovered simulated annealing through a path that others seem to be well aware of. I was aware of Metropolis-Hastings as a sampling algorithm that creates a Markov-Chain whose stationary distribution is the distribution produced by normalizing some function. It's a small leap to realize that you can us... |
I'm dividing up an animation project among 20 students. The whole film is 4955 frames long, so each student should have as close to 248 frames as possible. However, the scenes have an unequal number of frames that cannot be changed, and each student must have a whole scene (nobody can have .45 of a scene.) What is the ... |
I was doing some reseach and I came across a website that had listed 16 different boolean logic operators. I was wondering if all of them were real, and if so, what do they do.
https://www.researchgate.net/figure/Method-for-implementing-all-16-Boolean-logic-functions-in-a-single-MR-unit-with-a_fig1_303770111
|
I have an online problem and I want to prove that no deterministic online algorithm is competitive.
Let $\texttt{ON}$ be an online algorithm and $\texttt{OPT}$ an optimal offline algorithm (an adversary). Given a sequence of $n$ inputs $\sigma=\sigma_1\sigma_2\cdots\sigma_n$ revealed in an online fashion, let $v(\text... |
I'm reading Algorithm Design by Jon Kleinberg. In section 3.6, in order to compute the topological ordering of a DAG, one first finds a root node in this DAG, then deletes it from the DAG. The author claimed that this can be done in $O(n)$.
How should I understand this time complexity? Just because we traverse all nod... |
I am trying to find an OS that had a network to verify it's users. It classified itself in classes going from greatest signifigance to least, and the names were galaxy, system, planet, comet etc.
I can not find the name of this OS or protocol for the life of me.
|
With a stack, you can push and you can pop. There's also a generalization, let's call it a foo, in which key-value pairs are involved. The idea is that instead of just pushing a value, we push a key-value pair, as in L.push(key, value). Similarly, to pop a value, we have to supple a key. As in L.pop(key).
A straightfor... |
In many algorithms, one can spot that improvements in time often are occupied by more memory requirements. For example usage of cache allows to speed up calculations by saving results in memory.
Is there any theoretical limit of "time-space tradeoff" similar to Amdahl's law limiting speed-up from the parallelization of... |
I am writing a software as small project in TypeScript/JavaScript and got to a problem i cant solve:
A Company makes a new contract with a customer and wants to order materials. There are serval suppliers with fix delivery costs. Each supplier can offer some of the materials with different pack sizes and prices. What ... |
I wonder if the complexity is connected to an optimization problem. In general but also specifically e.g. when having a look at $ O(n^2) $. Does this just describe the complexity in general or does it also mean does the underlying algorithm has to be a nonlinear optimization problem? Or is it also valid for linear task... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.