instruction stringlengths 0 29.8k ⌀ |
|---|
null |
null |
null |
null |
[![enter image description here][1]][1]
There are clusters of LAN connected computer systems. California cluster has cached "viral video" at first stage, when client near California requested the file firstly.
Now, another client near California requests "viral video".
The benefit here is that there would be n... |
How does caching increases scalability in distributed file system? |
|distributed-systems|computer-networks| |
null |
kth smallest in one sorted array, just take `O(1)` time
kth smallest in two sorted arrays, there is a [binary search algorithm](https://leetcode.com/problems/median-of-two-sorted-arrays/), take `O(log k)` time
kth smaleest in n sorted arrays, we can use min-heap, takes `O(k log n)`. However, when `n = 1 or 2`, it... |
kth smallest element in n sorted arrays |
|algorithms| |
null |
I think something like this could work:
Given $n$ arrays $A_1, …, A_n$ and an integer $k$, finding the $k$-th smallest element of those arrays can be done by finding $n$ "cuts" in those arrays such that the total number of elements before cuts is equal to $k$. The $k$-th smallest element is then one of the elements ... |
Irrespective of whatever notation is used by the OP, I will use the following notation: $T^k$ is the $k$-th Turing machine under an acceptable numbering of Turing machine, and $T^k(n)$ is the result of running the $k$-th Turing machine on onput $n$. The output is either undefined, if $T^k$ never terminates on input $n$... |
null |
null |
null |
It took me a while to understand that your alphabet $\Sigma$ is $\{a,b\}$ and by `/\` you meant the empty word $\epsilon$.
Your regular expression is the union of two sub-expression, namely:
- `(b + /\)(ab)*aa(ba)*(b + /\) `; and
- `(a + /\)(ba)*bb(ab)*(a + /\)`.
The first one (resp. second one) matches al... |
I have a multidimensional time series on which I would like to perform some clustering. I have been looking at DTW as a distance metric since my series are not always aligned in time. The problem I have is that while the one to many mapping of points along two series allows for their alignment in the event they are the... |
Dynamic Time Warping and Similarity Measures |
|algorithms|dynamic-programming|time-series-analysis| |
On $n$ parallel rails there are $n$ trains with constant speeds $v_1, ..., v_n$. At time $0$ the trains are at positions $k_1, ..., k_n$. Find an $O(n \log n)$ algorithm that determines which trains are in the lead at least once. |
$O(n \log n)$ Algorithm for first Train Problem |
|algorithms|sorting|search-algorithms|efficiency|divide-and-conquer| |
This might be an irritating, naive question, but please bear with me. If an algorithm/code solves the string matching problem for a binary string, does not it imply that the algo/code actually solves the string matching problem in general?
Because, in hardware everything is converted to `0` and `1` and then calcul... |
Is solving Binary String Matching equivalent to Solving All type of string matching? |
|algorithms|computability|strings|binary|assembly| |
On $n$ parallel rails there are $n$ trains with constant speeds $v_1, ..., v_n$. At time $0$ the trains are at positions $k_1, ..., k_n$. Find an $O(n \log n)$ algorithm that determines which trains are in the lead at least once.
My current approach is to create a 2-dimensional coordinate system, time as x-axis and po... |
On $n$ parallel rails there are $n$ trains with constant speeds $v_1, ..., v_n$. At time $0$ the trains are at positions $k_1, ..., k_n$. Find an $O(n \log n)$ algorithm that determines which trains are in the lead at least once.
My current approach is to create a 2-dimensional coordinate system, time as x-axis and ... |
null |
I am looking at the state flipping algorithm, an algorithm that that tries to find a stable configuration in a Hopfield network.
The algorithm simply flips the state of unsatisfied nodes as long as the the network has not reached a stable configuration.
Chapter 12 from this book: page 673
https://ict.iitk.ac.i... |
does local search's State-Flipping Algorithm always terminate? |
|search-problem| |
**Hint 1:**
Your approach is good. The algorithm type you are looking for is called a "scan line" algorithm. The idea is that you move from left to right on your 2d model and at each intersection (an "event") update data structures.
**Hint 2:**
In your case the you maintain a ordered binary search tree of the ... |
null |
DNA is made of a string of different proteins.There are 4 different proteins which make up the human DNA.We can represent each protein as a 2 bit sequence of '0' and '1'.However wouldnt it be much better if we had 4 available states('0','1','2','3') for every type of protein?How would a algebra having as a base 4 avail... |
DNA sequence and algebra |
|computer-algebra| |
Let there be $N$ sequences containing at least one set each. Each set has at least one element each.
Select exactly one set from each sequence. The selection within each sequence is mutually exclusive. Once any given selection is formed, calculate a superset as the union of all selected sets. The cardinality of the ... |
Lowest total cardinality mutually exclusive construction of a superset |
|sets|set-cover| |
For the definition of domination [[Wikipedia]](https://en.wikipedia.org/wiki/Dominator_(graph_theory)),
> a node $d$ of a control-flow graph dominates a node $n$ if every path from the entry node to $n$ must go through $d$.
If node $n$ is not reachable from the entry node, **why are all other nodes *not* dominato... |
Dominators when node not reachable |
|graphs|network-flow| |
Minor point, you say "looking at DTW as a distance metric "
DTW is not a metric, it is just a measure.
The answer to your question "Is there such a time series similarity measure that aligns series that are shifted in phase but treats differences in frequencies between series as being different" is Yes.
You can ... |
I'm trying to solve the recurrence equation from CLRS ed 2.
$$
T(n) = 2T(\sqrt{n}) + 1
$$
The question says the solution should be asymptotically tight, but at first I didn't read it and solved it with a substitution of variables and tried to find a big-O solution.
$$
m = lg(n)
\\
S(m) = T(2^m)
\\
S(m) = 2S(... |
Contradicting asymptotic analysis in recurrence equation? |
|algorithm-analysis|asymptotics|recurrence-relation| |
null |
null |
null |
null |
>!$$\frac{2\cdot 2+4\cdot 3}6.$$ |
Set $n=2^{2^m}$. The recurrence turns to
$$T(2^{2^m})=2T(2^{2^{m-1}})+1$$
or
$$S(m)=2S(m-1)+1.$$
This is an ordinary linear recurrence. By inspection it has the particular solution $S_p(m)=-1$, and the homogeneous part of the equation is solved by
$$S_h(m)=C\,2^m.$$
From this,
$$T(n)=S(m)=C\,2^m-1=... |
With the size of data and bandwidth given, you can only calculate the **transmission delay** and not the **propagation delay**(latency). The latter depends on the physical characteristics of the medium used for transfer of data. |
null |
What is the relation between the amount of data transmitted and line distance? |
null |
|combinatorics|sets|set-cover| |
I have a multidimensional time series on which I would like to perform some clustering. I have been looking at DTW as a distance metric since my series are not always aligned in time. The problem I have is that while the one to many mapping of points along two series allows for their alignment in the event they are the... |
DNA is made of a string of different proteins.There are 4 different proteins which make up the human DNA.We can represent each protein as a 2 bit sequence of '0' and '1'.However wouldnt it be much better if we had 4 available logic states('0','1','2','3') for every type of protein?How would a algebra having as a base 4... |
100 Gigabyte at 100 Megabyte per second will always take 1,000 seconds. That's computer science (taking the expression generously).
But then there is physics. It is harder achieving a certain bitrate over a long distance. Usually when you send a signal through cables, you have a quality loss at the initial connecto... |
null |
Computers work with string encodings which are literally mapping of symbols to binary strings. As a practical matter, real computers use fixed size registers and and string matching algorithms implemented on those computers are working with register-sized data anyways.
Of course you can build a special purpose compu... |
If I understand your question correctly, you are looking for a function $f(input, apphistory, task)$ that returns the set of matching apps where $input$ is a string the user has entered (eg: the command name), $apphistory$ is a frequency distribution of the previous app launches (for inferring the most frequently used ... |
It is said that **PBFT (or Practical Byzantine Fault Tolerance consensus)** is **Byzantine** fault tolerant (unlike Paxos or Raft that are only Crash fault tolerant.)
Based on this answer : [LINK][1] , in PBFT ***"a new leader is elected only if there is a suspicion that the old leader is no longer available."***
... |
How does PBFT tolerate Byzantine Leaders? |
|distributed-systems|security|consensus|fault-tolerance|byzantine| |
null |
null |
DNA is a long-chain polymer. The monomers that comprise a DNA strand are referred to as "nucleotides".
A protein is a completely different polymer, the monomers of which are called amino acids. The "standard model" relationship between the two (which is a little more complex in practice) is that the "coding regions"... |
The question is the conversion from an animation to a video file with the following attributes:
Frame rate:24 fps
Resulution:320*240 pixels
Color depth:24 pixels
Length of video:60s
Bit rate:500kbps
I calculated that the file size should be 24*60*320*240*3=316MB (frame rate*resolution*colordepth/3*resolution)... |
Why is the file size smaller than what I calculated? |
|bit-manipulation| |
The question is the conversion from an animation to a video file with the following attributes:
Frame rate:24 fps
Resolution:320*240 pixels
Color depth:24 pixels
Length of video: 60s
Bit rate: 500kbps
I calculated that the file size should be 24*60*320*240*3=316MB (frame rate*resolution*colordepth/3*... |
500 kilo **bits** per second for 60 seconds. The information is compressed to fit within the bit rate in a possibly lossy format.
8 bits = 1 byte.
So its $500 / 8 * 60$ kilobytes.
Thats 3750 kilobytes. |
500 kilo **bits** per second for 60 seconds. The information is compressed to fit within the bit rate in a possibly lossy format.
8 bits = 1 byte.
So its $500 / 8 \times 60$ kilobytes.
Thats 3750 kilobytes. |
For example, in finite-state machines (FSM), the main difference between a deterministic (DFA) and a non-deterministic machine (NFA) is that there are possibly more branches or outputs for each input, depending on how a machine the machine was built. In terms of computational power, are these two the same? |
How does nondeterminism affect the power of a machine? |
|turing-machines|finite-automata|turing-completeness| |
Since the non-determinstic behaviour can be simulated via the deterministic version of the machine where new states are created for all possible combinations of simultaneous states of the non-determinstic one. There is no added computational power for reaching for the non-deterministic one. NFA and DFA are just as powe... |
Since the non-determinstic behaviour can be simulated via the deterministic version of the machine where new states are created for all possible combinations of simultaneous states of the non-determinstic one. There is no added computational power for reaching for the non-deterministic one. NFA and DFA are just as powe... |
**For finite state machines:**
Since the non-determinstic behaviour can be simulated via the deterministic version of the machine where new states are created for all possible combinations of simultaneous states of the non-determinstic one. There is no added computational power for reaching for the non-deterministic... |
IMO speaking of algebra here is irrelevant. No computation is ever made on the strings (be them bits or quaternary digits), no boolean operation, only comparisons for equality.
Furthermore, if you somehow encode the digits 0-3 or symbolic values like A T G C, the representation will most probably end-up as the binar... |
IMO speaking of algebra here is irrelevant. No computation is ever made on the strings (be them bits or quaternary digits), no boolean operation, only comparisons for equality.
Furthermore, if you somehow encode the digits 0-3 or symbolic values like A T G C, the representation will most probably end-up as the binar... |
The question is the conversion from an animation to a video file with the following attributes:
Frame rate:24 fps
Resolution:320*240 pixels
Color depth:24 bits
Length of video: 60s
Bit rate: 500kbps
I calculated that the file size should be 24*60*320*240*3=316MB (frame rate*resolution*colordepth/3*re... |
The question is the conversion from an animation to a video file with the following attributes:
Frame rate:24 fps
Resolution:320*240 pixels
Color depth:24 bits
Length of video: 60s
Bit rate: 500kbps
I calculated that the file size should be 24*60*320*240*3=316MB (frame rate* resolution* colordepth / ... |
It is said that **PBFT (or Practical Byzantine Fault Tolerance consensus)** is **Byzantine** fault tolerant (unlike Paxos or Raft that are only Crash fault tolerant.)
Based on this answer : [LINK][1] , in PBFT ***"a new leader is elected only if there is a suspicion that the old leader is no longer available."***
... |
While porting an algorithm, I having a bit of a problem with finding an efficient algorithm for finding a linear combination of piecewise functions. The procedure is described in the Table 3 of the appendix of the SIRUS algorithm by Bénard et al. (https://proceedings.mlr.press/v130/benard21a.html).
The problem is de... |
Efficient algorithm for finding linear combination of piecewise functions |
|algorithms|machine-learning|statistics| |
A Hopfield (neural) network is introduced <!-- by that book, *Algorithm Design* by Jon Kleinberg and Éva Tardos --> as an **undirected** network satisfying some conditions in that book. The book proves that the State-Flipping Algorithm always terminates.
------
The book also introduces a directed Hopfield network... |
I am looking at the state flipping algorithm, an algorithm that tries to find a stable configuration in a Hopfield network.
The algorithm simply flips the state of unsatisfied nodes as long as the the network has not reached a stable configuration.
Please check page 673, chapter "An Application of Local Search to... |
|algorithms|neural-networks|search-problem|local-search| |
A Hopfield (neural) network is introduced <!-- by that book, *Algorithm Design* by Jon Kleinberg and Éva Tardos --> as an **undirected** network satisfying some conditions in that book. The book proves that the State-Flipping Algorithm always terminates.
------
The book also introduces a **directed** Hopfield net... |
> The benefit here is that there would be no network latency and subsequently no network traffic.
This is slightly incorrect, there would definitely be some network latency since within clusters we have separate machines connected by LAN, although the intra cluster latency would be very less compared to inter clus... |
> The benefit here is that there would be no network latency and subsequently no network traffic.
This is slightly incorrect, there would definitely be some network latency since within clusters we have separate machines connected by LAN, although the intra cluster latency would be very less compared to inter clus... |
There are six possible orderings of three numbers. You can distinguish between six states with two 2-bit codes and four 3-bit codes; that is the lower bound if all orderings are equally likely. Average number of bits = 2 2/3rds.
Since you can’t have arbitrary tests but only comparisons between two items, you won’t ... |
Let's say we have the following Recurrence Relation:
$$ T(n) = \begin{cases}
1 & n=1 \\
3T(\frac{n}{3}) + \Theta(n) & \text{otherwise}
\end{cases}
$$
I've been taught I can study its complexity by giving into input a power of 3 to calculate its height and consequently its total... |
How to prove that we can study the complexity of Recurrence Relations by always giving in input a power of how many children each node creates? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.