instruction
stringlengths
35
29.1k
There is a popular proof for the undecidability of the PCP (Post correspondence problem), which is outlined here: https://en.wikipedia.org/wiki/Post_correspondence_problem I'll assume whoever will answer the question will be familiar with this proof. I have seen this proof elsewhere and this kind of proof always menti...
As I understand, everyone can create logic programming language and system by declaring that the valid program of some logic programming language is the set of statements in the form: body->head, where body is arbitrary expression of boolean type and the head is set of expression that, in some cases, can change the cur...
Are there any standard persistent data structures that facilitate the following? tabulating, for each arc in a rooted, oriented, acyclic multigraph, the set of root-emanating paths containing the arc keeping accurate tallies of path collections as arcs are added to and removed from the graph My research to this point...
I face a problem that is related to (strongly) connected components. Let $G=(V,E)$ be an undirected graph. I want to find subgraphs $G_1,G_2, \dots,G_n$ of $G$ such that they do not overlap (i.e. don't share any nodes) each two nodes in a subgraph are connected by an edge, i.e. $\forall i \forall n,m\in V_i$ then $\{m...
A list of n strings each of length n is being sorted in lexicographical order using the merge sort algorithm. Since we have to take care of comparison of each character in the strings so the merge step would be $O(n^2)$. So the recurrence should be of the form $$T(n) = 2T(\frac n2) + O(n^2)$$ By master's theorem it s...
I built the next automaton: I have problem to prove $L = L(q_0)\cup L(q_1)$, (when $L(q)$ denotes words $w$ such that $\hat{\delta}(q_0,w) = q$ at a given DFA) because semantically $L(q_0)$ is the language of words over $\{a,b\}^*$ which don't start with $a$, and $L(q_1)$ is the language of words which start with $a$ ...
How to approach this question ? I have no idea regarding the method to be applied for solving such kinds of problems .
I am currently learning Supervised ANN training using Backpropogation and I am stuck in this exercise. I calculated the δA using the equation at the bottom of the screenshot, however, I am unable to calculate δB because the weight of BD is not given. How do I find the weight of BD?
I am interested in constructing simple connected graphs where each vertex has a fixed number of edges (degree) ahead of time. I had originally assume I could use some modification of the Havel-Hakimi algorithm to do this, but Havel-Hakimi isn't actually guaranteed to produce connected graphs. Are there any known algori...
The symmetric difference of $L_1$ and $L_2$ is defined to be: $(L_1-L_2) \cup (L_2-L_1)$. Problem: I’m trying to prove that given L a non regular language and F a finite language there symmetric difference yields a non regular language. Although this looks like it should be a very simple problem and it seems very obvio...
I have been exploring Dikstra partitioning Algorithm. Below are my given: R = Red W = White B = Blue I have this unpartitioned array. | W | B | R | W | R | W | B | W | W | I want it partition in the format: R, W, B consecutively. | R | ? | W | B | 0 i j k n Given: i = 0 j = n k = n n ...
What are the reasons that FHE is so slow? Is it possible to make the FHE algorithm so fast that it can be used in practice (say, the practical FHE algorithm should be slower no more than 10 times compared to conventional calculations)? Or there is some fundamental limitation and any FHE implementations will always be ...
In the $F\star$ tutorial it says Dv, the effect of a computation that may diverge; what does diverge mean here? It's not explained and it confuses me. I guess it means the type consists but the value varies, but if so why there isn't a non-diverge non-terminate effect?
If there is an algorithm running in time $O(f(n))$ for some problem A, and somebody comes up with an algorithm running in time, $O(f(n)/g(n))$, where $g(n) = o(f(n))$, is it considered an improvement over the previous algorithm? Does it make sense, in the context of theoretical computer science, to come up with such a...
We have given graph of at most $200$ nodes, we want to split the given graph in two parts, such that the number of nodes with even number of edges is maximized, note that the edges that are between nodes of different parts are destroyed and not counted. All possible splittings are allowed, even the one where all nodes ...
I have the transition matrices of two communication channels. I am able to find the capacity of each by performing an optimization calculation, however I need the total capacity of the two channels. The channels are not weakly symmetric so I don't think I am able to simply add the two capacities. I think what I need to...
I'm trying to decode the following Hamming sequence (using EVEN parity and knowing there is a 1-bit error), which contains an ASCII value: 01100110101 I've tried to check for the correctness of each parity bit: p1 p2 d3 p4 d5 d6 d7 p8 d9 d10 d11 0 1 1 0 0 1 1 0 1 0 1 p1 - 0 1 0 1 1 ...
I am looking for an algorithm(s) that can compute a global ranking (partial ordering) given individual rankings, in some kind of principled manner. I want to establish a partial-ordering of some projects, and had some users create their own partial orderings. I've looked at these algorithms so far: borda-0 borda-1 Dow...
Assume a process execution interrupted at the middle and CPU started executing a different process.How does the OS handle this situation?
Description of the problem: I am modeling checking a distributed protocol against a global property with TLA+ developed by Leslie Lamport. The global property is defined on all states of a behavior (more details can be found below). However, by the nature of exhaustive enumeration of model checking, the state transitio...
Assume we are given a set $X = \{x_1,...,x_n \}$ of size $n$, and a probability distribution $P$ over $X$. I am interested in an algorithm $A$ which can sample from $X$ according to $P$, i.e. $\Pr(A=x_i) =p_i$. More specifically, I assume $A$ can generate a uniformly distributed real number in the interval $[0,1]$ in a...
I'm looking to solve this planning problem. Any pointers or ideas are much appreciated! You have a number of i individuals i = { 1, 2, ..., n } that need to perform tasks. Tasks are performed in teams, with a fixed and given amount of required individuals per task (2,3 or 4). For each individual it is known which task...
In A First Course in the Numerical Analysis of Differential Equations (page 26) Arieh Iserles gives the following derivation: \begin{equation} \frac{\rho(w)}{\ln(w)}=\frac{\xi+\xi^2}{\xi-\frac{1}{2}\xi^2+\frac{1}{3}\xi^3+\mathcal{O}(\xi^{4})}=\frac{1+\xi}{1-\frac{1}{2}\xi+\frac{1}{3}\xi^2}+\mathcal{O(\xi^3)} \end{equat...
Is there a proof that all terms of type $\forall{a}. a$ are operationally $\bot$, in a non-weakly-normalising version of System F? If you ask a free theorem calculator such as this one for the free theorem of $\forall{a}. a$ (written just $a$, as the tool adds implicit $\forall$s for each free type variable), you get t...
I was reading about UDP and TCP. TCP is a stream-oriented, connection-oriented protocol and always delivers the segments in order to the application layer. But UDP being connectionless, does it also always deliver the datagrams to the application layer in order?
According to this answer, a random graph on $n$ vertices is a graph which has each of the $n\choose2$ edges independently with probability $1/2$ each. The probability of at most $3n-6$ edges (which is a necessary condition for planarity) is: $$2^{-n(n-1)/2}\sum_{k=0}^{3n-6}{n(n-1)/2\choose k}$$ Therefore, the plot for...
By what provision is context switching disabled in a process ? Or is it the case that if a process is in in kernel mode , context switching is disabled by default ?
We are given an array A of size n and we have to rotate it in left direction by d positions. So e.g. if A = {1, 2, 3, 4, 5, 6, 7} then for d = 2, the resultant rotated array is {3, 4, 5, 6, 7, 1, 2}. One algorithm which does this goes as follows: Reverse A[0..d-1] (0-indexing) Reverse A[d..n-1] Reverse A[0..n-1] Thes...
I am working on a problem that can be simplified to consist of the following: an initial symbol tree a list of interpretations (an interpretation is a transformation guarded by a predicate) a predicate describing what the target symbol tree should look like Where the goal is to find a path from the initial symbol tre...
Suppose I have $n$ balls. Among them, there are $m \leq n$ black balls and the other $n - m$ balls are white. Fix a random permutation $\pi$ over these balls and denote by $Y_i$ the number of black balls in the first $i$ positions of our permutation $\pi$. I would like to show that $Y_i$ is sharply concentrated around ...
Is it an $NP$-hard problem? You're given an undirected graph $G(V,E)$ with vertex weight $w: V \to \mathbb{N}$ and a function $\mathrm{max}$-$\mathrm{visit}: V \to \mathbb{N}$ and a number $W$. Does there exists a path in $G$ with total weight $W$ that does not visit any vertex $v$ more than $\mathrm{max}$-$\mathrm{vis...
Branch tables are usually described as an efficient way a compiler can implement a switch statement, and that actually seems how GCC and Clang do it (and LLVM even has an opcode just for that). If a sequence of if statements is used (instead of a switch), GCC doesn't seem to generate a table, but Clang still does. Give...
Is it an $NP$-hard problem? You're given an undirected graph $G(V,E)$ with edge weight $w: E \to \mathbb{N}$ and a function $\mathrm{max}$-$\mathrm{visit}: V \to \mathbb{N}$ and a number $W$ in unary. Does there exist a path in $G$ with overall product of edge weights equal $W$ and that does not visit any vertex $v$ mo...
I came across this circuit that swaps logical signals: However I don't understand why would you need to use logic gates. Would it be possible to just connect the A on the left to the B on the right and the same with the B on the left (maybe add a diode to prevent current from going back?). And one last question; would...
I am following the quicksort analysis in CLRS (pp. 181-184, 3rd edition). Let me summarize the setting of the analysis. Setting in CLRS First let $Z = \{z_1, ..., z_n\}$ be the set of elements of the input array $A$ in sorted order. $X$ is defined as the number of comparison we make (i.e., between pivot and an element)...
I fail to see a contradiction in the halting machine proposed by Alan Turing. Definition of halting machine Where H = all possible programs that terminates N = all possible programs that do not terminate $N_p$ = a program that does not terminate e.g.while True do x:=0 T = true F = false if a program outputs T or...
I'm doing this course: Engineering: Algorithms1 - SELF PACED Algorithms: Design and Analysis, on Stanford's website. And the first assignment asked us to count the inversions in an array. The idea that they used was: Break the original array in half. Count the inversions in each half Pass the original array through me...
I am currently in the process of writing an IB Extended Essay on the efficacy of multithreading on increasing the performance of applications. So far, I have been able to deduce that there are three main multithreading techniques: Cooperative/Coarse-Grained/Block Multithreading Preemptive/Fine grained/Interleaved Mul...
my solution is that $L\in co-RE$ by showing that $\overline{L}\in RE$ TM $M$ on input:$\langle M_1,M_2,w\rangle$ Build TM $M_1,M_2$ Simulate $M_1$ on $x\in\Sigma^*$, before that check if $x\neq w$ If $M_1$ accepts some $x$, than Simulate $M_2$ on $x$ If $M_2$ accepts than $M$ accepts. If $M_2$ reject, that we back at ...
I'm asking the question here because it's not a purely mathematical question and the answer also depends on how computers work. I think that according to the Wikipedia article Bailey–Borwein–Plouffe formula, there is a spigot algorithm for quickly computing in terms of any natural number $n$ expressed in binary the $n^...
So in this math exchange question I asked, it was proven that for $n>2$ dimensions, you can always find a curve that separates $k$ points in $n$-dimensional space into $2$ arbitrary sets that you pre-defined. What I wanted to know is if there is a polytime algorithm (polynomial in $k$) for determining this curve. If so...
Let's I have to make the following reduction: $$\text{CLIQUE}\le_p \text{VERTEX-COVER}$$ The technique of building the reduction is - Assume you can find a $\text{VERTEX-COVER}$ of size $k$, in polynomial time. Building a new graph, in which I say that if a $\text{VERTEX-COVER}$ exists of size $k$, then in the origina...
I know I must be getting stuck on notation. However, I'm having trouble following the logic in Example 1.2 in https://arxiv.org/pdf/cs/0611018.pdf. They define what preserving a propositional formula means. So, I'm trying to understand a basic example. Take X = A or (Not B) or (Not C) as an example Horn Clause. Defi...
Let $L$ denote the (context-free) language of matched parentheses over the alphabet $\Sigma$. Consider the following problem: Input: words $x_1,\dots,x_n \in \Sigma^*$ Question: does there exist a permutation $\sigma$ of $\{1,\dots,n\}$ such that $x_{\sigma(1)} x_{\sigma(2)} \cdots x_{\sigma(n)} \in L$? What is the co...
I am looking for a data structure to store a set such that given two instances of size $O(n)$ which are known to have non-empty intersection, the minimum element of the intersection can be found in $O(\log n)$ time. Is this possible to achieve, either for worst-case or amortized complexity? Other requirements for the d...
Given a cycle of $n$ vertices and each vertices of the input graph $G$ assigned a weight. We want to find an independent set of cycle such that weight of the vertices taken in the independent set is maximum. A brute force way is consider cycle as a set of three consecutive vertices and pick the one with max weight, bu...
Subject reduction is a well and widely used property of typed rewriting systems. Subject expansion is much less known. What are the applications of this property and which systems enjoy it?
I have an array of length $n$ representing a time series of data. I want to implement a moving (sliding) window of length $k < n$ and calculate things like sliding median, sliding quantile, sliding trimmed mean, etc. Each of these requires the data to be sorted prior to calculating the statistic of interest. Therefore ...
I am looking for a suggestion. I know it is possible to construct a binary tree from an array. I want to know that vice verse is true? Is it possible to construct an array from a binary tree? If yes how could I construct it? Any well known algorithm for that? I am looking for suitable datastructure in Java. Thank you i...
I can't understand why $\epsilon$ is accepted. I thought if $\epsilon$ is inputed then it would go from $q_1$ to $q_3$. $a$ is also accepted, but I though if $a$ is inputed then then the NFA would die, because in $q_1$ there's no where to go. I read on another post about $\epsilon$ being at two states at the same time...
I want to pick k objects from a pool of n. Not any k objects, the optimal k objects: that which minimizes the cost of the set, defined as the sum of pairwise costs for all pairs within the set. What NP-complete/hard problem is this an instance of? What is a good (i.e. fast but finds a low cost) way to solve this proble...
With the randomised algorithm for Pi approximation (see https://www.geeksforgeeks.org/estimating-value-pi-using-monte-carlo/ ), I keep wondering why just using points with an even distance should'n work just as fine. Obviously, with the montecarlo method you get a better approximation the more random points you generat...
The problem: This is a reduced version of a problem I currently have. I have a list of edges as input. This list contains the names of 2 nodes (the edge connects these 2 nodes) and 2 x 2D coordinates (which is the start and the end of the edge). The nodes can be in an arbitrary order, and the whole list can contain dup...
I was taking course on compilers by Alex Aiken. You can find the slide discussing handles on this page. On the page of the slide, the instructor defines handle as follows: Assume a rightmost derivation $\require{AMScd}$ \begin{CD} S @>{\text{*}}>> \alpha X\omega @>{}>>\alpha\beta\omega \end{CD} Then $\alpha\be...
Question is: Calculate the minimum absolute difference between the maximum and minimum number from the triplet a, b, c such that a, b, c belongs arrays A, B, C respectively. There is another question: Find i, j, k such that : max(abs(A[i] - B[j]), abs(B[j] - C[k]), abs(C[k] - A[i])) is minimized. Return the minimum ma...
What is the regular expression for language containg no. of 011 equal to 110 in string ?
I am attempting to implement IDAstar and so just need to double check my reasoning. Suppose I am trying to solve the following pancake sorting problem using IDA-star assuming all operations have a cost of 1 and assuming that I am using the zero-heuristic: start state= 1 0 2 3 4 5 goal state= 0 1 2 3 4 5 I believe t...
everybody, I'm trying a whole day to compute this recursion. I will be grateful if someone can try and solve it $$T(n)=2*T(n/2)+2/\log(n),$$ where $\log n$ is the logarithm to the base 2 - of course! thanks!
A disk pack has 12 platters ( plates) having 2048 tracks on every surface. It can store 1024 bytes per sector ( assume each track has 512 sectors). Calculate the storage capacity of this disk in GB.
There is an NP-hard problem called Minimum k-Union where we are given a set system with $n$ sets and are asked to select $k$ sets in order to minimize the size of their union. I'm currently interested in a very similar problem, but don't know how to convert one to another: Given a set system with $n$ sets and a bound $...
It seems to me that Fine-grain call-by-value already subsumes CBV and CBN, using lambdas as thunks. What does CBPV improve upon FG-CBV or in what way is it "better"?
Consider a zero-indexed array representation of a binary tree (as in a binary heap), where 0 is the root The left child of i is L(i) = 2*i+1. The right child of i is R(i) = 2*i+2. Is there a simple predicate S such that S(i,j) means j is in the subtree rooted at i? It should preferably be quickly computable with some...
I was reading the paper on Jump consistent hashing, and I'm having some trouble understanding one particular line (page 5, paragraph 2) "Since we want P(j ≥ i) = (b+1) / i, we set P(j ≥ i) iff r ≤ (b+1) / i." My understanding is that: P(j ≥ i) is the probability that a key "jumps"/moves to a different bucket after buc...
I think it should be false because there may be more than one edge with the same weight.
Question: Consider the DFS tree generated by a DFS on a connected graph. Write below the necessary and sufficient condition for a node v to be a leaf node on the DFS tree. The condition must be in term's of v's discovery time d[v] and finishing time f[v]. I honestly have no idea what the answer to this question from a...
I have a problem similar to Shortest path problem where edge weight depends on path taken but not quite the same. In my case each edge has either a fixed finite weight, or an infinite weight, depending on which path has been followed. So depending on the path taken through the graph, some edges from the current node ar...
Suppose f is a constant-time function. Is it always possible to apply it n times in O(log(n)) time? Example If f is not, then, apply_not_n_times(n,bool) = if n % 2 == 0 then bool else !bool, which is O(log(n)), since it is linear in the number of bits. That means the answer is yes for that particular choice of f. I wo...
I have been implementing some neural networks in MATLAB and recently I noticed a weird thing while implementing softmax derivative: Setting the derivative to one, rather than using the actual derivative converges faster. I have to admit that the derivative of softmax in particular confused me quite a bit, since the ...
For AVL trees, which one of the following is possible as the tree size (expressed in term of the tree height h)? Recall that the size of a tree is the number of nodes in the tree. A. $Θ(h^{2.1})$ B. $Θ(1.1^h)$ C. $Θ(1.9^h)$ D. $Θ(2.1^h)$ So this question came up on my midterm and I don't understand why the answer is C...
Can anyone help me understanding this exercise? We define the SIMD utilization of a program run on a GPU as the fraction of SIMD lanes that are kept busy with active threads during the run of a program. The following code segment is run on a GPU. Each thread executes a single iteration of the shown loop. Assume that th...
Let T be an AVL tree of height 3. What is the smallest number of entries it can store? Note that a tree with one node (only the root) has the height of zero and stores one element. The only method I could think of was just drawing an AVL tree and trying to minimize the number of nodes in which I get an answer of 7. B...
I'm studying OS and I came up with this scenario where the OS works with a paging scheme and virtual memory, and a process wants to start running, but in memory, there's not enough space to allocate the minimum pages the process needs. So I was wondering, will the OS try to allocate the process pages and end up thrash...
Consider the following procedure computing a dummy function. Which one is a correct asymptotic bound for the running time of F(N) expressed in terms of N? F(i): if i<3then return 0 end if return F(i−1) + F(i−2) $• A. O(N) • B. O(N^2) • C.O(2^N) • D. O(N log(N))$ This may seem like a dumb question...
A comment was made to me saying the following in relation to Kolmogorov complexity:- You're not the first to think non-computability = impractical or even useless. But it can be useful. In particular to random, "non-algorithmic" data. I now have a physical box on my bench that outputs perfectly random bytes with th...
One common observation in type systems is that having subtyping makes type inference hard [1]. Consequently, for records, many modern functional languages shun subtyping (OO style) in favor of row polymorphism. Some examples include: Ur/Web - duplicate labels are disallowed, the programmer uses first class disjointedn...
I'm currently using the Heavy-Hitters algorithm as described here and I'm wondering what if any space, time, accuracy, or real-world performance differences I would see if I were to switch to an implementation of Count-min Sketch plus a linked list to store the "heavy hitters" instead? As far as I can tell, both requir...
I work on the topics of sparse coding (SC) and dictionary learning (DL), in which classification is not the main goal, but the discriminative power of the representation is one of the concerns. Therefore, i use classification accuracy in order to show how my method is more discriminative than other SC or DL approaches....
I've been doing the HPC course from Udacity (https://classroom.udacity.com/courses/ud007/l) One of the problems is as follows (apologies for the image, as I was unable to format this using $\LaTeX$): Here, we assume a RISC processor. The text says: For consistency with the rest of the text, we use MIPS64, the 64-bit...
I want to represent a fishing network using a graph representation. My question surrounds how I can write the adjacency matrix if there are two types of connections, which I want to capture together. Here's the most basic setup. Say there are two people represented by nodes. Person one owns a fishing right and also ...
I want to use a PRNG to generate random patterns. I would provide the PRNG with a hash value as a seed. Ideally, the seed size would be 64-bit or 128-bit and I would expect no collisions if the seeds are unique. Do PRNGs encounter 'collisions', where two different seeds produce the exact same sequence of random numbers...
I have a directed weighted multigraph whose vertices are sets of URLs. We add to this multigraph all edges of the form $i\to j$ where $i\subset j$ (such edges are of zero weight), where $i$, $j$ are vertices of the graph. Now having a set of source vertices and destination vertices, I need to find the minimum weight pa...
How to prove that a string, s is made up of n > 1 subsequences occurring some arbitrary number of times using concatenation and stripping first and last character? E.g s = xyzxyz, subsequence is xyz and it occurs 2 times. The solution is to concatenate the same string e.g. xyzxyzxyzxyz and then strip the first and las...
When we compute the complexity of calculating factorial of a number $n$ why is it in terms of $n$ instead of the number of the number of bits occupied by the number of bits occupied by $n$ (like we do in number-theoretic algorithms like primality checking etc.)?
I solved bunch of questions which give some function and then ask to implement it with minimum number of gates of specific type, each having specific number inputs. I was making mistakes in all those problems by not implementing given function with minimum number of gates. Let me give those problems one by one and expl...
Sorry if this seems like a dumb question, but what what type of logarithm is $\log$ in Wikipedia articles? Cheers.
This article shows some of the issues. But basically, on the web, you have fillStyle and strokeStyle, and in WebGL you have those different ways of rendering primitive lines, but you end up needing workarounds to draw more complex lines. In CSS borders don't have patternable backgrounds, etc. Wondering why this limitat...
In particular, was there any kind of implementation at the time Christopher Strachey wrote Fundamental Concepts in Programming Languages? In that work, Strachey lists Ad Hoc and Parametric polymorphism as the two main classes of polymorphism. But while examples of limited ad hoc polymorphism can be found in languages ...
Let take a multi-dimensional array: $a[2][3][4]$ Here $a$ is a three-dimensional array, which means that it is a collection of two-dimensional array's. Therefore sizeof(a) = No.of 2D arrays * Size of each 2D array = $2*(3*4) = 24$ elements. Now my observations are: If Row Major Order is taken, then we have 2 arrays of...
I came across this paper (page 16) which explains how to calculate the size of B+ trees. According to it the maximum number of nodes at level $i$ is $2(n/2)^{i-1}$ for a B+ tree of order $n$. Thus a B+ tree of $l$ levels will contain at most $\sum_{i=0}^{l} 2(n/2)^{i-1}$ nodes (*). But we also know that for example for...
I've seen a few questions posted regarding the upsides/downsides of floating point formats that have explicit integrals vs. formats that have implicit integrals, but have not seen an answer that really handles my question about it. By integral, I mean the single digit to the left of the radix point. Let's assume that t...
Consider a $n \times n$ matrix $A$ with $k$ nonzero entries. Assume every row and every column of $A$ has at most $\sqrt{k}$ nonzeros. Permute uniformly at random the rows and the columns of $A$. Divide $A$ in $k$ submatrices of size $n/\sqrt{k} \times n/\sqrt{k}$ (i.e. $\sqrt{k}$ meta-rows and meta-columns). Enumerate...
I have an almost sorted linked list containing N distinct elements with only 1 element not in it's place. Every implementation I have seen start insertion from the beginning (unlike insertion sort on arrays) therefore the complexity will be $O(N^2)$.
The code below is in F#. It creates a scene which looks like a perspective coming from the top left. I thought if I would change i % j = w then it would come from the top right instead, but that doesn't work. So what change do I need to make for it to be able to come from the top right, bottom left, bottom right and ev...
Consider a two-player game. A winning strategy of a player is a strategy following which the player can always beat his opponent, no matter how his opponent responds. A game can be unfolded to a state space consisting of the possible ways of both sides of the game. How to express the existence of winning strategy of t...
Set $I_n = \{0,\ldots,n-1\}$. Given integers $v_0,\dots,v_{n-1} \in \mathbb{N}$, find an integer $t>0$, a map $f:\mathbb{N} \times I_n \to \mathbb{N}^t$, and a well-founded order $>_t$ on $\mathbb{N}^t$ such that: $$\forall i \in I_n, m \in \mathbb{N}. f(m,i) >_t f(m+v_i,i+_n 1)$$ where $+_n$ is addition in $\mathbb{Z}...
In this paper, page 4, it is said: "...there is always a constant expected number of elements that map to the same slot" Assume we have a set $S$ of $n$ values, and we want to insert them into a hash table. Let's fix some parameters: let $d$ be the hash table's bin/slot capacity, i.e. the bin will get more than $d$ el...
I discovered that SpaCy had the ability to make dependency trees. For instance given a question “To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?” We can create its dependency tree with the following code : I know that it is a set of edges $E$ which represents the relations of labeled dependenci...
Given an array with n real numbers, each in the range [0,1], I need to sort them. Moreover, the only operations that are allowed are comparisons or copying. It means I cannot multiply or divide the numbers, which prohibits me from using bucket sort. From what I learned, when you use only comparisons you cant sort any f...
I am trying to find $T(n)=O(f(n))$, where $$T(n)\leq n^2+n\left[T(n-m)+T(m-1)\right],$$ where $m\in\{1,2,\ldots,n\}$. Is it possible to find $f(n)$ such that $T(n)=O(f(n))$? I started to fix $m=n/2$ (which I assume the worst scenario, isn't it?). I found $$\begin{align}T(n)&\leq n^2+\frac{n^3}{2}+\frac{n^4}{8}+\frac{n...
I'm studying time complexity of Union-Find data structure. I saw time complexity of union and find function depends on some conditions. without anything: $O(N)$ with Union by Rank: $O(\log N)$ with Path Compression: $O(\alpha(N))$ which is inverse Ackermann function. I understood $O(N)$ because of skewed tree of disj...