instruction
stringlengths
35
29.1k
Disclaimer This is not from an ongoing contest, this is from my course on edx of ITMO. Also this is a paid courses so the direct link to the problem is not useful unless you also register this course. Problem description A garland consists of light bulbs hanging from the same wire. One endpoint of this wire is fixed a...
Given a sorted array of distinct integer $A[1,2.....n]$ the tightest upper bound to check the existence of any index $I$, for which $A[I]=I$ is equal to _______________ ? I thought here answer that mean time complexity will be $O(1)$, because directly getting the searching index and then checking if $A[I]=I$, but answ...
$L =\{a^nw \mid w \in \{b,c\}^*$, $n=$ #$_b$ + #$_c$$\}$ $\bullet $ #$_b$ denotes the number of $b$'s in $w$ $\bullet $ #$_c$ denotes the number of $c$'s in $w$ I have some trouble designing a CFG for the language above. How can I do this?
I need to study how synchronization is done in a multiprocessor operating system, but I am unable to find a good source. I have read about it in the book "Modern Operating System" by Tanenbaum, but I need to study the actual implementation in more detail. Any good book/paper or online blog post will do.
The proof for the lemma from "Introduction to Algorithms by Cormen et. al." is not clear for me. I can't comprehend a few things. Here is a lemma and its proof. My questions are below. The notation $\delta(u, v)$ is used to denote shortest-path from $u$ to $v$. Question 1: Because of how we chose $v$, we know ...
I need a Context Free Grammar for this language. I could come up with this solution: S -> AB A -> aA | ε B -> bbbB | ε But, this grammar is clearly wrong, since the number of a's can still exceed the number of b's. How do I draw a link between the two variables A and B such that $n\leq m+3$? P.S. It is a humble reques...
I'm trying to figure how to implement face insertion in a halfedge data structure to represent 3D meshes, I think it's safe to assume I'll only deal with meshes that have disc topology. Although I've asked here to help me out with the understanding of the algorithm (taken from the open-mesh library). However I just rea...
I've been trying to find interesting applications of union-find that are lesser known. Here are some popular algorithms based on union-find that I know: Kruskal's algorithm for MST Tarjan's off-line lowerst common ancestors (LCA) algorithm 1 Solving range minimum queries using union-find by reduction to LCA (with $O(m...
I have two algorithms. What are their time complexities? The first algorithm checks the modulo of all odd integers from $3,5,...\sqrt{n}$. The second algorithm generates a list of prime from $2,3...,\sqrt{n}$ and divides the input, $Num$ by these primes. Algorithm 1 needs $\sqrt{Num}/2$ modulo divisions in the worst ca...
For this question, I have the alphabet $\Sigma=\{0,1,2,3,4,5,6,7,8,9\}$. I also have the language $L$ over $\Sigma$ described as the language such that the strings $w$ contained in $L$ are powers of 2 and $w$ is treated as a decimal number. I then need to: Design a grammar to generate $L$ Classify the grammar (Regular...
I am solving the task that is as follows: Input: a polygon. Can be any kind of polygon without self intersections. Can be a non-convex and with holes inside. Goal: to cover it with 2 (at least) or more parallelograms that together are equal to or contain the whole polygon. The following criteria should be met: There i...
There is a League. And there are Divisions, that are the disjoint subsets of this League. There are n teams (unique locations are given, let's assume it's x and y for simplicity reasons). Every team must belong to exactly one Division. There are min and max - minimal and maximal amount of teams per division. Every team...
Consider a relation $R\left ( A,B,C,D,E \right )$ and functional dependencies are  $F=\left \{ AC\rightarrow B,C\rightarrow D,A\rightarrow E,C\rightarrow B \right \}$ Relation $R$ is decomposed into  $R_{1}\left ( A,B,C \right )$ and $R_{2}\left ( C,D \right )$ Then Is it a lossless decomposition? I am getting doubt, h...
If I have some source sending codewords and I take a large sample of codewords in order to construct an empirical distribution of the codewords sent. Using this empirical distribution, what methods can I use to demonstrate/prove (statistically) that the source is not a Markov source?
I'm having trouble understanding how to convert this language to context free grammar. $\{a^ib^jc^k\mid i > k, 0\le j \lt3, k \ge 0\}$ Part im getting stuck on is how to deal with a and c, whenever a c is added, you must also add an a, but with them at opposite ends of the string how do you properly build grammar for i...
I am searching for algorithms to estimate the radius of a graph, and I found out that there are papers about the spectral radius of a graph. As far as I know, the radius of a graph is $\min_{v \in V} ecc(v)$ where $ecc(v)$ is the depth of a tree rooted at $v$, and the spectral radius of a graph is the largest eigenvalu...
You want to organize a party and invite as many of your N friends as possible so that the following condition is met: at a party, everyone invited must know at least three other guests and must not be familiar with at least three other guests. Question: what is the fastest algorithm that receives a list of couples of p...
I have this assignment Describe in words how a DTM can simulate a NTM Describe in wordshow a NTM can simulate a DTM I'm working on this request and I'm crushing with the comparison. 1-I understand that every NTM can be represented by a DTM with a tree structure, that represents every step of the different possibil...
Tried to research here and on other sites with no luck regarding finding the maximal and average number of time slots in an Adaptive tree walk protocol. i'll explain what i mean here: In a simple(provided an image for illustration at the end of the post) Adaptive tree walk protocol, Divided by time slots where a statio...
Consider the following paragraph from the deeplearningbook The training and test data are generated by a probability distribution over datasets called the data-generating process. We typically make a set of assumptions known collectively as the i.i.d. assumptions. These assumptions are that the examples in each ...
I'm trying to prove a language is not regular through using pumping lemma, but can't seem to come up with any way of doing it. The alphabet is: $$ \Sigma = \{c, d\} $$ The language is: $$ A = \{z \in \Sigma^* \mid c(z) > d(z)\} , \text{where $c(w)$ and $d(w)$ means occurrences of $c$ or $d\in z$ }$$ I tried to define...
I'm going over past exam papers with this question: The answer to a). will be (height of 5): For b.): I assume the height function will be to find the height of the tree. So, I will have to compare right and left sub-trees and get the tallest subtree + 1(root node) = Height But what happens if there is a duplicate n...
Building on this example and others found elsewhere we have two types of loops, definite and indefinite: definite being a loop that has its number of iterations known before it is executed. E.g. a for loop: for x in range(1,10): and indefinite loops which don't have the number of iterations known before it is executed...
Is Merge Sort the best sorting technique to sort a linked list? Also, which sorting technique is worst for a linked list? Merge sort uses a divide and conquer method. What makes merge sort efficient for sorting a linked list?
I believe that solving a Jigsaw puzzle is in general NP-complete based on the two questions linked below. However, I'd like to implement a heuristic algorithm that works well in practice. Let's assume the puzzle pieces are encoded as 4-vectors of integers representing the four sides. A negative integer indicates an ind...
I have a language $L$: $$L = \{w : a^ib^j; i > j \}$$ I need to prove this language is not regular using Pumping Lemma. I'm wondering if I'm doing it correctly: $L$ Is assumed to be regular. A regular language means that a DFA exists that can produce all the strings in $L$. So I need to find a string that exists in L ...
I found a couple of answers online but I don't quite understand why the answer is right: The length of a string is: If a string has no characters, then its length is 0. Otherwise, the length of the string is 1 + length of the tail
I tried to look on the site and while I found some similar questions, I did not find the first order logic formalization of the following sentence (the basic barber's paradox), so I wanted to ask if I got the right first order logic formalization of it, and I am sure others will benefit from this thread as well. Senten...
This came from a picture of something that I'm supposed to make, and I can't find it in the program I'm supposed to use (LogicWorks). It looks like it 'not's only one of its inputs, but that doesn't make sense because that input comes from a not gate (not pictured here); it would make more sense for this part to be no...
In "Concurrent Support of Multiple Page Sizes On a Skewed Associative TLB" (2004; PDF), André Seznec proposed using overlaid ways with different indexing functions with guaranteed avoidance of bank conflicts. This mechanism allows TLB look-ups for multiple page sizes to be done in parallel without the overheads of CAM-...
Assume there is a Shopping Mall x and all the roads in the city are one way such that, irrespective of the path you take starting from x, you will always end up at vertex x. Device an algorithm to test the same. This seems to be the opposite of a mother vertex, where x is reachable from all vertices instead of all vert...
The recurrence relation for the algorithm is an eccentric form that has an additional term: $T(n) = T[\frac{n}{2}] + T[\frac{7n}{10} + 6] + n$. Exactly how can I prove that this recurrence relation leads to O(n) time complexity? The two common methods are iterative substitution and the master method however neither can...
The maximum number of edges possible in an undirected graph with 5 nodes, when DFS call made on any random node in the graph result stack size 5 i.e. 5 function call present in stack simultaneously are ____________________ How graph edges can be converted to a function call ? Is that mean here we have to do a recursiv...
Specifically, if I defined a new $K_2$ as $$K_2 = \lambda x. (\lambda y. y)$$ instead of $$K = \lambda x. (\lambda y. x)$$ would the $\{S, K_2,I\}$-calculus be a compete basis? My guess is "no," just because I can't seem to be able to construct the regular K combinator from the $S$, $I$, and $K_2$ combinators, but I d...
Disparity essentially means the distance of a corresponding pixel in another image ( in pixels). This is clear and understood. When I looked after how the depth is related to disparity, then I found the formula Base * Focal / disparity = Depth This equation looks interesting, For example, Base is 50 mm, and Focal is ...
I am trying to find an efficient algorithm that on input $ (G,s,A,k) $ returns true iff $G$ is a connected directed graph, $s$ is a vertex in $G$, $A$ is a set of vertices in $G$ and there is a path of length $k$ from $s$ to a vertex in $A$ What is the best run time we can get here? I am currently stuck with this slow ...
What would be an efficient method to find the kth smallest element in an array with worst case time complexity being $ O(n) $?
For a long time, computer scientists and logicians have noticed that law (statutes, contracts, adjudication, etc), has some similarity with formal logic and programming languages, and have approached law as a CS problem (computer scientists have used deontic logic to model legal documents, and have applied object-orien...
I have a time series dataset where events have harmonic properties, and seemingly the nature of the event's early segments can determine the remainder of the event (see example 1's oscillations). Additionally, these early segments might determine the properties/likelihood of some following/associated event (example 2)....
I've stumbled across this article. It says that there is a problem that only Quantum Computers can solve. In my understanding, this should mean, intuitively, that this problem is "effectively computable", since we have an effective, real method to compute it: build a quantum computer and solve it. But, since a Turing M...
We have been studying a 1/2-approximation for MAXSAT which runs in expected polynomial time, by randomly assigning True/False to each variable and repeating until we reach an assignment with at least half of clauses satisfied. I don't understand why the algorithm needs to be so complicated. Why does the following not g...
Disclaimer This is not from an ongoing contest, this is from my course of ITMO on edx.org, which is a paid code so I cannot give you a direct link to the course. Problem You are given $\displaystyle n$ strings. Output their order after $\displaystyle k$ phases of the radix sort. Input The first line of the input file ...
I am reading through some proof of inequality of P and NP but they are not accompanied by the flaws in the reasoning so I'm trying to find them by myself, just to see if I'm getting the logic right. As an example I am currently reading this (very short) proof that P != NP and for me the lack in the argomentation is t...
Is there any isomorphism or equivalence relation? What strictly bind these two together?
Consider $\Sigma=\{0,1\}$. Suppose that $L \subset \Sigma^*$ is $NP-$Complete. How can I prove that $L' = L \cup \{0,1\}$ is $NP-$Complete?
I am interested in algorithms that have optimal running time, and ideally which are also very easy to implement. If you can also give some tips on how to implement the algorithm(s) you mention in the answer, that would be great.
I was thinking of ways to optimise a (heap-based) priority queue in certain scenarios, like in best-first path search algorithms (Dijkstra, A*, etc.). One possible optimisation is to delay insertions until the next extraction. The inserted elements can be kept in a buffer (a simple stack) until the next extractions, a...
(*) Acronyms NTDM := non-deterministic Turing machine. TM := deterministic Turing machine. (*) Consider the following idea The NTDM is able to follow, in parallel, all paths of the tree of the universe of solution. Suppose that in some point in time, for a certain problem, a new theorem is discovered that tells us tha...
I have been having some difficulty making sense of the Hungarian Algorithm outlined here. It seems incomplete and/or erroneous to me. The main issue is the line: If R_T ^ Z is nonempty, then reverse the orientation of a directed path in... How do we know which path to select as "a path"? If we select the wrong p...
Is there a commonly accepted term for caches that are guaranteed inclusive with respect to tags but not data? Inclusion can be helpful to simplify cache coherence, for which use only tags need to be included (avoiding the overhead of storing additional data). Is there a commonly accepted term for this kind of inclusion...
I am developing a Dynamic Programming algorithm for a problem in scheduling. In the recursive formula, I have three cases: (1) $t_{i-1} = int$ (2) $t_{i-1} = app \quad \& \quad r(j) \leq p $ and (3) $t_{i-1} = app \quad \& \quad r(j) > p$. However, for two of them I can go to two directions. To explain more, suppose ...
I'm working on an implementation of a data structure that needs a tree-like data structure for accelerating look-ups. The interesting part about this data structure is that the only operations on the AVL Tree are inserting and removing sequential integers in a stack-like fashion, e.g. Insert 0, 1, 2 Delete 2, 1 Insert...
For homework, the task is to verify the time complexity of quicksort. User Nick suggested on quora that one could check the number of comparisons made when doubling the input size. If the comparisons increase by a factor of around 2, we verify that quicksort has $O(n \log n)$ time complexity. Is this a legitimate meth...
How can we show that a maximum-leaves spanning tree is NP-complete? what other np-complete problem we can use as our reduction base? (maximum-leaves spanning tree: does G have a spanning tree with at least K leaves? )
While exploring the various types of data hazards in a pipeline, I came across a statement in my book which said that anti-dependency mayn't lead to cycle stalling. But i couldnt find at example for the same. Can anyone help me with it please? Thanks in advance!
I am trying to understand the Projection operation (linear tree homomorphism) and Cylindrification operation (inverse tree homomorphism) from the book. Linear Tree homomorphism is defined as follows: Inverse Homomorphism is defined here as follows: With these two concepts defined, I try to use it to understand the f...
I'm posting this here as my question is from a computer science textbook. It is not a homework question as I am self-studying and I have the answers available. In the exercise below, I can't see how I'm supposed to know which activity to place on which arrow. I can't tell if there is insufficient information provided o...
I am using hyperscan to search through large texts for a lot of regexes. One addition should be selective phonetic search for individual words. The algorithm of choice is Double Metaphone (but please feel free to recommend any other algorithm that might be more suitable to the problem and offers at least the same quali...
I understand that a context-free grammar is strictly powerful than a regular expression in that a context free grammar can represent any regular language, but not all context free languages can be represented by a regular expression. However, an over-approximation of context-free languages is possible with regular expr...
I'm studying the didactic programming language Oz, following the book "Concepts, Techniques, and Models of Computer Programming". In the book, the nondeterminism is introduced through the concept of choice, as it's explained here. However, in the Oz language if the programmer calls a choice between alternatives A, B, C...
Problem Constraints I have a collection of curves, $C$. It is a two dimensional array. The inner array contains rational numbers, where the next is greater or equal to the previous. $$C_{k.i} = v\\ \{k \in \mathbb{Z}: 0 \le k \le 5\}\\ \{i \in \mathbb{Z}: 0 \le i \le 99\}\\ \{v \in \mathbb{N}: 0 \le v \le 1\}\\ C_{n.i...
Given that I'm already at either the min or the max node of a binary search tree, which balanced variant would require only constant time bottom-up rebalancing after an update (add new min/max, or remove current)?
I have a collection of graph nodes which are connected to each other. I wrote a DFS algorithm to recursively search the connectivity of the graph to find all connected nodes, however due to the size of the network, it is taking too long. To improve the performance, I wanted to assign tags to the nodes, as MAJOR and NOT...
I'm not a computer scientist, so please bear with me if I'm misusing some terminology. What I'm trying to do is to find the different components of an undirected graph. I have an array of pairs that represent the edges of my graph, like so: [[1,3],[4,2],[2,1],[5,6],[100,20],[22,5]] and what I want to create out of this...
I am preparing some lecture notes on the computational power of quantum finite automata (QFA). I am a bit confused about which models of QFA are stronger and which models are weaker than standard finite automata (FA). There is one-way QFA (1QFA) and two-way QFA (2QFA). For each model, we can either have "measure-once" ...
I have an language of Σ = {0,1} and need to find the the regular expression of: Set of strings that have no pairs of consecutive zeros Set of strings that contain at most one zero For the first one I tried (01 + 1)*.(0) For the second I tried (1*0) I kind of feel that this is wrong. I would appreciate your help.
I am having trouble discovering how to convert a ε-NFA to DFA (image below) when all transitions in the initial state are epsilon transitions. I already know how to convert ε-NFA to DFA (common cases), but this case I never saw before. Thank you guys!
I'm working on a (real life!) scenario that involves scheduling workers on an assembly line. Let's say it involves steps a -> b -> c -> d -> e, and each step takes a different amount of time. There are a lot of orders coming through the assembly line, all with different due dates. So an order might come in on May 3rd a...
Here is the question: Say we have k urns with 1 ball in each urn. At each iteration of the game, I pick one urn and redistribute its contents amongst other urns and each urn can receive at most one ball and the urn we selected will need to be empty. Moreover, we can select what urns the balls go into. We have some extr...
A friend and I have tried for several hours to try and find a reduction from independent set to longest path, but the results have not been fruitful. We have tried many methods of graphing and complementing but are well and truly lost. Any help would be much appreciated!
I am trying to figure out if given a connect graph with N nodes and A edges, its subgraphs are connected. In order word: given a graph G, can I have a subgraph of G that is not connected? Or: can a subpgraph of G not be connected? I think the answer is no because otherwise G' is not a (sub)graph.
New algorithms and lower bounds for circuits with linear threshold gates. Ryan Williams. Submitted, 2013. I study this paper and have difficulty with understanding the proof of Lemma 2.2 in section 2. My questions are the three below. ① In the proof, we can find this sentence. Let f : {0,1,...,s} → {0,1} be the symm...
My professor asks this question: Binary Search tree has Rotation Method to prevent it from degenerating into a linear structure (unbalanced tree). Why is there no need for such method for Binary Heaps?
Computational complexity asks the following question: Given a problem $P$, what is the time-cost of the lowest time-cost machine $M^*$ that solves $P$? But this misses a certain aspect of the complexity of $P$, namely the complexity of finding $M^*$ in the space of machines. The problem of finding $M^*$ can be seen as ...
Is there any advantage of using an Integer Linear Program over Backtracking in a combinatorial optimization problem? I saw this Gurobi post that uses Integer Linear Programming to solve the traveling salesman problem. I compared its runtime with a Backtracking algorithm written in python, and the Integer Linear Program...
Suppose we have $n$ objects with weights $w_i \in (0,1]$ and we must insert them into bins with the constraint that every bin must contain objects which weight less than $1 \, kg$. The first-fit algorithm must: examine the objects with the order they're given $(w_1, w_2, \dots , w_n)$ and insert them into the bi...
We can make the following distinctions: (I will use the term "program" and "machine" as synonyms). A (baseline) machine. This can be formalized by a Turing machine. It receives an input, and computes an output, fully by itself. An oracle machine $T$. This is a Turing machine, but with an additional feature: it can use...
I have read reviews of this book, and quote the following from one of the reviews (emphasis mine): Other than straining your eyes with old-styled C++, you can read such misconceptions in the book like "Since Boolean values are generally atomic, setting and checking can be done simultaneously without risk or requ...
Suppose $G$ is a DAG with $n$ vertices, and $v$ is a vertex of $G$. What can we say regarding $v$ if the following holds: A. In all topological sorts, $v$ is at the end of the list. So my initial answer is that $v$ is the "sink" vertex, but in some case its not always correct, can't seem to find a feature that cant be ...
I am trying to show that a particular language $L$ in PCP(log,q) is also in P. The PCP protocol works as follows: log many random bits and checks at q positions in a polynomial length proof. The protocol accepts if two or more queries are 1. Assume that this has perfect completeness. I think one can handle randomness...
Decision Problem: Given $n$ real numbers, give an algorithm that outputs "1" iff there are at least two numbers that are identical and outputs "0" otherwise. (Assume that comparison between any two numbers works in $O(1)$-time). The problem is obviously solvable in $O(n\log n)$-time via augmenting mergesort, and wh...
I'm researching object oriented programming and I've come across the term "four pillars of OOP" in a few places now. I originally saw them listed as: Abstraction Encapsulation Inheritance Polymorphism When I searched for the origin of this I found a Quora answer which says: The four Pillars of OOP are in Grady Booch...
I have a object which is static, the camera is static and light source is moving. How can the depth mask be calculated ? Concept is to use - calculate height from shadow length Lets imagine a have more images likes this. And light source is moving, which is sun, and from time it's position, distance, orientation can b...
Suppose A($\cdot$,$\cdot$) is an efficient randomized algorithm and L is a language such that $\text{If }x \in L, \text{Pr}_r[(A(x,r) = 1)] = 1$ and if $x \notin L, \text{Pr}_r[A(x, r) = 0] \ge \frac{1}{2}$. Let $H$ be a hitting set such that for all inputs $x$ of length $n$, if $x \notin L$, then $\exists y \in H, A(...
Let $d > 1$, and consider a graph $G = (V,E)$ on $n$ vertices. A distance $d$-dominating set of $G$ is a set $D \subseteq V$ with the property that for any $v \in V$, either $v \in D$ or $v$ is at most distance $d$ from some vertex in $D$. Prove that if $\delta$, the minimum degree of $G$, satisfies $\delta > 50$, then...
I just came up with a simple sorting algorithm that is faster than ShellSort when the range of values is smaller than the number of elements. Is this new? And if so, what should I do with it? https://github.com/Frazer/hashSort let hashSortNonUnique = (unsortedArray)=>{ let myHash = {} let min = Infinity; let max...
Consider the recurrence $$ a_n - 3a_{n-1} + 2a_{n-2} = 6 \cdot 2^n. $$ I tried to solve this as follows. First, I found the homogeneous solution: $$ a_n^{(h)} = r^2 - 3r + 2r \\ (r-2)(r-1) = 0 \\ r = 2,1 \\ a_n^{(h)} = A \cdot 2^n + B $$ While trying to solve for the particular solution (adding $n$ for linear indepen...
Given the function $g(n,m)=\min\Big\{f(a,b)+f(n-a,c)+f(n,m-bc)\Big|\\a,b,c\ \ \text{with} \left\{\begin{matrix} a,\ b,\ n-a,\ c,\ m-bc \geq 0 \\ b\leq a! \\ c\leq (n-a)! \\ \end{matrix}\right. \Big\} $ Assuming that $n,m\geq 0,\ ((\lceil n/2\rceil)!)^2\leq m\leq n!,\ f(n,m)=\Omega (n)$, is it true that $g(n,m) \geq 2f...
Our task is to color a given $2 \times N$ matrix with two colours red (R) and blue (B) such that no two adjacent cells are blue. For red, there are no restrictions. An example of all possible solutions for $N = 2$ is as follows: (R)---(R) (B)---(R) (R)---(B) (B)---(R) (R)---(B) (R)---(R) (R)---(R) | | ...
Let L1, L2 be regular languages. And let A1=〈Σ,Q,q0,1,F1), A2=〈Σ,P,p0,2,F2) be their DFA. Prove that the following language is regular, by making an appropriate NFA for it: 3={11′22′…′ |12…∈1,1′2′…′ ∈2} (Meaning, the language of all words in which the letters on the even positions (starting from 0) form a word from L2 ...
I am trying to prove that following decison variation of MaxSAT is both NP hard and co-NP hard. $(\phi ,k) \in L$ iff an assignment of $\phi$ satisfies k clauses and no assignment satisfies more than k clauses. I think we can show that NP hardness by reducing SAT to L by setting k=m (number of clauses). But I can't re...
I have a Mixed-Integer Linear Programming question. There's this game called Islanders. Pretty graphics, it's about maximizing your score building a small city in a confined island. Here's a quick rundown of the rules: There are various building types Every building type has a different size Every building type has a...
Let's call the two languages in question (untyped lambda calculus with single or multiple prompt delimited continuations) L_delim and L_prompt. Is it possible to express multi-prompt delimited continuations in terms of single-prompt delimited continuations By express I mean the macro-expressible sense (to provide som...
A Boolean function $F(X_1, X_2, X_3, X_4, X_5, X_6)$ of six variables is defined as $F = 1$, when three or more input variables are at logic 1. otherwise 0. How many essential prime implicants does F have? How to visualize this problem. A Six Variable k-map is very difficult to manage. Any hints?
Suppose $H = \{h_1, ..., h_T\}$ be a family of pairwise independent hash functions mapping $\{0, 1\}^n$ to $\{0, 1\}^{n/2}$. Let $M = \frac{2^{n/4}}{10}$ and let $x_1, ..., x_M$ be any M distinct points in $\{0, 1\}^n$. If we choose $h$ randomly form $H$ and let $E$ be the event that $h(x_1), ..., h(x_M)$ are all disti...
if I take the result of a 32bit hash function(the param is random string) and apply module N on the result - will the values be evenly distributed? so if I have a histogram of values [0,N-1] will the histogram be evenly distributed ? Thanks
I am considering the following algorithm for obtaining a cycle $C_k$ of fixed length $k$ in an undirected graph $G$. Assuming $G$ is in adjacency list form, say $r \in G$ is the root for a truncated DFS of $G$. In typical fashion, be sure to mark nodes which have been visited. Do not go beyond depth $k-1$. In this way,...
My background is not CS so sorry for using improper term. But basically I want to check if a point on XY plane is "too close" to any other points, and do so with every points. In another words, if I draw a circle with radius R at every points, would any circle cross other circles on the plane. I want to code this in Py...
It is well known that Random variable is a function from sample space of a random experiment to $\mathbb{R}$. Consider the following sentences from deep learning book Let $\{x^{(1)}, \cdots , x^{(m)}\}$ be a set of $m$ independent and identically distributed data points. A point estimator or statistic is any func...
I want to detect whether a subset of a directional graph reachable from a given root has a cycle, and print some useful debug information about the cycle. It's not a problem if there's a cycle not reachable from a given root. The useful debug information does not need to be exact (i.e. it is not a problem if the progra...