instruction stringlengths 35 11.4k |
|---|
I currently have a deck of cards (in fact this deck is an array of sorted elements in descending order as indicated by the picture above), that I want to shuffle. However, the caveat is that I want the card near the top of the deck to be shuffled to a new position relatively close to the top, while a card near the bot... |
I'm looking for a generic static analysis framework that could be used to detect problems that aren't necessarily specific to a particular programming language; for example:
Variable taint checking / unvalidated user input
Detecting when a variable is unused
Detecting when an identifier shadows another identifier in t... |
Given variables {A, B, ,,,,,Z}
We want to sort these varibles according to given constraints.
The constrains are in below format:
X Y Z
meaning the third variable (Z) is not in the range between first and second variables (X, Y)
X > Y or X > Y, we don't know. and Z can be greater than both X and Y or smaller t... |
Given the program:
{y=y0 ^ y>=0}
z=0;
while (y>0){
z=z+x; (1)
y=y-1;
}
{z=x*y0}
I am having trouble finding the invariant, I've tried:
z=xy-xy
z<=xy
z=0xy
with/without the precondition as the invariant, but none of my attempts can be used to prove the post-condition. Any help would... |
(Proposition, pg 26): Let ${x_1, \ldots, x_N}$ be $N$ points on $\mathbb{R}$, $N \in \mathbb{Z}$, labelled either $+1$ or $-1$ , then there exists a function from the set $\{t \mapsto \sin(\omega t)| \omega \in \mathbb{R}\}$ that separates these points into two sets, one with all labels ${+1}$, and one with all labels ... |
I would like to determine the time complexity of this function, in $\mathcal{O}$-Notation.
def g(x):
if x == 0:
return 1
elif x == 1:
return 2
else:
x_div = x//2 # // is integer division
x_mod = x % 2
return g(x_div)*g(x_mod)
Because it's recursive, I think it's $\ma... |
Reading an article (arXiv) about the Firefly optimization algorithm, it is stated that the objective function is called only once per firefly per iteration, but following both the pseudo-code in the article and some implementations I found online I do not understand why this is the case..
As I understand the following ... |
I was reading CFG's and PDA's. I need to understand one basic point in that.I have solved some questions on final state acceptance by PDA.But in every answer,the string always end with epsilon(means that there is always a transition when string ends which by reading epsilon takes to final state and mostly it invloves c... |
I've recently started independently learning type theory, using a combination of papers found online and ncatlab.org (but have not worked with category theory), and am about to start reading TAPL.
I'm interested in understanding how recursive types can be substituted for inductive types in dependent type theory (we ass... |
I'm reading McCarthy's paper Recursive Functions of Symbolic Expressions And Their Computation by Machine, where when the author describes the machine implementation of lists, he writes this:
a. Representation of S-Expressions by List Structure. A list structure is a collection of computer words arranged as in figure ... |
I'm working through some exercises in Robert Harper's "Practical Foundations for Programming Languages" and I'm not certain I understand what makes an occurrence of a type operator non-negative or negative in the general case.
I understand that positive type operators occur in the range of a function type, and that neg... |
Consider this version of the algorithm, for only 2 processes, 0 and 1:
Initially flag[i]=false
1. flag[i] := true
2. while flag[1-i] do{
2.1. if turn = 1-i then{
2.1.1. flag[i] := false
2.1.2. await turn=i
2.1.3. flag[i] := true } }
3. Critical Section
4. turn := 1-i
5. flag[i] := false
I b... |
Given a simple polygon $P$ and a point $p$ within the polygon, I want to compute the region in $P$ consisting of all points $q$ visible from point $p$. A point $q$ is visible from point $p$, if the line segment $\overline{qp}$ is completely in the polygon $P$.
As for now, let's ignore the case where a line segment lies... |
Suppose to have $n$ independent events $E_1, E_2,..., E_n$, where the probability of occurrence of event $E_i$ is $p_i$ (i.e., each event has its own probability of occurrence). We can easily define new events of type $N_k\equiv$"exactly $k$ events occur".
The probability of event $N_k$ can be computed as
$$\Pr(N_k) =... |
I'm trying to construct a recursively enumerable TM for this language. (Useless state: one that is never entered during a computation on any input).
The TM L:
Write out all of M's states, generate input in lexicographical order one at a time, and after one is generated, simulate M on the input and mark down which stat... |
I have ~4000 variables that are used in ~5000 logical formulas, where each formula consists only of conjunctions of the (non-negated) variables. I want to find the maximum number of satisfied formulas, given the number of variables that I can set to 1.
Does this problem have a name? Is it equivalent to the MAX-SAT prob... |
I found this problem to be similar to the problem of Finding least number of line segments with length L that cover N points.
The problem is:
Given N points on a circle, find the best positions of fixed size circular segments that cover all those points so that the number of circular segments is minimal.
I think tha... |
I'm a bit confused about the dovetailing concept. It seems too powerful. Could it solve non-recursively enumerable languages?
|
If you already have an approximation algorithm in hand, it's usually easier to prove that it is an α-approximation algorithm by merely analyzing the algorithm, than designing an approximation algorithm to achieve a α-approximation. That being said, what procedure or intuition should I have in mind to design a α-approxi... |
Imaging I am running a forum and I continuously have log in of members. A member can log in simultaneously many times
So I have :
Tom Jerry Jack Tom Joe Kay Neo Tom ...
each log in comes with a time stamp
I want to have an algorithm that can count how many UNIQUE names have logged in the past 1 minute.
How to design a... |
Let's say we have N people, each of them holds several colored cards (for each color and person pair the number cards held is no more than one). We want algorithm determine how to take exactly one card from each person (denote this set of taken cards S), so the following function would be maximal: number of colors sati... |
The feasible region of a Linear Program (LP) is $\{x \in {\bf R}^n: Ax \le b, x\ge 0 \}$. This is an intersection of halfspaces, a polyhedron. If the LP is bounded and feasible, its optimal value will be attained on some face of the polyhedron, typically a vertex. A vertex is a point determined by the intersection of ... |
If we can insert to a Fibonacci Heap in O(1), and increase-key and find-min in the same W.C time complexity, then why can't we sort an array in time complexity O(n)?
Given an array with n elements:
Find the maximum of the array (largest key) in O(n).
Build a Fibonacci Heap of the elements in O(n), emptying the array ... |
What i came up with is this
1) inner loop goes to 2n and at each. step it increments n/3 times threfore 2log n times it will execute
2) outer goes to n incrementing by 1 threfore n times
Hence for each value of outer loop innner executes n* 2log n times...
Threfore O(n*2logn)
Que 1) Is this correct
Que2) If it i... |
First, for the sake of notation, suppose a finite set A, where A is a set of real numbers. Then the function f(A) is defined as the sum of all the elements in A. Then here's the following problem.
I have a set X = {x_1, x_2, ..., x_n}, where x_i is a real number in (0,1], and I want to partition X into C_1, C_2, ....,... |
I have a Turing machine M and I have to answer the question are there infinitely many Turing machines that recognize L(M)? I also need to describe a Turing machine that solves this problem. My idea is to say that we can simply increase the number of states by adding a new unreachable state. Each time I add a new state,... |
Given a simple polygon $P$ and a point $p$ within the polygon, I want to compute the vertices of $P$ visible from point $p$. A point $q$ is visible from point $p$, if the line segment $\overline{qp}$ is completely in the polygon $P$.
One can use the accepted answer here to compute visible vertices in $P$ from a point $... |
There are n values given. Is there a possibility to have two Arrays A and B each containing elements from the given values such that the sum of all elements of A minus the sum of all elements of B gives the searched value? Each value can be used twice, but not twice in the same subset, so once in A and once in B at mos... |
Computing edit distance (shortest sequence of edit operations) on ordered trees is a well studied problem with many known algorithms (e.g. Zhang & Shasha, RTED). There is also considerable literature on edit distance for general graph (e.g., this review). I am however interested in a mixed case that has arisen in our i... |
I just drew this graph completely random:
I found the shortest path (marked in red) by simply checking everything. But the reason was to use Dijkstra's algorithm. But when I try I get stuck in a loop. Lake a look at my calculations:
How to read it is:
Top Row: Wich node
Section t: Total distance traveled
From: Wich... |
I searched on the net the different measures of text similarity. And I found many algorithms concerning this issue and there are classified into many categories such:
Token-Based Measure: Tf-idf, Euclidean, Manhattan, overlap coefficient, matching coefficient, cosine, etc.
Character-based: Levenshtein, Hamming, Jaro-W... |
I have arrays $a_1...a_n$ each containing $m$ values inside. I want to select one value from each array. Let us say the selected values from each array are represented with $x_1...x_n$ and the distance amongst every selected pair of values as $d_{ij}$ (distance is simply how far the indices in the arrays are for every ... |
Please can someone explain how Levenshtein edit distance works?
I've stepped through the algorithm in code and in excel, but I don't understand how this actually succeeds in finding an edit distance.
Specifically, I don't understand how these algorithms are able to find the number of substitutions, deletions, and inser... |
For the number 6, if I need to represent it in 5421 code form, should I code it as
1001 or 0110? Why should I choose the one over the other?
Similarly for the number 5 in 2421, is it 1011 or 0101?
Edit 1:
In a weighted binary code, the name of the code indicates the weight assigned to each place.
So if the code is 842... |
Let the Post Correspondence problem with input
$$K = ((x_1, y_1), . . . ,(x_n, y_n)), x_i, y_i ∈ \Sigma^*$$
for $$ i = 1, . . . , n $$
Find a concrete solution for the input
$$K = ((001,0), (01, 011),(01, 101),(10, 001))$$
The Post Correspondence problem is undecidable so it's really hard to find a concrete solution.... |
T = (BD + A'BC'+A'CD)
How can i draw this by only using NOR-Gates? This is what i have done so far:
https://i.stack.imgur.com/nIujl.jpg
Have I understood this right?
|
Given a set $S$ and some symmetric distance function $d(i, j)$ defined over the elements of $S$, we must maintain the closest pair of elements (i.e., $(c_1, c_2) \mid d(c_1, c_2) \leq d(i, j) \forall i,j \in S$) subject to insertions and deletions to $S$. Further, we can assume that the possible elements to be inserted... |
How can i draw a general resource graph which cannot be completely reduced but which is free from deadlock?
A general resource graph which can be completely reduced and hence is free from deadlock is shown below.
As depicted above, R1 and R2 are resources and P1 and P2 are processes.
|
Lot of mathematicians have made several efforts to answer the question : are mathematics consistent ? Although we haven't yet had a proof of consistency, and surely we will never (Gödel second theorem), does this question has an impact on computer science ? I mean, does the work of those mathematicians, like Gödel's th... |
I want to develop a previous answer to Is there a known maximum for how much a string of 0's and 1's can be compressed?.
I've looked at the Hutter Prize and various compression benchmarks. The compression records are graphed below over a 12 year period. The red curve is an exponential fit, which seems to be asympto... |
Hopefully this question is not a duplicate.
How do I show the problem below is decidable by describing a Turing machine?
Input: Turing machine M
Question: Are there infinitely many Turing machines that all recognize L(M)?
I know a language is decidable if there exists a Turing machine that halts on all inputs when runn... |
We say a negligible function is a function $\epsilon(n):\mathbb{N}\rightarrow \mathbb{R}$ such that for every positive integer $c$ there exists an integer $N_c$ such that for all $n > N_c$,
$$\epsilon(n)<\frac{1}{n^c}$$
(From wikipedia)
Assume that two probabilistic polynomial-time algorithms $O_{1},O_{2}$ satisfy tha... |
Suppose $M=(Q,\Sigma,\delta,q_0,F)$ is a deterministic finite automaton, and suppose there exists a state $q \in Q$, a string $z \in \Sigma$, and integers $i,j>0$ such that $\delta(q,z^i)=\delta(q,z^j)=q$. Prove that $\delta(q,z^{gcd(i,j)})=q$
I can intuitively say that starting from a state $q$ if you take $x$ steps o... |
Let $G$ be a finite state automaton (FSA) with transfer function $\delta(\cdot,\cdot)$ and initial state $q_0$. Suppose also $\Sigma_{G}$ represents its alphabet. Assume that its closed behavior is a set of strings defined as:
$L(G) := \{s \in \Sigma_{G}|\delta(q_0,s) \text{ is defined in }G\}$
Now, consider two partic... |
Given a particular value x and an array A, I'd like some way to determine (without literally checking each possible combination) all of the combinations of numbers in A that sum to it.
Thanks to Jeff Erickson's wonderful algorithm notes, I can write an algorithm that efficiently determines if a sum exists, but I'm hav... |
We know that NEXP $\not\subset ACC^0$ (Ryan Williams'10 Result). Also, We know that even $\Sigma_{2}^{P}$ cannot have polynomial circuits of bounded degree i.e. $SIZE(n^k)$ for some $k \in N$ (Kannan's Result). Does this give a hint towards $ACC^0$ is far more powerful than polynomial circuits of bounded degree? Are th... |
In the introduction to algorithms proof of Dijkstra, I don't understand why the statement "both y and u were in V-S when u was chosen". We add x before y, and so we relax d[y] with the the edge $$\omega(<x,y>) + \delta(s,x)$$, d[u] can't be smaller than delta[u], so shouldn't y be in S when we add x to S? thanks.
|
I am trying to represent a fragment of a number hierarchy using the Haskell concepts of value, type, and type class. I would like the Haskell code to reflect the mathematical semantics $\vdash ((x \in \mathbb{N}) \land (\mathbb{N} \subset \mathbb{Z}\subset \mathbb{Q}) \Rightarrow (x \in \mathbb{Q}))$. In words, given ... |
Is there any example of any natural problem which is known to be in MA, but not yet to known to be in NP?
I am aware that Graph Nonisomorphism (GNI) is known to be in AM which is considered a superset of MA. Can we construct a language (which may be non-natural) which is in MA, but not in NP?
|
I solved this problem from codechef:
problem link
and now I want to change it a bit. Instead of find out the distance between node $u$ and $v$ I want to answer $k$ queries of the form: find node $u$ to which distance from node $v$ is maximum but I'm not able to see fast enough algorithm for it.
I think that heavy light... |
Let $A$ be the language consisting of descriptions of Turing machines $\{M_1, M_2, \dots \}$, where each $M_i$ is a decider. Prove that $A$ is not Turing-recognizable.
Then suppose $A$ is Turing-recognizable and suppose $s = \{s_1, s_2, \dots \}$ is a set of all possible binary strings. Then I construct decider $D$ as ... |
Assuming that an implementation of a sorting algorithm takes 0,01 seconds to sort 1000 elements, how long would it take to sort 100 million elements?
What do I need to know about my the algorithm to estimate the time? Is its time complexity given in $\mathcal{O}$-notation sufficient to find that out?
In my example the ... |
I have a task to find a number of 2-3 trees... I don't quite know what it means, I'm asked to: find the number of 2-3 trees of depth $4$?
Is there a specific way to find number of 2-3 trees of depth $n$?
Thanks!
|
According to Wikipedia
In computability theory, a machine that always halts—also called a decider (Sipser, 1996) or a total Turing machine (Kozen, 1997)—is a Turing machine that halts for every input.
My understanding of decider is that a machine is a decider if it always halts with output $0$ or $1$ (or whatever you... |
I am currently stuck on a question from Sipser's book of automata. The question goes like this:
Consider the following language: V = {w|w = 0a for some a which is an
element of HALT} U {w|w=1b for some b which is an element of
complement of HALT }
Prove that V is unrecognizable? Prove that complement of V is
unr... |
A literal is a nonzero integer, and we define $\sim x = -x$.
A clause is a nonempty set of literals.
A CNF is a set of clauses.
A K-rule is a pair $(F,C)$ where $F$ is a CNF and $C$ is a clause.
A Krom-style proof system (KPS) is a set of K-rules.
If $S$ is a KPS, then an $S$-proof of $C$ from $F$, or an $(S,F)$-proof ... |
Given a language $L \subset \{0, 1 \}^*\#\{0, 1 \}^*$ and a language $$L'=\{u \in \{0,1\}^* | \textrm{ There is a word }w \in \{0,1\}^* \text{, so } u\#w \in L\}$$
Prove or disprove:
If $L$ is recursively enumerable, then $L'$ is recursively enumerable.
If $L$ is recursive, then $L'$ is recursive.
My idea for 1:
Si... |
Let the language $L$ be as follow ;
$$L=\{\langle M_1 \rangle \langle M_2 \rangle \mid L(M_1) \cap L(M_2)=\emptyset \}$$
$\langle M_1 \rangle$ and $\langle M_2 \rangle$ are the encoding of the Turing machine $M_1$ and $ M_2$.
Using Reduction, I have to prove that $L$ is not recursively enumerable.
In order to pr... |
Process X
/* other code for process x*/
while (true) {
1) varP = true;
2) while (varQ == true)
{
/* Critical Section */
3) varP = false;
}
}
/* other code for process X */
Process Y
/* other code for process Y */
while (true)
{
1) varQ = true;
2) while (varP == true)
{
... |
How can I demonstrate that the computational model of rewriting is adequate? For example, with it, it is possible to compute any computable function.
|
I'm looking for an approach to solve a problem consisting of maximizing an objective function over a set of discrete elements, while respecting a set of constraints.
To illustrate my point, I'll try to come up with an example.
A bag contains several items with the following attributes:
Value (Int)
Size (Int)
Material ... |
The partition problem is: given a set of numbers, find a partition to two subsets in which the difference between the sums in each subset is minimized. This optimization problem is NP-hard. The simple exact algorithm - checking all the possible partitions - takes time $O(n 2^n)$. Is there a more efficient exact algorit... |
I've been given a homework problem to prove that determining whether a graph G has both a Hamilton cycle and a clique of size k is NP-complete.
Based on this question, I know an "easy" reduction exists from Hamiltonian path to Hamiltonian path & clique (or someone has said it exists), and I assume that the same is true... |
I need to find a method to sort an array in $O(m+n)$ time complexity.
I understand it should be a variation on Radix sort, however I am not familiar with it or its implementation...
Input: an array $A$ of length $n$, containing values from $-m$ to $m$
Output: a sorted array $A$
Any suggestions will be appreciated, th... |
One of the exercises I was given was to formulate Integer Linear Program (ILP) and relaxed version of it (LP) to solve the maximum weight independent set, and I need to find an integrality gap of my LP relaxation.
As far as my knowledge goes, integrality gap for maximization problem is the the maximum ratio cost(LP)/c... |
I need to find a method to sort an array in $O(n)$ time complexity.
I saw this link,
however I'm not sure how to apply it to the elements I need.
Input: an array $A$ of length $n$, containing values from $1$ to $n^2$
Output: a sorted array $A$
Can someone explain in pseudocode or in words how to do this?
|
Given a graph $G=(V,E)$, all the vertices $v \epsilon V$ are labeled with values from $\{1,2,...\ldots n\}$ where $|V| = n$ such that for all edges $(x,y) \epsilon E$ such that $|label(x) - label(y)| \ge 2$. We have to determine whether such a labeling is possible for a graph.
Now I have to prove that doing so is a NP-... |
In which phases of the compiler, is symbol table used and updated ?
According to me,
In lexical analysis, new entry for each variable is created in symbol table so symbol table is only updated
In syntax and semantic analysis, symbol table is just used to check the information about attributes during parse tree creatio... |
What is the reason why nobody has combined the 'meet in the middle' approach with the Dynamic Programming for subset sum?
I found it curious that is a kind of a open problem.. as a matter of fact I never have seen both them combined.
On a paper (1), the author questions if by their combination would be possible to obta... |
Let's say I have a CFG grammar $G$ which describes some rules for language generation. How can you tell that grammar can generate ambiguous results for a string if you don't know that string? I know how to check for ambiguity when you're given a particular string but what about the cases when it's not? Is there any alg... |
I need to find growing combinations of variables a, b, c etc. I don't know names of math things in English well, so my description of the problem will be in pseudocode. This is for a programming problem, but I want to understand the underlying mathematics. I would highly appreciate proper names of techniques used so I ... |
I read about local search / neighborhood search methods for the symmetric TSP and I'm not quite sure about a few things.
The given example said:
Suppose we have an instance of the symmetric TSP with n nodes and the neighborhood $N^k$.
Here $N^k$ is the $k$-change-neighborhood (delete $k$ edges and afterwards insert... |
let us consider Alice and Bob communicate over channel bit by bit. They have one string over $\{0,1\}^{*}$. Let $x$ (uniformly at random) be the string that Bob have and $y$ be the string that Alice have. They want to check whether there strings are same or not.
On simple algorithm is exchange $n$ bits one by one. We ... |
I know in Agda, rewrite is a syntax sugar that desugars to a with abstraction.
For example, if we have (I'm using the Data.Vec from the standard library):
$$
\DeclareMathOperator{Set}{Set}
\DeclareMathOperator{xs}{xs}
\DeclareMathOperator{where}{where}
\DeclareMathOperator{proof}{proof}
\DeclareMathOperator{data}{data}... |
If one attempted to download a file at a speed of 800 Mb/s (100 MB/s) onto a hard drive with a write speed of 500 Mb/s (62.5 MB/s), what would happen? Would the system cap the download speed?
|
In object-oriented programming, I have learned the concept of subtyping and inheritance.
I thought they're the same thing, in the beginning. But I was told that they're totally different.
So what's there difference? What's there relationship?
|
This site already has some questions on this topic but I am confused after reading some of the answers.
Evaluating the average time complexity of a given bubblesort algorithm.
In the above link, answer by "Joe" says that number of swaps in bubble sort on average is same as number of inversions on average which is (n)(n... |
I am a bit confused by the difference between the two. Can someone clarify the difference between the two?
|
Sometimes the C# compiler can do some type inference when you have to specify the generic parameters of some methods, like:
list.Select<[type of x.xx]>(x => x.xx)
Can be shorten as
list.Select(x => x.xx)
. This feature is quite unstable and confusing. Consider another example:
public interface ISome
{
int Method(st... |
I wonder how to build efficient arithmetic network (using logical gates only) to compute floor of binary logarithm of the given input number. I have read some articles on stackoverflow.com about this problem, respectively its implementation in C/C++ using bitwise operations only.
Stackoverflow: Computing the floor of l... |
I am interested in computing weakest preconditions (WP) of loops.
If I refer to Wikipedia "Predicate Transformer semantics", the WP for e.g. total correction of a loop annotated with an invariant I is (as discussed here):
WP(while E do S done, R) =
(1) I
AND (2) for all y, ((E /\ I) => WP(S,I /\ x<y))[y/x]
AND (3)... |
I'm reading Dijkstra Monads for Free for a presentation I'll be doing and it's pretty meaty. One of the things that I keep running into is the term "CPS'ing". I've read a little bit on continuation-passing style (i.e., I've read through most of the Wikipedia page and it didn't feel like utter nonsense...) but I'm still... |
I was able to come up with few examples where number of comparisons in insertion sort were fewer than that of bubble sort and some examples where they were same.
However I am not able to prove that number of comparisons in insertion sort will always be less than or equal to that of bubble sort.
For insertion sort, I am... |
If there are two longest paths in a connected graph with path lengths of 79 (going through 80 vertices each). How can I prove that they share more than 1 vertex.
|
It is said that the intuitive meaning of $\mu$ is finite looping where as the intuitive meaning of $\nu$ is infinite looping in $\mu$ calculus. I understand this for finite systems, but why is this true in general?
Is there any theorem which proves this ?
|
I would like to know how would one go about and answer this question. I know that a language is decidable if a turing machine exists that accepts the strings in that language, and rejects otherwise. Would I need to create a turing machine to show this or is it enough to create a PDA and claim a TM can be created from a... |
Is $Ω(n\log n)$ the lower-bound for all sorting algorithms or just comparison-based sorting algorithms?
If the latter, is it possible for there to be general-purpose sorting algorithms which perform better than $Ω(n\log n)$?
General-purpose, for example, means you aren't assuming elements have a fixed number of bits.
T... |
This is a book question:
Suppose that a machine has 48-bit virtual addresses and 32-bit
physical addresses.
Suppose this same system has a TLB (Translation Lookaside Buffer) with
32 entries. Furthermore, suppose that a program contains instructions
that fit into one page and it sequentially reads long integer el... |
Given a graph $G(V.E,w)$ Here $w: E \mapsto R$. We need to find optimal set of matchings(set of edges that have no common vertices) and $t_i$'s such that after all these matchings, it results in $\forall e \in E, w(e) =0$. Each edge i.e $\forall j \in M_i, w(j) \leftarrow w(j) - t_i$. Weights cannot be negative, he... |
A binary tree can be written as an expression, no matter prefix, postfix or infix.
But why an infix expression needs brackets, while the others don't?
Say, why postfix, prefix produce only one binary tree, while infix can produce many (and become ambiguous)?
I'm looking for a formal proof...
|
I heard that Coq is using "Dedekind cut", but how's that related to floatpoint errors?
Can we just use something like
data Q : Type where
div : N -> N -> Bool -> Q
To replace all usages of floatpoint numbers?
|
Despite the endless hours of googling, pretty much all of them used an alternative definition of Busy Beaver function. The definition BB(k) I'm interested in is the maximum number of 1's that can be written by k-state before it halts, but the other definition they used was the maximum number of steps, and they're not e... |
I just started learning LP and I saw this Q in my textbook:
$$
min : -x -y \\
S.T. : x + 2y \le 3, 2x +y \le 3, x \ge 0, y \ge 0
$$
It is easy to see that the polygon created from these constraints can't have a negative coordinate. In my textbook it says the answer is $(0,0)$ since $-0 -0 = 0$ and this is the minimum ... |
When the state-action space is huge I know I can use function approximators to generalize but how can I explore? Doing an exhaustive search seems very naive. What DeepMind for example did to explore the state-action space in Atari games?
|
The kernel of a polygon $P$ is the set of all points in $P$ from which $P$ is entirely visible. Equivalently, it is the convex region given by the intersection of the half-planes defined by the edges of $P$ (facing into $P$). The definition generalizes for a polyhedron.
It is known that the kernel of a polygon can be f... |
The question is that I have to give a recursive algorithm in pseudocode, that counts the number of chain node in a rooted binary tree. Chain node is defined as a node that has only one child and that child is not a leaf.
I am stuck any help would be appreciated, so far I have done this:
Algorithm Chainnode(x) {
if ... |
I have a question about generally accepted terminology (and whether it exists at all).
Some recursive algorithms on hierarchical data structures (trees) have the property that they are expressed as a function which does a single recursive function call on each of its children, and that this call takes no parameters oth... |
I know that a RAM when has 20 adress lines can store up to 2^20 data. I don't know the reason. What is that for and how?
On the image, where and what is the 2^20?
|
Let's say I have a 16-bit number system. and let $a, b$ a 16-bit numbers in this system.
I know that the numbers I can represent in this system are between $−32,768$ and $32,767$.
Let's say I want to compare between $a$ and $b$ where $a, b$ are near those limits. for example: $a=30,000$ and $b=-30,000$.
I want to comp... |
I am struggling to find out any real life (software) use case of using median of median or K’th Smallest/Largest Element in Unsorted Array problem.I found below text in link (https://news.ycombinator.com/item?id=2476272).
However, partial sort (for which finding the median is a sub problem)
is an easy optimization r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.