instruction stringlengths 35 11.4k |
|---|
I've stumbled on this definition on Wikipedia, and I can't figure out why.
I could probably start the demonstration by saying that, with $n$ bits, you can create $2^n$ possible different numbers, so $2^n=x$. If I rewrite the expression with logarithms, I find $\log_2x = n$, so the base-2-log of the total number of poss... |
In this book there is a lot of mention of "pushing x down". For example:
Pushing NOT operations down and eliminating them
NOT operations need to be pushed downwards for correctness reasons. Attention has to be paid to the IS NOT NULL and IS NULL predicates. XXX complete set of rules go into some table
...
Typical step... |
I have a set of N integers that I want to partition into m subsets. I want these subsets to be well-balanced wrt some criterion say that minimize the max difference between the size of all subsets. But I am not really interested in THE optimal solution. I am interested in a FAST algorithm that generates some good parti... |
This is a problem that involves matching students with various skills into groups so that there are as many groups as possible while ensuring that each group has certain skills present. I've reduced it to this:
Given a set of $N$ people with $S$ skills where $A_{n,s}$ is the quantity of skill $s$ that person $n$ has.
... |
Recursive definition for travelling salesman problem can be written like this :-
T(i,S)=min((i,j)+T(j,S-{j})) for all j belonging to S, when S is not equal to NULL
T(i,S)=(i,S) when S is equal to NULL
Here, T(i,S) denotes the tour starting from i covering all vertices in Subset S and then travel back to i.
I built the... |
When we consider multi-tape Turing machines, we can assume that each tape is accessed with a separate head and each head can move independently of the other heads. But can we assume that each tape can be in its own state independently of the other tapes (for example, tape 1 in state A, tape 2 in state F, tape 3 in stat... |
We have given weighted undirected connected graph with $n$ nodes and $n$ edges, we want to find the longest path in it. Note that the path should be in each node at most once. Since the graph has $n$ edges clearly it has exactly 1 cycle, and removing 1 edge from this cycle will lead us to a tree.
Clearly we can iterate... |
So generally speaking, when we implement the graph using linked list, do we store the degree of each edge too?
I'm asking this because if a question in my exam stated that we implemented this graph using linked list, do i assume we can access the degree of each edge in o(1) or not? this matters because it effects the t... |
I found a question while studying compilers :-
Given a grammar E->E+E/E×E/number
The above grammar is fed to a YACC with semantic rules for parsing. What will be the action of the YACC.
1) it detects recursion and eliminates recursion.
2) it detects RR conflict and resolves
3) it detects SR conflict and resolves in f... |
I have found dynamic solution for Bitonic tour but I could not find any greedy approach for this problem. Is it possible to solve it in a greedy manner?
|
Two given languages $L_1$ and $L_2$ are called recursively separable iff there exists a recursive languge $R$ such that $L_1 \subseteq R$ and $L_2 \cap R = \emptyset$.
Now consider first order logic, and some finite axiomatisation of $\mathbb N$ in it (surely this is way to weak, as we have no induction). Then we have ... |
So, there can be different types of edges in a directed graph while solving the max flow problem. There can be reverse edges, multiple edges and self loops.
What is the significance of self loops in it?
How is it related to flow in the graph?
Let there be a graph like this 1->2->3 and 2 has a self loop. So, can I int... |
We are given a set of points $S$. Given $K$ is any subset of size $k$, how do I efficiently find the following:
$\mathop{\arg\max}\limits_K$
$\sum_{x_i\in K} \mathop{\min}\limits_{x_j \in K, x_j \ne x_i}d(x_i,x_j)$
|
I have a binary variable $y\ \epsilon\ \{0,1\} $ and a real $x$ which has the following boundaries $-100\leq\ x \leq\ 100$. How can I reformulate the following statement:
$$
y =
\begin{cases}
0 & \text{if $ x< 0 $ }\\
1 & \text{if $x \geq0$}\\
\end{cases}
$$
Your help would be much appreciated.
|
Integer Linear Programming (ILP) is NP-complete. However, there are special instances that can be solved in polynomial time. I am curious about the following integer program (IP) with equations and inequalities in $y_i, c_i, x \in \mathbb Z$ of the following form:
$$\begin{align*}
A_i + B_i y_i+ c_i &= x \\
c_i^2 &> 0\... |
I am currently taking a graduate course about Image Processing in electrical engineering and while this question doesn't particularly relate to the class itself but rather some concepts in the algorithms we utilize.
One of the algorithms that we utilized was called, "Image Correlation" in order to find a "match" from u... |
If I'm given a graph $G$ with the set of vertices $V$ and a set $B \subseteq V$, can I remove all the vertices $\in B$ from $G$, as well as all edges that connect any other vertex to a vertex $\in B$ in linear time ($O(V + E)$)? It can be assumed that checking if a vertex $\in B$ is $O(1)$.
My thoughts on this are-
If ... |
According to A modern eye on ML type inference
Furthermore, for some
unknown reason,
W
appears to have become more popular than
J, even though the latter is viewed—with reason!—by Milner as a simplification of the former. Jones’ presentation of type inference for
Haskell [21] does rest upon an implementatio... |
Recall A'= $\{x \mid \phi^A_x(x)$ halts and accepts $\}$
In this article, a proof that A' not computable in A is given:
http://www.math.uchicago.edu/~may/VIGRE/VIGRE2006/PAPERS/Flood.pdf
He constructs the function f(x)= $\phi_x^A(x)$ +1 if x in A and 0 if x not in A
Shouldn't it be f(x)= $\phi_x^A(x)$ +1 if x in A' and... |
I understand that NC0 circuits have a constant depth and bounded gate fan-in of two, but I'm struggling how to understand why the language is in NC0 iff there is a constant c such that for every n, there is a set c variables that determine it's membership.
|
To prove that K= $\{x \mid \phi_x(x)$ halts and accepts$\}$ is r.e.:
we can recognize K by: for any x, we simply run x on machine $\phi_x$ and accept if the machine accpets else reject and that's it...
In general, for proving a set is r.e. , we must recognize every element IN the set? How do we deal with functions lik... |
I know that Huffman coding produces an optimal solution, but are there any more solutions using the same number of bits (not including just flipping the ones and zeros or switching the encoding for letters which appear with the same frequency).
|
According to this answer, $\sum_{k=1}^\infty \frac{1}{k^2 H_k}$ is approximately 1.33275. How?
|
How to sort a stack using bubble sort? Can use another stack if necessary.
|
We know that the halting problem $A_{TM}$= $\{(e,x) \mid M_e(x)$ accepts$\}$ and the diagonal language K= $\{e \mid M_e(e)$ accepts$\}$ are mapping reducible to each other. Recall that A mapping reducible to B means there exists a computable function from A to B s.t. for all x in A, x in A iff f(x) in B. Furthermore bo... |
I need to find a way to iterate over all sequences of words in two letters $A,B$ avoiding the sequence $A^2 = AA$ and $B^3 = BBB$. First of all, what is the regular expression for such a thing?
I need a way of iterating over all such possible words. I tried this one:
$$ w \mapsto \{ wA, wB, wBB\} $$
however, if I run... |
Similar to the theory of hardness of approximation for (offline) approximation algorithms, has there been any work done on proving hardness guarantees for online algorithms? Theoretical lower bounds on competitive ratio conditioned on hardness of some other problem?
|
I am just trying to visualize how computers work with Virtual Memory/Address.
Assume there is a program on the disk that looks like this:
a b c d e f g h i j k l m n o p where the a .. p are instructions and their address is from 0 to 15.
What happens inside the CPU while executing this program? Assume that the operati... |
Take any operation that is done by any type of computer (e.g. a cpu on a modern laptop), which doesn't use any type of temporary memory storage.
I.e. this computer operation computes a function $f(x)=y$, without using any form of memory storage.
Q1: Is it possible for any arbitrary such $f$ to be represented by a form... |
Suppose I have a sequence:
$$n = \prod_{i=1}^{r(n)} p_i^{d_i}$$
for some primes $p_1 < p_2 < \dots < p_{r(n)}$, and each $d_i \geq 1$ an integer. The function $r(n)$ denotes the number of distinct primes divisor of $n$.
I'm trying to show $r(n) = O(\log n)$.
What I have tried:
I think I can establish an upper bound on ... |
I am new to Machine Learning. Suppose a training set of positive (square) and negative (circle) points is given like:
Obviously there would be no nice linear separator of positive and negative points. So assume there exist a transformation for (x1,x2) points as:
y1 = (x1-5)^2, y2 = (x2-5)^2 in (y1,y2) space. We will t... |
Primitive recursion is recursion where totality can be proved because there is a single natural number parameter that strictly decreases in every recursive call. Put another way, the recursion terminates because there is a parameter with order type $\omega$ that strictly decreases under the ordering in each call.
The A... |
I am developing a neural network that is trained using a genetic algorithm.
The neural network is a multilayer perceptron using $\tanh$ as its activation function. Currently, the genotype of the neural network is by its weights. I used the method of making a connectivity matrix and linearizing it according to this pap... |
First of all, note that I'll have to explain my thoughts in a layman's terms.
There are so many high-level programming languages out there that compete with each other. This means we have to build the same functionality over and over again in each language.
Therefore, I wonder the following:
Why isn't there one languag... |
For an Instruction fetch cycle we have the flowing registers in a CPU.
Memory Address Register (MAR)
Memory Buffer Register (MBR)
Program Counter (PC)
Instruction Register (IR):
Accumulator Register:
Stack Control Register:
Flag Register:
Out of these I have come to know that PC and IR registers belong to control uni... |
How do we test the following function?
bits(bitstring, i, j)
which returns a copy of the substring from i to j of some bitstring.
Consider the fixed 32-bit value:
bitstring=0x12345678
We could manually pre-determine the correct return values for ~500 different combinations of i and j. But this only covers 0x12345678.
T... |
I am trying to implement a hash table for string keys as part of a university project. I was able to make a basic, working implementation without major issues. I am now trying to optimize the thing to go closer to a O(1) expected lookup / insert time.
I was reading up on hash functions and in particular, the MAD method... |
I'm trying to understand the time complexity of an example algorithm. My conclusion was O(n^2) but this was considered wrong. The algorithm is as follows:
input: data: array of sorted n integers
input: n: size of data
input: c:a positive integer between 1 and n-1
delta = Array(n-1)
map=HashMap()
for I =1 to n-1 do:
d... |
I am going through the book "Knowledge Representation and Reasoning" by Brachman and Levesque.
So an interpretation $ F $ is defined as a pair $ \langle D,I \rangle $ mapping from a set of objects $ D$ called domain of the interpretation and $ I $ is a mapping called interpretation mapping from the non-logical symbols ... |
I am confused as to how a 16-bit (or 32, 64) processor can store multiple adjacent bytes at once without supplying multiple addresses
For example say we have (16-bit processor) 0xABCD starting at address 0x0000. For loading, the processor would just supply 0x0000 on the address bus and the way the bytes are laid out ph... |
When talking about kolmogorov complexity, I understand that it describes true randomness of given (for now) a string $x$, if we can describe x in less than the $|x|$ then its complexity is said to be
$C(x) \leq |x| + c$
my question lies in finding that c for a given problem.
Given this problem
there is a constant $c... |
I have the ambition to build an application that determents the best set of orders.
Let's say I'm an postage-stamp collector. And I have certain postage-stamps on my wish list. On the secondhand-market are many sellers selling my desired stamps. The sellers originate from around the world. Some offer the postage-stamp ... |
How to solve the following recurrence involving binomial coefficients, where $c$ is a constant non-negative integer, and $n$ and $k$ are non-negative integers ($n \ge k \ge 0$)?
$$
A(n,k) = A(n-1,k) + A(n-1,k-1) + c, \\
A(n,0) = 1, A(n,n) = 1
$$
My Attempt:
Without the constant $c$ (or $c=0$), $A(n,k)$ is just $\binom... |
I have been searching for the applications of the LU factorization/decomposition in computer science. From Wikipedia, I have found some of the applications, but these don't seem to be relevant to computer science.
Applications I found are
Solving linear equations
Inverting a matrix
Computing the determinant
Is there ... |
I need a little clarification on differing time complexities. My analysis for the below algorithm was $O(n +nm)$, but the correct analysis would be $O(n+m)$. I know that Color takes $O(n)$ time to initialize and the inner for loop takes $\mathrm{deg}(v)$ time, which by the handshaking lemma, wouldn't the inner for loop... |
I understand how vector clocks detect concurrent events, but they are designed for a fixed number of nodes, so we can't easily add and remove nodes. And with interval tree clock we can.
Could you help me grasp how they work: Interval Tree Clocks: A Logical Clock for Dynamic Systems. I don't understand the graphic notat... |
I am trying to understand the concepts behind the InceptionNet V3 and got confused with the meaning of representational bottleneck. They said
One should avoid bottlenecks with extreme compression. In general the
representation size should gently decrease from the inputs to the outputs
before reaching the final re... |
So I'm having some discrete elements X1,X2,...,Xn with positive weights Wi (all weights sum up to 1). The weighted average is an element Xk that:
What I want is an algorithm to calculate that Xk in O(nlogn) time with the use of sorting algorithm.
Any ideas to give me a boost? I don't want the whole solution, just some... |
I am starting read a book about Computational Complexity and Turing Machines. Here is quote:
An algorithm (i.e., a machine) can be represented as a bit string once
we decide on some canonical encoding.
This assertion is provided as a simple fact, but I can't understand it.
For example, if I have an algorithm which... |
How to ensure data integrity in General Purpose Registers (GPR registers) given their limited number (for x86 their number is 6),and on the other hand that they are used simultaneously by all processes?
|
I understand that to work out the number of faces of a connected planar graph, you use Euler's formula F = A - N + 2, where A is the number of arcs and N is the number of nodes.
For a triangle node (3 arcs and 3 nodes), the number of faces would therefore be 3 - 3 + 2 = 2.
But I can't count two faces, only one (the tri... |
I have a language $L^*$ for $L = \{pi,po\}$ (I think pi counts as one letter and po also as one letter otherwise a max length of 9 is not possible).
The question is how many words I can make with $L^*$ where the maximum length is 9.
The answer is 31, but I do not know how it got calculated. How is this calculated?
|
I have a large number of sets, A, B, C, ... where each set includes a few integers. I would like to find the set that includes the highest number of other sets.
A brute-force solution is to compare each set with all other sets and count the number of sets that are included in this set. Finally, pick the set with the h... |
I need to design a hash function that fits this criteria:
Limited to 32-bit integer operations (for compatibility with JavaScript bitwise operations, my target system)
Produces an n-bit hash digest, greater or equal to 64-bit, with the expected collision probability of a hash of that size. Effectively combining multip... |
Does $NP\subseteq RP\implies NP=RP$?
Does $PP\subseteq RP\implies \oplus P=NP=RP$?
At least what additional minimal conditions will give truth of above?
|
Just a pre-warning - I'm new to machine learning and the concepts that come with it, so please be nice with the terminology!
I have a directed Graph which represents a home and some devices in it. Users are able to create rules to control how devices interact with each other (e.g. when motion sensor triggered, turn on ... |
So i came upon this question where:
we have to sort $n$ numbers between $0$ and $n^3$ and the answer of time complexity is $\mathcal{O}(n)$ and the author solved it this way:
first we convert the base of these numbers to $n$ in $\mathcal{O}(n)$, therefore now we have numbers with maximum 3 digits.
now we use radix sort... |
There are relativistic spacetimes (e.g. M-H spacetimes; see Hogarth 1994) where a worldline of infinite duration can be contained in the past of a finite observer. This means that a normal observer can have access to an infinite number of a computation steps.
Assuming it's possible for a computer to functional perfectl... |
I have same experimental data with same noise:
I have to calculate the derivative and the integral of the function that fit the experimental data. I try with all the function in this page but the result was not good. How can I do that?
Update:
I look for same method to interpolate the data in order to calculate the de... |
I'm looking for some kind of edit distance measure between what may be called 'non-discrete symbols sequences'.
By a discrete symbol sequence I would mean something like a string, where each symbol has a fixed length and there are fixed positions for symbols. A well-known edit distance measure between strings is the Le... |
Say I have two real number types. They may be floating or fixed point. How can I construct a new type whose values are at least the union of the two with the minimal number of bits?
There are 3 cases to consider:
Fixed (Qa.x) $\cup$ Fixed (Qb.y) - I think the best here is to use Qmax(a,b).max(x,y). I think this is opti... |
I sort of get what it is, but I don't understand how its actually supposed to be used in algorithms. Suppose the hash function is $h_{ab}(x) = ((ax+b) \mod p ) \mod m$ where $a$ not equal to 0. If I wanted to insert something into the table, would I calculate the bucket to place it in using the hash function and then p... |
I don't get the formal way of proving the following cases:
Suppose I have a minimum spanning tree $T$ in a graph $G(V, E)$, with positive edge weights $w$, I want to prove the following:
1) If I increase the edge weight of an edge that is not in $T$, then my resulting tree is still the minimum spanning tree.
This obvio... |
The interpreters used for running scripting language (i.e., JavaScript, Perl, PHP, etc. ) programs go line-by-line. Isn't it better to Avoid too many function invocations for programs written in said scripting languages? However, Avoiding writing functions would be really a pain because you would have huge blocks of ... |
Let $n, k > 0$ and $0 < m < nk$. I want to fill an $n$-length array $A$ with random integer values in the range $[0,k]$ such that $\sum_{i=0}^{n -1} A[i] = m$. Furthermore, all such arrays should be equally likely (that is, any valid array should occur with equal probability to any other). For example, if $n = 3, k = 2... |
I have a question.
All finite languages can be decribed using a regular expression?
|
I'm trying to get a better understanding for the relationship between decidability and a few other things so that I can get a better grasp of the topic. Any info helps!
Is every decidable language a deterministic context free language?
Are there any decidable languages that are not recognizable?
Is the question "Does a... |
In one of my homework I am requested to find a Context-free-grammar (CFG) and a push down automaton (PDA) for the following language:
$L = \{x_1\#x_2\#...\#x_k | k \geq 2, \text{ each } x_i \in \{a, b\}^*, \text{ and for some } i \text{ and } j, x_i=x_j^\mathcal{R}\}$
My problem is that the statement
$\text{ ... and f... |
It is required to count number of unordered pairs in an array of size n ,
l[i]+l[j] = 2*l[k] , where 1<=i< j<=n and 1<=k<= n
My Approach:
l = [1,3,5,4,2,5]
l.sort()
l2 = []
for i in l:
l2.append(2*i)
count = 0
for combo in combinations(l, 2):
if sum(combo) in l2:
count+=1
print(count) # count come... |
I've been going through the control signal table and I noticed something
confusing on when I should set the value as 'don't care' or 0 for control signal.
For example when doing the R type add instruction, we don't go through the
data memory. When we are done with addition inside the ALU, the result will justbypass t... |
I have an array $A$ of $n$ integers. I need to find all quadruples $(i,j,k,\ell)$ such that $i<j<k<\ell$ and $A[i]=A[k]$ and $A[j]=A[\ell]$. What is the best way to do this?
My attempt is an exhaustive search algorithm that works as follows:
Generate all quadruples $Q=\{(i,j,k,\ell): i<j<k<\ell\}$.
For each quadruple... |
Below is my solution. Is this sufficient enough to prove?
$$|x^3+5x| \le |x^3+5x^3|$$
$$x^3 + 5^x \le 6x^3, x > 1, C=6$$
Let's take $x = 2$.
$$f(x) = (2)^3 + 5(2) = 18$$
$$g(x) = 6\cdot 8 = 48$$
For when $x > 1 |f(x)| \le C|g(x)|$ is false hence proving $x^3 + 5x$ is not $O(x^2)$.
|
Say you've got a number of sets $S_1,...,S_n$ given and are supposed to calculate $\,\,\displaystyle\big|\bigcup_{i=1}^n S_i\big|$ .
The basic approach probably would be to use the classic inclusion-exclusion principle $\displaystyle\sum_{\emptyset \not= I \subseteq \{1, \dotsc, n\}} \left(-1\right)^{|I|+1}|A_I|$ , whe... |
Do we need visited boolean flags when applying BFS on a tree ?
/**
* Traverse the grap as BFS
*
* @param {String} $vertex the key of the source vertex
* @param {Function} $getAdjacentCallback to get the adjacent verticies
* @param {Funcrion} $visitCallback called when a vertex is visisted for... |
I have a word list like "English Open Word List" used to create word games.
The list is in txt file with space between words, like;
aa
aah
aahed
.........and so on.
I want to search it while typing the letters in the word, like google suggestions in the search bar.
What is the fastest algorithm to do it? In any languag... |
I understood how Horner's method reduces the complexity(number of operations) while evaluating a polynomial.
I have a character array derived from a string
String s = "hi how are you"
char[] array = {'h' , 'i', ' ', 'h', 'o', 'w', ' ', 'a', 'r', 'e,' ' ', 'y', 'o', 'u'}
I want to generate hash for set of charact... |
I read an article https://www.geeksforgeeks.org/maximum-bipartite-matching/ to solve the maximum bipartite problem. In this article, two solutions are given.
In the first solution, they have explained that we can use edmond-karp algorithm to find the maximum bipartite matching and that would take $O(|E|^2|V|)$ and the... |
Given a finite DAG $G = (V, E)$ with $|E| \in \mathcal{O}(|V|)$, I want to compute a total ordering $<$ over $V$ that is compatible to reachability: If there is a transition $(u, v) \in E$, then $u < v$.
The only way I could think of was to use Floyd-Warshall to compute a reachability matrix and then somehow extend tha... |
I have been studying Integer Programming and I find out that some optimization problems are referred to as P or NP-Hard, however, as I started to read about it, it turns out that those classes are just for decision problem. Thus:
What does it mean that an optimization problem ($\max\{f(c)\mid x\in X\}$) is NP or NP-Ha... |
I am reading the following paper https://pdfs.semanticscholar.org/5e86/db52119d2d691af0365cdba7bb27dc0dc303.pdf and trying to implement the tabu search algorithm they describe for image segmentation. In page 2 of the paper, in step 4 and 6 of the algorithm HTS, they say that if certain conditions are met "then $z_{ij}(... |
I am trying to come up with an efficient algorithm to solve the following problem but not able to design anything nice. I am encountering this problem for a project I am pursuing. Following is an abstracted version of the problem so that I don't confuse anyone with the specifics.
The problem is like this:
I have a lis... |
I suppose not, but I do not have a clear way to prove it. Right now, I am trying to find a counter example that there exists a language that cannot be reduced from the language, but I am not sure if there is the right direction.
|
I can't get what is the operator-precedence grammar... I need to convert this grammar to the grammar of weak precedence but I can't get it even.
What does this notation mean A -> aXYb? What's a, X, Y, b? Can someone show a real sample of OPG (grammar + some built expression)? How many start states can it have?
I tried... |
I have been reading about stack-based programming languages, such as FORTH and Cat, and it seems that given their nature, they can only execute one action at a time regardless of their paradigm (FORTH is imperative whereas Cat is functional).
An imperative language would modify the stack, and a purely functional langu... |
if 0==(n mod 4) then
do somthing ϴ(n^2)
else if 1==(n mod 4) then
do somthing ϴ(n^3)
else if 2==(n mod 4) then
do somthing ϴ(n^4)
else if 3==(n mod 4) then
do somthing ϴ(n^5)
what is best case and worst case for this algorithm?
|
Are there any advantages in finding the shortest tour for the problem if edge weights are much smaller than the number of vertices?
Let's say the maximum edge weight is $n$, and the number of vertices is $n!$, and the adjacency matrix is dense and all distances $d_{ij}$ satisfy $0 \le d_{ij} \le n$. Are there any known... |
I am working on a project where I have to train the following data-set using machine learning algorithm. One of my friend suggested decision tree, but I have never seen a situation where independent variable has more than 100 values in decision tree. I need help for choosing algorithm. Dataset is custom made and small.... |
I am currently studying this book on distributed systems. In the chapter on message ordering the authors appear to use the term total message ordering and synchronous message ordering interchangeably. It make sense why the authors may have done this. As far as I undertand a synchronous message-passing system enforces a... |
In Chapter 2 (Page 76) of the book "An Introduction to the Analysis of Algorithms (2nd edition)" by Robert Sedgewick and Philippe Flajolet, the authors introduce two functions:
Definition Given an integer $N$, define the ruler function $\psi_N$ to be the number of trailing $1$s in the binary representation of $N$ and ... |
This came when I was looking at block scoping in compiler design.
{ A { B } { C {D} {E} } }
For the above pseudo code, the order in which the scope varies as we scan left to right is A B A C D C E C A, where A to E represent scopes.
A parse tree can be constructed for the above pseudo code:
A
/ \
B C
/... |
Several computation models have representative programming language counterparts, as, according to this answer, Snobol for rewriting systems, APL for combinators, Lisp/Scheme for lambda calculus, and off course the family of imperative languages for TMs (or more precisely RAMs). It seems to me that Prolog should also b... |
I am trying to get my head around "State Machine Replication". I understand that it is a way to ensure resilience against failures. I have read that in order to provide fault tolerance against normal failures it can be derived that, there must be 2F+1 replicas and 2F+1 replicas in the case of Byzantine failures, when m... |
I'm given a number $n$ and I have to find the smallest number possible whose sum of digits' cube is equal to $n$. For example $n=9$ then output should be $12$, because $1^3 + 2^3=9$.
|
EDIT: if you are not familiar with the problem and the solution, it's nicely explained here.
I have solved the n-Queens problem as an exercise using backtracking (recursion), but the problem I have right now is I get multiple permutations of the same solution:
n = 4
(0,1) (1,3) (2,0) (3,2)
(0,1) (1,3) (3,2) (2,0)
(0,1)... |
Given an array $A[1],\ldots,A[n]$ of natural numbers, we have to construct a new array $B[1],\ldots,B[n]$, where $B[i]$ is equal to $A[j]$ for the minimal $j > i$ such that $A[j]$ divides $A[i]$, or $-1$ if no such element exists. For example:
$$
\begin{array}{c|ccccccc}
A & 10 & 4 & 5 & 2 & 1 & 8 & 4 \\\hline
B & 5 & ... |
Given a graph/plane with N points each at a given coordinate how could I find a path between 2 points via N other points where each point is weighted on how likely it is to be passed through.
Distances between points can be calculated
Path must be less than a given distance
Apologies if the vocabulary isn't quite r... |
I am currently following a course on Data Mining and i am very curious about the deeper underlying method. As far as i have learned so far data mining is about finding unknown patterns that can be useful and provide new knowledge about your data.
In data mining, is it okay to start from expectations (bias) as to which ... |
After reading about Category Theory at https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/ I was wondering whether we can represent any program by means of a walk of a graph induced by the category of types.
EDIT: rephrasing the question a little bit.
So, given the category of types wher... |
I have some confusion about the differences between finite & infinite.
can someone tell me how the Toll machine or Park meter, soda vending machine can be used with infinite language? if not, please give me an example of other application.
|
I am having trouble transforming a maximum weighted spanning tree into a directed tree such that each node is allowed at most one parent node. Taken from page 141 Friedman et. al (1997), the outline of the algorithm is as follows:
1) Compute $I_{\hat{P}_{D}}(X_{i};X_{j})$ between each pair of variables $i \neq j$ where... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.