instruction stringlengths 35 29.1k |
|---|
There are nice examples for context free grammars which cannot be expressed with regular language, for example the palindrome and a similar contrived example here, but they are very intuitively applicable for formal languages, e.g. checking for balanced nested parentheses and such.
Can you conceive an example that is ... |
the question goes as follows:
In a B-tree (d,2d) of height h, what is the minimal and maximal number of inner-nodes (excluding leaves)?
My idea:
Minimal: The root is 1, it has a minimum of 2 children, therefore we have 1 + 2, and then for any level below each node will have the minimum nodes allowed which is d. We get ... |
The LZ77 compression algorithm uses a sliding window technique, where the window consists of a look-ahead puffer and a search-buffer. What I am wondering is how the algorithm handles the case if the match of the word in the search-buffer is the entire word in the look-ahead buffer? According to the desriptions I find, ... |
Consider a while loop of the form :
$\texttt{while (C) {S}}$
with $\texttt{C}$ the condition and $\texttt{S}$ the body of the loop.
Let $\texttt{I}$ and $\texttt{V}$ respectively be an invariant and a variant of this loop. The rule for total correctness of while loops is given in my textbook by:
If $\texttt{I} \Righ... |
Given a number of sets, what is the best algorithm to calculate the smallest set S such that S is not disjoint with any of the given sets?
|
I asked this question on cstheory.se before, where someone pointed out that it is equivalent to asking whether P=NP implies NL=P (thus I edited the question accordingly).
However, my supervisor claims that actually, connectivity being NP-complete implies that NL=P=NP. I can't see why this would be the case; the only a... |
Djikstra's algorithm assigns some number to non-removed vertex each time it finds a path from removed vertex to it. Number of assignments is $\mathcal{O}(|V|^2)$. However, complexity of assignment is not $\mathcal{O}(1)$, it is $\mathcal{O}(\log s)$, where $s$ is weight of the path from initial vertex to current.
And t... |
I'm trying to teach myself a bit about machine learning, so one of the first things I did was implement a KNN classifier in ruby. My goal was to classify text product reviews into 8 classes:
books-positive
books-negative
kitchen-positive
kitchen-negative
dvd-positive
dvd-positive
electronics-positive
electronics-nega... |
Prove that $BPP^{BPP} = BPP$.
Obviously $BPP\subseteq BPP^{BPP}$. So we're left with proving $BPP^{BPP} \subseteq BPP$. Let's consider $L\in BPP^{BPP}$. Then, there's a PTM $M$ to decide $L$ for some $BPP(\alpha, \beta)$ which uses an oracle for some language $O\in BPP$. $O$ also has a $PTM\in BPP$, let's denote it $... |
I was wondering if there is any theoretical results characterizing under what condition does greedy algorithm actually finds the optimal solution.
Here is a motivating example. Suppose you are trying to find
$$\min_{x \in \mathbb{Z}^2} f(x)$$
where $f$ is convex, and the minimizer happens to be on an integer point $(a,... |
In my AI lecture notes (also many other AI lectures) it's written that uniform cost search is optimal (that is, uniform search always outputs the optimal path), but what if the cost is negative, won't the search algorithm possibly trapped in infinite loops? If solution is using a closed set to track explored nodes, we ... |
I need come up with an algorithm for detecting a cycle in an undirected graph where the algorithm is in $RL$. That is, the algorithm detects a cycle with a probability greater-equal to $\frac{1}{2}$ but it doesn't return true for a graph with no cycle (no false-positive).
In class, we've learned that $USTCONN$ (the pro... |
As I found out here: http://www.eclipse.org/jdt/core/howto/generate%20parser/generateParser.html , the Java Version of 2005 (might be Java 6, I'm not sure) is a LALR(1) grammar. However, I couldn't find out if the Java 8 grammar still is a LALR one. I found some Java 8 grammar on GitHub (https://github.com/antlr/gramma... |
I tried to make a program printing out the contents of the file text.txt,
but for some reason it only prints out the even letters.
What have I done wrong?
|
Let $A\in NP\cap co-NP$. Then, $NP^A = NP$.
At first, I thought: Easy, let $L\in NP^A$ s.t. $A\in NP\cap co-NP$. Let $M_L$, an $NDTM$ to decide $L$ and $M_A$, an $NDTM$ to decide $A$. Then, we could create a new $NDTM$, $M$ which acts the same as $M_L$, but instead of calling the oracle, it simulates $M_A$ on the ora... |
Language $L$ is in $\mathrm{P}$ if and only if there exists some Turing Machine $M$ such that for every word in $L$, $M$ either accepts or rejects it in polynomial time. Right?
But what if all we know about our language is that there exists TM $M'$ such that for every word in $L$, $M$ accepts it in polynomial time, bu... |
I have some questions about the ideas proposed in this video.
The speaker shows an array that holds values and pointers, and he also shows a separate "free" linked list, that is updated whenever an item is added/removed.
Why are these used? Doesn't using an array / limiting yourself to a set of free nodes defeat the pu... |
I tried to solve this question,
We have this Language, L(g)={AA|A={0+1}*}
The output(Productions) must be similar as these = {(11 11), (0 0), (1101 1101), etc..} The left side equal to right side..
VT={1,0}
The problem I used a lot of methods to solve this, like pumping lemma.
This question isn't easy, I hope someone c... |
Initial Problem:
Given an interval $[A, B]$ and a set of intervals $S = \{[S_{11},
S_{12}], [S_{21}, S_{22}], [S_{31}, S_{32}], \ldots, [S_{N1}, S_{N2}]\}$
with $S_{11}\leq S_{21}\leq \cdots \leq S_{N1}$ output True if and only if
$[A, B]$ is completely contained in the union of all intervals in $S$,
and False o... |
I'm looking for a formal definition of "graph levels" on a DAG. This example should illustrate what I mean by this.
The node 0 has no edges directed towards it, therefore this has level 0. Next is is 3 and 4 which will have level 1 and so on.
Level 0 : node 0
Level 1 : node 3, node 4
Level 2 : node 1, node 2
Level 3 :... |
I've just started learning C. Can anyone tell me whether my code is correct or not, if not what's the correct version? This is code for counting number of leaf nodes. Is this efficient one if this is correct?
void Count_leaf( Tree* head)
{ static leaf = 0;
if(head.left==NULL && head.right==NULL)
... |
I am looking for the terminology/concepts which express the nontechnical notion of the "layer" structuring of programs, the languages in which they are written, and a formal type theory.
For instance, we might have types defined for a single module, written in a language with a certain type system which may be a subset... |
In an answer of this Reddit discussion somebody defines referential transparency (RT) as "a context $K[ ]$ is RT if, for all $M$ and $N$ s.t. $M = N$, then $K[M] = K[N]$". Based on this definition, Lambda Calculus (LC) (and any other language with binding constructs) is non-RT.
For example, let $\Omega = (\lambda w.ww)... |
Suppose those random variables are represented as scalar time series with nonlinear relationship (thus applying linear correlation or covariance would be futile) that may change over time, then is there a machine learning algorithm that would approximate or "learn" such relationship?
|
I'm studying value representation in modern languages. The idea is that since in many situations the size of objects can be unknown, one can introduce a box representation of it. This box representation is just a block stored at the heap with a tag to identify it.
My questions is as follows: who deals with the size of... |
I understand that rate monotonic scheduling assigns a priority to a process based on the periodicity of the tasks it generates and the process with the shortest inter-task period has the highest priority but i am confused as to why in this particular scenario p1 will miss its first deadline?
PS Sorry but english isn't... |
Graph
Is
1) A D F E G C B and;
2) A D F E G B C is one of deep-first transverse?
The code below is written in java and method1 and method2 is two different implementation.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Stack;
/**
* Created by raymond on 12/05/2017.
*/
class Node {
publi... |
I'm looking for an appropriate technique to search for clusters. My underlying data is 70,000 respondents to about 2500 multiple choice questions. Most respondents have not answered most questions. I have no expectations as to how many clusters I might expect or how clustered this data might be but am interested to exp... |
Here N represents the number of elements in the multi-tree.
Please state the algorithm that you have used to do so. It would be great if you can implement this in Java/C++ too and post the code as well.
Also I used union-find to initialize the tree. You can consider or not consider this algorithm. I just need the algor... |
What happens if you run Kosaraju’s algorithm for finding strongly connected components of directed graphs on a DAG?
|
Given a connected, undirected, weighted graph $G$, the condition
The maximum-weight edge in any cycle of $G$ is unique.
is not necessary for $G$ to have a unique minimum spanning tree (MST).
However, is this condition sufficient for $G$ to have a unique MST?
|
I'm working on a kNN classifier to classify whether a text is written by a man or a woman on the basis of the most frequent words. However, a kNN doesn't show which features were the most important in the classification. I got the suggestion to fit a logistic regression on my training data and labels to see which words... |
// assume 'n' is given.
What is the time complexity of this code ?
java.util.LinkedList<Integer> k = new java.util.LinkedList<Integer>();
for(int i = 0;i<n;i++)
for(int j = 0;j<n;j++)
k.add(k.size()/2,j);
|
Punishment is reducing a behaviour due to bad outcome e.g. A cow stops touching an electric fence because it gets a shock.
Negative reinforcement is increasing a behaviour that reduces a bad outcome. e.g. Put on a seat belt to stop the car bleating.
In this context, how are neural nets trained by Reinforcement Learnin... |
I am creating a software that computes the cosine similarity between 2 strings.
I am using Spark as I have to use Java. I created a Bag of words model and computed the cosine similarity successfully.
Feeding the same sentences to the software and substituting the bag of words model with a TF-IDF the similarity between ... |
If processors can only execute one thing at a time, how come I can play music continuously and still be able to run other tasks?
I understand the interrupt system, but isn't it needed that CPU continuously process audio for it to not sound jittery/laggy?
I am asking about the underlying implementation, is this question... |
In two way non-deterministic finite state automata there is the concept of reject state.
Since an input is accepted if any one of the parallel branches in the Non Deterministic FSA reaches an accept state and the rest of the branches are then immaterial.
On a given Input even if one of the branches reaches the 'reje... |
"In a 2-way set associative cache of 4 blocks containing 4 words each, which one of these addresses will return a hit when being read? The blocks to be retained in the cache are decided by LRU."
4 word / block means that the offset = 2 bits.
2-way means 4 blocks / 2 = 2 sets. The index then needs 1 bit.
And thus the ta... |
Assuming I have a very simple branching:
switch on var:
1 => branch1
2 => branch2
default => branch3
And I wish to implement a program that will forever take "branch2" when entering this sequence of instructions once branch2 is taken.
This is quite easy to do by adding an additional variable and setting it when... |
This time complexity comes from $N$-queen problem. There are many threads talking about the time complexity to be $O(n!)$ but I cannot figure out how we get it. Here is the progress I have so far:
$$
\begin{align}
T(n) & = n T(n-1) + n^2\\
& = n(n-1)T(n-2) + n(n-1)^2 + n^2\\
& \vdots\\
& = n! + n! + n(n-1) \dots 2^2 + ... |
Is it when you need faster performance, to iterate over a container, or when you don't need an index variable?
From my understanding it should be when you need to iterate over a container.
Am I understanding this properly?
|
Input: undirected graph $G$, starting node $j$ for Justin Bieber (JB), and starting nodes for 4 fans $f_1, f_2, f_3, f_4$.
This problem has turns: for every turn, JB can either stay at his current node or move 1 node adjacent. Fans are working together and follow the same rules, but can share the same node. The fans a... |
For a machine learning method X (Deep Neural Nets variant), which performs classification tasks.
In the output layer, for every label method, X also emits the uncertainty U associated with the respective prediction.
So, in case the testing dataset is very different then the predictions made by X should have a high U. (... |
In my textbook on compiler design [1], it describes interference between two variables (the property that they cannot be in the same register at once) as follows:
Definition 9.2: A variable $x$ interferes with a variable $y$ if $x \neq y$ and there is an instruction $i$ such that $x \in kill[i], y \in out[i]$ and ins... |
Following Deep MNIST for Experts tutorial on Tensorflow, I realize I don't understand where the choice of numbers comes from when initializing weights.
In the tutorial, they first show the below function for creating random weights.
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return... |
Is it possible to transform binary strings of length $2^n$ to $n^c$ binary strings of sized $n^d$ such that
$$\forall s_1,s_2 \; \exists i \in \{1,\cdots,n^c\} \; f_i(s_1)\neq f_i(s_2),$$
Where two strings $s_1,s_2$ have length $2^n$ and $\forall i\in\{1,\cdots,n^c\}, \; f_i(s_j)\leq n^d, \; j\in \{1,2\}$?
It seems ... |
I'm trying to understand and use the Faster R-CNN algorithm on my own data.
My question is about ROI coordinates: what we have as labels, and what we want in the end, are ROI coordinates in the input image. However, if I understand it correctly, anchor boxes are given in the convolutional feature map, then the ROI regr... |
I would like to ask for references to algorithms that can project shape information about an object to 1 dimension. Specifically I am training a neural network to be able to identify objects with similar shape as the ones in the training set. The objects in my case are molecules for which the positions, masses and radi... |
Given a connected, undirected, weighted graph $G$, the following "cut condition"
For any partition of the vertices of $G$ into two subsets, the minimum-weight edge with one endpoint in each subset is unique.
is not necessary for $G$ to have a unique minimum spanning tree.
However, is this "cut condition" sufficient f... |
I am working on a cryptography project. Let's say I want to build a public key cryptosystem using the 3-partition problem, which is NP-Complete, as a basis (just like RSA uses integer factorization).
Now, I am having trouble coming up with a trapdoor function that helps me enconde it. Let's say I have $T=\{t_{1}, t_{2... |
I am studying about PIO mode and DMA mode for accessing IO devices, and based on what I have read, in PIO mode the data transfer have to go through the CPU.
So I have unchecked DMA in Windows 7 (which I guess will enable PIO mode):
And I copied and pasted a large file to see the CPU usage, and the CPU usage was still ... |
I'm currently studying informed search algorithms.
I've found a paper telling that A* is a recursive algorithm but I can't see where's the recursion part of this algorithm.
Why is A* considered as a recursive algorithm?
|
How does a demultiplexer ignore/discard/block the non-required outputs?
A demultiplexer channels the input to one of the outputs, but there are several outputs. When one output is selected (depending on the state of the select line(s)) then rest of the outputs are 0/low (am I right?).
Now, if the input is 0/low then t... |
Any r.e. subset of $A\subseteq\mathbb{N}$ which contains the set $$\mathrm{Tot}=\{i\mid i\ \mbox{is an index of a total function } f\}$$ must, by a standard argument (of Post?) contain some partial recursive function indices.
Given a partial function index (and every total function), it's pretty easy to construct many ... |
There is a language:
$L=\{w: w\in \{a,b\}^*, |w|_a\ \equiv |w|_b \equiv 0$ $(mod$ $5) \}$. My idea for DFA is - we count number of $a$$\pmod{5}$ and separately we count number of $b$$\pmod{5}$. So we end up with $5*5=25$ states, because each state have to keep track for both number of $a$ and $b$$\pmod{5}$. Is there a... |
So given some erroneous Reed Muller code-word's syndrome as well as the Parity-Check/Generator Matrix how would one find the error vector?
The approach I took naively was to build the syndrome table, and use the syndrome to find the expected error vector, but unfortunately its too costly and for systems where $m \geq 1... |
I have the following quotation from my compiler's course (in the context of graph coloring):
Because it is slow, graph coloring tends to be used in batch
compilers, while linear scan tends to be used in JIT compilers.
I couldn't find a clear definition online. So, what makes a compiler be a batch compiler?
|
what is the height of avl tree with n nodes ? Can you explain it with formula ? I couldn't find any formula to solve this problem.
|
I want to use these two functions in two hash-tables with open-addressing. Is there any problems with these functions? If yes, why they are not appropriate?
H(k,i) = (k mod m + 3i mod m) mod m
H(k,i) = (k^2 + 2k + i(k mod m)) mod m
|
Suppose you design a computer with a ten-stage Pipeline to execute one instruction, with each stage taking 5nsec
A)how long will it take to execute a program that has 30 sequential instructions.
Answer: 195nsec
B) how long will it take to execute a program that has 30 sequential instructions in a non-pipeline computer... |
A magnetic disk has 1000 cylinders, 10 tracks per cylinder, 128 sectors per track, 1 KB per sector. The rotation time is 6 msec, maximum seek time is 150 msec, switching between adjacent cylinders takes 15 msec, and switching between adjacent tracks within a cylinder takes no time. Assume this disk has 4 MB of data sto... |
This was from a test from my university:
Consider $T = t_1, t_2, \cdots, t_n$ a set of intervals of the form $(s, e)$, representing the start and end time, respectively. Now, select the minimum number of intervals such that their "union" intersects all other intervals. The question then asked for an optimal greedy algo... |
I have two questions,
Does $T_\mathrm{best}(N) = O(f(N))$ imply that $T_\mathrm{avg}(N) = \Omega(f(N))$?
Does $T_\mathrm{avg}(N) = O(f(N))$ imply that $T_\mathrm{best}(N) = O(f(N))$?
Where,
\begin{align*}T_\mathrm{best}(N) &= \min \{T_1, \dots, T_N\}\\
T_\mathrm{avg}(N) &= \frac1N \sum_{1\leq i\leq n} T_i
\end{align*... |
Given a type hierarchy $(\tau,\sqsubseteq)$ and a signature $(VSym, FSym, PSym, \alpha)$, one says that the typing function $\alpha$ assigns to each variable symbol $x \in VSym$ a non-empty type $A \in \tau \setminus\{\bot\}$ and is written as:
$$ x: A \tag1$$
Furthermore, for every type $A \in \tau \setminus\{\bot\}$,... |
I have a problem in my Algorithms Class which i am trying to solve for the past two days but I can't. I want to fully fill a container with the MINIMUM number of given boxes with dynamic programming. My container has a certain size and I have different box sizes AND quantities of them (so i have 24 boxes of size 20, 15... |
Splay trees offer armotized O(log n) access to tree elements. However, if you keep repeatedly appending elements to a splay tree, without splaying any other elements, it degrades into a linked list with O(n) access. Is there a way to avoid that? I have the idea of splaying a random element during an append, but will th... |
I'm working out some details to implement a division algorithm, I'm following the explanation given in this book (chapter 5) for who is interested.
Anyway I need to work out how many bits are necessary to represent a value $\omega$ bounded by
$$
| \omega | \leq \rho r^{k+1} y
$$
where
$$
\begin{array}{l}
\frac{1}{2} < ... |
In my theoretical computer science book I have the following statement regarding the space complexity of $f(n)=2^n$:
$$\log(n) = O(f(n))$$
I can't understand how this is true, any help will be greatly appreciated.
|
I've found a simple multiply-with-add hash function in an old Usenet post.
Can someone identify what hash algorithm is it? An algorithm name or any attribution?
size_t hash(const char* data, size_t length, size_t seed = 1)
{
for (size_t i = 0; i < length; i++)
{
seed = seed * (UCHAR_MAX + 2U) + data[i];... |
When running Dijkstra against the following graph:
1 3
A -- B -- C
\ /
2 \ / 1
\ /
D
...I come up with the following:
Current
A B C D
A 1(via A) - 2(via A)
B 1(A) 4(via B) 2(via A)
C 1(A) ... |
When working with certain low-powered / embedded CPUs that are bad at using the stack, I need to avoid putting local variables there, instead opting to make them static variables. But this can waste a lot of address spaces since not every local in every function needs their own unique address. Rather, by looking at the... |
I've been recently studying inline caching as a technique to optimize method dispatch in object oriented languages. Basically, the idea is that one can remember what was previously dispatched and predict that things will go on in the same way.
My question is whether this technique has been used in pure functional lang... |
The Multiple-Choice Multi-Dimensional knapsack (MMKP) problem is defined as follows. The input is $N$ groups of items, each item in each group has a value, and requires $m$ resources. The total available resources is given by a vector $R = (r_1, r_2, .., r_m) $. The goal is to choose exactly one item from each group, s... |
There is a contradiction in the Johnson’s algorithm presented in CLRS edition 3 page 700 that I can't understand.
Johnson’s algorithm uses the technique of reweighting, which works as follows: for each edge $(u,v)$ that may has a negative weight, a new weight is assigned which is as follow:
Given a weighted, directed ... |
INSTANCE: A two-way nondeterministic finite state automaton A over single Alphabet I.
QUESTION: Is there an string x (over I) such that A accepts x ?
Since a 2-way NFA with N states, there’s an equivalent nfa with n^(n+1) states. So that’s we get the exponential time from.
I am clear about that, but if I understand co... |
I was experimenting with a WAVL Tree code I wrote.
One thing I noticed is that on average, there was much less rebalancing actions after delete than after insert. In fact, average rebalances after insert were about 2.5 per insert, and 1.8 per delete.
This results were consistent, even when we inserted and deleted in co... |
I am trying to solve this algorithm exercises (http://neuralnetworksanddeeplearning.com/chap1.html#exercise_513527) in Michael Nielson's online book: Neural Networks and Deep Learning (http://neuralnetworksanddeeplearning.com/chap1.html#complete_zero).
In another word, he says that there is a way to use four neurons t... |
Suppose you design a computer with a ten-stage Pipeline to execute one instruction, with each stage taking 5nsec
A)how long will it take to execute a program that has 30 sequential instructions.
Answer: 195nsec
B) how long will it take to execute a program that has 30 sequential instructions in a non-pipeline computer... |
prove that for every $0 \le \alpha(n), \beta(n) \le1 \; s.t.$ there exists $c \in \Bbb{N} \;s.t \;\alpha(n)+\beta(n) \le 1- \frac{1}{n^c}$ then $BPP(\alpha(n), \beta(n)) = BPP$.
I tried to show that by running k times we can get the error to be exponentially small using the chernoff inequality, for $0\le\delta\le1$
$$p... |
I have recently come across the following papers:
S. Baktir and E. Savas. Highly-parallel Montgomery multiplication for multi-core general-purpose microprocessors.
In E. Gelenbe and R. Lent, editors, Computer and Information Sciences III, pages 467–476.
Springer London, 2013.
P. Giorgi, L. Imbert, and T. Izard. Parall... |
I'm trying to find time complexity $T(n)$ of the algorithm by a given pseudocode:
1: for i:=1 to N do
2: begin
3: len := 1
4: while i - len >= 1 and i + len <= N do
5: begin
6: if a[i] > a[i - len] and a[i] > a[i + len] then
7: len := len + 1
8: else
9: break
10: end
11: print(i, len)
12: ... |
I need to find the shortest path in a Directed Unweighted Cyclic graph. And it has to be optimal (find a path if exists one) and also optimal in terms of space and time complexity, being time complexity the most important.
I think BFS is the solution. But am not sure.
What I am doing is mapping database tables into a g... |
I have the following problem, create a Grammar on the Language {1,0} that accepts
"strings with a length divisible by 3, or strings with a number of 0s divisible
by 3, or BOTH".
I created grammars for each part, but I'm not sure how to account for the "BOTH" clause.
I started by making a regular expression:
1*(01*... |
I found this question here but I don't think the answer is correct.
Here is the original word break question:
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.
Return all such possible sentences.
For example, given s = "catsanddog", dic... |
In the field of deep learning, people often talk about factors of variation which, in my understanding (in terms of dimensionality reduction), are the latent variable directions capturing variability in the data. I also often come across the term distributed representations which are basically the features of the input... |
Please can someone confirm that my description of the application of Dijkstra's algorithm is correct for this graph?
1 3
A -- B -- C
\ /
2 \ / 1
\ /
D
Step Current Node
B C D
1 A 1(A) - 2(A)
2 B 1(A)... |
Continuing from this answer: https://cs.stackexchange.com/a/56072/43035
I don't understand how it's possible to map many transition functions $\delta_1,...,\delta_n$ of a NDTM into just two transition functions $\delta_0',\delta_1'$. How will conflicts be handled?
For example: $\delta_1(q_1, a) = (q_2, b, R)\\ \delta_2... |
Consider the following problem:
given an undirected graph with weighted edges (positive and negative) I would like to know if there is a k-length acyclic path with negative weight.
Is there an algorithm for that with a good complexity?
Maybe I can find the lighter k-length acyclic path and check if is negative, but it ... |
As I understand one can modify BFS for unweighted graph or Dijakstra for weighted graph to find all possible shortest paths from $s$ to $t$ in linear time. But how can this be, when there are $O(2^n)$ such paths?
What am I missing here?
|
I've come with an idea for reduction from the set-cover problem to the vertex-cover problem, But I'm not sure if this reduction is correct. I saw in this post's comments that "There cannot be a nice reduction of this sort".
Consider the set of $S$ to be $S_1,...,S_n$ where the element of $S$ is $s_1, ..., s_m$. In the... |
This is a question based on this one
I've also tried this problem but I can't seem to understand Henry's solution to it.
Why is the average distance between the sticks $(n+1) / (k+1)$ and not $n/ k$
|
I have a small problem with the first order logic, in particular, predicate logic
Let us take this sentence as an example:
Each teacher has given a form to each student.
From this sentence, can we have different reading?
This is my try to solve such problem, I did not know if this is the answer for such question:
Ever... |
Kleene's recursion theorem implies that every Turing complete programming language that satisfies certain properties have quines. This website claims that this is incorrect, and that there is a Turing complete without a quine.
I give a slightly simplified version of what they gave. Start with a Turing complete programm... |
I was thinking of grammars for indendation-sensitive languages and it looks like CF grammars would do the trick if combined with parameters. As an example, consider this fragment for simplified Python grammar in ANTLR-like format:
// on top-level the statements have empty indent
program
: statement('')+
;
//... |
I have two numbers, which are each the product of a large number of smaller numbers that I know. I want to find the GCD (Greatest common divisor) of these two numbers. Is there any way I can make use of the partial factorization I have to speed up the process?
In particular, each larger number is the product of $2^{15}... |
Can anyone let me know, why 2PC is blocking when the coordinator fails? Is it because the cohorts don't employ timeout concept in 2PC?
Good reference: Analysis and Verification of Two-Phase Commit & Three-Phase Commit Protocols, by Muhammad Atif,
Elaboration of the question:
Let’s say, a coordinator sends 1st message (... |
Weak semaphores are often defined as
if a process (or thread), say p1, performs a V operation and some
other process is waiting on that semaphore, then the first process
(i.e. p1) is not allowed to immediately perform another P operation on
that semaphore. Instead, one of the waiting processes must be given
it... |
I know that given the following huffman tree:
you can say that C occurs most in the dataset from which it was generated and D and B occur the least. Can you also say that the left most leaf on a level has a occurence that is greater than or equal to the rightmost?
|
I shall call this the "Curtain Hook" problem.
Please excuse my lack of formal maths notation as it has been over 20 years since I have needed it.
A standard pencil pleat curtain has L number of loops on the back (evenly spaced along the width) with which to hang the curtain. The curtain pole will come with H number of... |
Here is the motivation and how it should behave, but I need a help how to implement it.
I have several (typically) incomplete orders given as ordered values, for ex.:
1. A, C, D
2. D, E
3. X, B
4. B, C
5. C, F
6. C, A
and the resulting order should be:
A, X, B, C, D, E, F or A, X, B, C, F, D, E or A, X, B, C, D, F, E
T... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.