instruction
stringlengths
35
29.1k
Let $L = \{\lt M\gt | M$ is a $TM, L(M) = \{1^n0^n | n\ge0\}\}$. Create a reduction from $A_{TM}$ (acceptance problem) to $L$. Is $L$ not decidable? But isn't $L$ decidable since it is possible to make a CFG (or PDA) of that language. And if I can make a reduction, $L$ would become not decidable because of $A_{TM}$.
In an effort to better-grok monads I have reviewed many "Everything you need to know about Monads" tutorials out in the wild, but I feel like my understanding is still coming up a bit short. While every one of the above faithfully recites the 3 laws of monads: right identity, left identity, and associativity along wit...
This is part of a bigger problem, which is to find out if point XYZ exists in any of n (XYZ -> XYZ) "boxes". I'm currently splitting up the problem into a smaller one, by focusing on one dimension first and "filtering" till either a range is found, or it's not; How can I find out if my number X is in any of n ranges wi...
Say I have a primal program P with n variables and c constraints. Let's say that I have an optimal solution for the dual program D, in which the y1, the variable related to the first constraint in P, is zero. Does that imply that I could run Simplex on P without the first constraint and get the same optimal solution a...
I was wondering if there is a name for this construction: Take a graph $G$ and construct a new graph $G'$ in which the edges of $G$ now become vertices, and "vertices become edges" in the sense that vertices are joined by edge in $G'$ if they as edges in $G$ shared a common vertex. More precisely: Given a graph $G=(V=\...
I'm reading an article about indexing in Redis. There is a link to so-called Hexastore, it's referred to as a data structure. The link doesn't work, which makes me feel I'm missing something. I understand from the article that the hexastore provides a representation for relations between objects, formed by a subjec...
This is the problem statement I came across today. Given a binary tree, find the lowest common ancestor of all deepest leaves. I came up with a correct algorithm, but I would like to confirm the running time of this approach. The algorithm is as follows: Traverse the tree and find the deepest level of the tree, dmax. ...
The HW question, on page 362 of Data Structures and Algorithms in C++: Fourth Editionby Mark Allen Weiss, reads as follows: Prove that merging two sorted arrays of N items requires at least 2 * N - 1 comparisons. You must show that if two elements in the merged lists are consecutive and from different lists, then they...
i have a question - how i can prove that: $\log((n^2)!) =\theta (log((n!)^2))$ i try something like that: $\log((n^2)!) = 2*(log(n)!)=\theta(2*(log(n)!)=\theta(n\ log(n)) $ $\ \theta(log(n!)^2)=\theta(log(n!)*log(n!)) = \theta(n\ log(n)) $ then we can see that is equal --> there are $\theta(n\ log(n))$ this is true...
I'm trying to solve this problem where I have to cover all the squares in a N x N grid with rectangles with a tradeoff between cost and computation. These are the constraints: Fields are rectangular, but may be of any width or height Rectangles may cover any cell whether marked or not Must be rectangular Must be axis-...
Query A and Query C seem to be the same.But given answer is query A. Can someone help me to find the difference between queries A and C ?
Question I am wondering what is the minimum time complexity of get the unique value of a array in two conditions: keep the order or not. For example, suppose we have a original array [3,6,1,1,2]. I want to get [3,6,1,2], this result keeps the original order and drops duplicates. If there is no need to keep the original...
It can be proved that randomly built binary search trees of size $n$ are of depth $O(\log n)$ and it is clear that level $k$ has at most $2^{k}$ nodes (root's level is 0). I have an algorithm that traverses every path in the tree (beginning at the root) but stops after traversing $k$ nodes (the parameter $k$ is a confi...
I stumbled across this question in HackerRank: Karl loves playing games on social networking sites. His current favorite is CandyMaker, where the goal is to make candies. Karl just started a level in which he must accumulate $n$ candies starting with $m$ machines and $w$ workers. In a single pass, he can make $m \ti...
I am trying to develop a CFG for the language $L$ defined by: $L = \{a^{n+2}bba^{n-2} | n > 1\}$ The problem I am having is that I cannot develop the CFG for this language no matter what I try. The closest I can get is: $S \rightarrow aaaaXbbX$ (Production 1) $X \rightarrow aX | \Lambda $ (Production 2) This would ...
Bartosz Milewski's Category Theory for Programmers says the following: A parametrically polymorphic function between two functors (including the edge case of the Const functor) is always a natural transformation. Why is this true? Something along the lines of an informal proof would help me. It would also help to hav...
I am reading about B-Tree through CLRS. One of the exercise problem is to express maximum number of keys in a BTree of height $h$ and minimum degree $t$. Properties of BTree of $t$: $t\ge 2$ Min. no of keys in a node is $t-1$ and max. number of keys in a node is $2t-1$ Max number of children a node can have is $2t$ T...
I was given this exercise and I think I have to use a variation of Gauss repeated squaring, but I can not figure out how to produce $\log\log k$ in steps, like when you divide $k$ by $2$ to compute $\log k$ in steps. Any ideas?
I have a problem with an exercise, I have to analyze the following For-Loops Then I have to write down the explicit notation, my problem is that I don't know how to get the right m. I tried this but now I have no idea how to get the m, because I thought that m defines the diffrence between i and j and so I became m = n...
I was able to prove that $size(t) \leq 2^{h(t)} - 1$ for any binary tree $t$, however I wasn't able to do anything reasonable with this statement. I know it's a proof by induction and that the inductive hypothesis is the following: $ size(l) < 2^{h(l)} \\ size(r) < 2^{h(r)} $ where $l$ and $r$ are the left and right s...
How could I normalize the 2nd order central difference method? The original function is F(A,B,C,D) and only one variable is varied at a time. ie $F'' = \frac{F(A+\Delta A,B,C,D) - 2\times F(A,B,C,D) + F(A-\Delta A,B,C,D)}{\Delta A^2}$ I want to compare the sensitivity of each variable. But I would like to do it with no...
I came across the following question: A source $X$ emits symbols from the alphabet $A_x$ with $|A_x| = 8$. We want to construct a prefix-free source code for this source. We want to find a code with codeword lengths $(1,3,3,3,5,5,5,5)$. Can such a code exist? If yes, give such a code. If not, prove that. I checked Kraft'...
I was asked to prove that $ L = \{ 0^{{2n}\choose{n}} : n\in\mathbb{N} \}$ is not regular. I can't solve this, could anyone help me? This was an exam question from previous year. I looked your answers, but I can't really understand Yuval's solution and Matt's solution would be too long for an exam question. From lectur...
For this I came up with a DFS recursion. Do DFS from any node and keep doing it until all nodes are Exhausted. I.E. pick the next unvisited node once you cannot keep recursing. The element with the highest post number or the last element you visit should be the first element in your topological ordering. Now do anot...
Measure words (aka classifiers) are used in Chinese to "measure" things, e.g. 三杯牛奶 Three glasses of milk 那个人 That person 一只乌鸦 One crow 一公斤豆腐 A kilo of tofu We don't have an equivalent in English [they're not collective nouns (e.g. a murder of crows)]. It'd help reading Chinese text to be able to highlight measure wo...
I came across some lecture notes of a professor about memory consistency and models. There is an example about memory overhead: The cache line has 7 states (3 bits): unowned, shared, exclusive, modified, read, update and "uncached read". For 64 processor with the cache line described above, the memory overhead is 12.5...
I am trying to understand the maximum cardinality problem in the context of stable matching algorithm. I am reading the following article at the link: A Two-Sided Matching Decision Model Based on Uncertain Preference Sequences The article says that: In general, we can categorize two-sided matching problem into three ...
So I'm looking for a bit of an abstract algorithm and I'd appreciate any references to read up on. This is a bit tough to explain but I'll try my best. Suppose we have 2 arrays of RGB pixel tuples- A -> {(56, 39, 75), (125, 222, 32), (156, 201, 102)} B -> {(125, 195, 93), (53, 31, 67), (118, 219, 48)} I'd like the sort...
I'm really struggling with the following exercise and I would really appreciate your help: I have to calculate the expected runtime of a sort Algorithm with the following variants: Variant Runtime Behavior 1 n(n-1) 2 n 3 n log(n) Given is, that the runtime for variant 1 is 1000 ele...
I am currently working on ways to prove this and got stuck proving it with induction. Any tips? How could i prove that for every finite alphabet Σ, ∀ n ∈ ℕ. |Σⁿ| = |Σ|ⁿ?
I was reading an article about Binary Search on one of the websites on the internet that someone had linked, can't find the link anymore, but this really is bothering me, and I think I am missing something. function binary_search_alternative(Array, k) is L := 0 R := n − 1 while L < R do m := floor(...
I was wondering whether this program (I'm using a C syntax, hope it's not an issue) is to be considered $O(n^2 \log(n))$ or $O(n\log^2(n))$ or something else entirely. for(int i=0;i<n;i++) for(int j=i; j>0; j/=2) for(int k=j; k>0; k--) printf("Hello, World!\n"); I mean, the innermost loop is fo...
I have been reading and searching and I still cannot understand if there exists a language as following: Can a language be P-complete with respect to $\mathsf{Space}(\log \log n)$ reductions? These reductions use some sort of transducer/transformer that is identical to a logarithmic transformer, except its working ta...
Can somebody explain please why Ford-Fulkerson Algorithm has pseudo-polynomial complexity? I understand that the complexity in this case strongly depends on the capacities of the edges of the network, since we have $O(|E|*f_{max})$, but why is the algorithm still not polynomial?
Is there a polynomial-time reduction from Directed Hamiltonian Path Problem to 3SAT which is linear in the number of vertices? That is, it reduces every directed graph $G$ with $n$ vertices to a formula $\varphi$ with at most $O(n)$ clauses within time at most $p(n)$ for some polynomial $p(n)$? Since Cook Levin Theorem...
I have a dependency graph of tasks, which forms a DAG. I'm looking for an algorithm to calculate the optimal topological traverse to minimize the "working set". Specifically, I define the current working set as the set of nodes which have been visited, and which have at least one outgoing edge which is untraversed. Eve...
hello and thank you for helping me understand the following: I really don't understand this, why if language $A \in BPP$ then $A≤_P\#SAT$? language A is in BPP class, if for a probabilistic turing machine M, M outputs 1 for all $x \in A$ in a probability $\geq 2/3$, and for all $x \not \in A$ M outputs 1 in a probabil...
Suppose as a computer programmer, you have been assigned a task to develop a program to store the sorted data in ascending order. Initially you have used linked list data structure to store the data but search operation was time consuming then you decided to use BST (Binary Search Tree) but retrieval efficiency is not ...
I want a hueristic algorithm for the following problem. Here, $V(G)$, $E(G)$ respectively refer to the vertex set and edge set of a graph $G$. Input: two planar bipartite graphs, $G,H$ and a map $\phi: A\to V(H)$, where $A$ is a subset of $V(G)$. Task: determine if there is a (bijective) map $\phi': V(G) \to V(H)$, suc...
This is an algo. programmed for displaying a letter pyramid if the buildPyramids() method is passed argument str, i.e. "12345": 1 121 12321 1234321 123454321 Code: void buildPyramids(string str) { size_t len = str.length(); size_t i, j, k, m; for(m=0; m<len; m++) { for(i=len-m-1; i > 0;...
I'm trying to proof that the following language is not regular using pumping lemma. $L=\{w\bar{w}|w\in \{0,1\}^* and\ \bar{w}\ is\ one's\ complement\ of\ w\}$ I started by stating that: $|w\bar{w}| = 2p = |xyz|$ Because of Pumping Lemma the following has to be true: $1 \leq |y| \leq |xy| \leq p$ Because $|xy| \leq p$ a...
I have had the following problem at my last exam: For how many permutations of set {1, 2, ..., n} where n > 2 will insertion sort (without guard element) perform exactly n comparisons. My thinking was: there must be exactly one inversion of succeeding elements so any of the pairs (2, 3) or (3, 4) ... or (n-1, n) has to...
I’m trying to find a way without just hard coding to create a categorical distribution over all characters given a character but with similar looking ones having higher probability. For example, if the input is ‘l’ then 1,j,!,/,I,t would be characters considered similar looking and should have a higher probability than...
Complexities, such as time complexity, space complexity, communication complexity and sample complexity, are often used to analyze the performance of algorithms. As far as I know, time complexity and space complexity are collectively referred to as computational complexity. Are there other common complexities in theore...
My assignment asked to design a DFA that computes the language: $L = \{ w \in \{a,b,c\}^\star | \#_a(w) $ is even, $\#_b(w)$ is odd, $\#_c(w)$ is even} I have been stuck on this question for 2 hours, I draw approximately 20 sketches but still fail. The only thing that I observed so far is we need at least 8 states, or...
I'd like to understand convolutional neural network. Consider this quote from Stanford CS notes on Convolutional Neural Networks for Visual Recognition (CNNs/ConvNets): Example Architecture: Overview. We will go into more details below, but a simple ConvNet for CIFAR-10 classification could have the architecture [INPU...
In the textbook Arora-Barak, after presenting the Cook-Levin theorem's proof the authors say that the proof can be modified slightly to make the reduction parsimonious. The parsimonious reduction is one in which certificates of an NP language are mapped bijectively on the certificates of SAT. I am not sure why the redu...
Consider a directed acyclic graph $G$ with vertex set $V$. Choose a vertex $v$, and let $H$ be the subgraph containing $v$ and all other vertices in $G$ that are reachable from $v$ (along with the associated directed edges). (In other words, if we choose $v \in V$, then we are interested in the subset consisting of $v...
As the title suggests, is this possible? Or does it halt execution when it hits the trap state? Thanks to anyone who can clear this up.
Currently I am experimenting with Kernighan-Lin algorithm to produce coarse representation of navigation mesh for hierarchical pathfinding. Based on the use case, my requirement is that partitions produced are a connected graph on its own. For example, a bisection of the below grid x--x--x--x--x--x | | | | | | x--...
I'm trying to find out time complexity of a recursive factorial algorithm which can  be written as:   fact(n) {  if(n == 1)  return 1;  else  return n*fact(n-1)  }   So I write the recurrence relation as   T(n) = n * T(n-1)   Which is correct according to this post: Recurrence relation of factorial   And I calculate...
I'm going to solving many times this specific equations: $$2^{x+y} \cdot c - a^{y} \cdot z = 1$$ in which $$a$$ can be equal to: $$-7,-5,-3,-1,1,3,5,7.$$ And $$x+y$$ will be equal to $$128.$$ It has to be done with euclidean algorithm, but how many step it requires in average in this specific case? I know that euclidea...
Previously, I tried convert a color image into a greyscale image by using pixel values of an image from a simple formula :- Grey = 0.3*Red + 0.58*Green + 0.11*Blue After that, I wanted to convert the greyscale image into a binary image & I used two different techniques : NOTE : Red, Green & Blue are variables storing ...
A question arising from a scheduling problem: I have a finite set $X$ with elements $x_i$ and some preorder $\leq$. I have pairs $p_j$ of $x_i$ (i.e. $p_j$ = $(x_k, x_l)$) with the property that $x_k \leq x_l$. I say that for two pairs $p, p'$ : $p \leq p'$ when for all $x \in p, x' \in p': x\leq x'$. I call two pairs ...
Assume a Hotel reservation scenario, given $m$ ranked lists of attribute values such as distance, price, amenities (normalized between $0$ and $1$), and a unifying linear score function $F(\cdot)=\alpha_1*score_1+ \alpha_2*score_2+ \alpha_3*score_3$, the Threshold Algorithm (TA) is optimal in finding top-$k$ results th...
I just finished reading about operators in relational algebra and tried to solve this problem. But I dont even understand what the first statement is doing. From what I know, $π$ (project) is a unary opeartor that takes a single relation and selects some attributes from all of the attributes (columns) of that relation....
Suppose you have a program one_factor(N) that, given an n-digit binary number, N, returns one of the prime factors of the number in Theta(n^2) time (note that I used a lowercase n in my theta notation.) Using this algorithm, I want to find an efficient algorithm to factor an n-digit binary number into primes and print ...
Imagine you are given a word samw and it is an invalid word (for the word same), and you need to find the correct word from the dictionary. The dictionary contains a list of words ordered by the frequency of the occurrence of the word with the most frequent word in the beginning. There are the following rules on how to...
I have a point cloud of size n (in the example on picture n = 5). The starting coordinates are in green, destination coordinates are in red. What I need is to move the points from the starting coordinates to the destination ones so that the total distance, traveled by all points is minimal. There is one important restr...
In a 32-bit byte addressable memory system, each "row" has 4 bytes and each byte has a 32-bit address. My question is: can I read and/or write word of length 64 bits from/to memory? In other terms, can my word length be 8 bytes long or is the maximum number of bytes/word 4?
How to reduce $L_c=\{\langle M_1 \rangle, \langle M_2 \rangle):L(M_1)\cap L(M_2)\neq \emptyset\}$ to $A_{TM} =\{\langle M,w \rangle: M$ is a Turing machine that accepts $w$}. My try: Construct a Turing machine $N$ using a Turing Machine $U$ that decides universal language as subroutine to decide $L_c$. $N$, on any inpu...
I know how to verify whether grammar is LR(0) or not. But this particular case is little tricky and hence the question. Grammar: $SL \rightarrow SL ; S \space | \space \epsilon$ $S \rightarrow s$ (Note: $SL$ is single non-terminal.) Now, LR(0) automaton for this grammar is as follow: Now my question is whether to co...
I'm reading Introduction to Computational Theory by Michael Sipser. He provides the NFA below as one that recognizes the language of the regular expression $ab$. What is the purpose of the middle two states and the $\varepsilon$ transition between them? Could this NFA be designed without them and still work as intended...
I have a list of patterns with each pattern containing one or more wildcards. For example: abc* a* *a*z* *z Wildcard (*) matches one or more characters. For example, any input string starting with 'a' would match a pattern a*. How can I determine if there exists an input string that would match all of the provided pa...
For instance when the question contains $\{a,b\}^*$ does this mean that the DFA must have at least one $a$ and one $b$ on top of whatever conditions it has? For example a DFA that accepts $\{w \in \{a,b\}^* : w \text{ contains } bbb\}$ should it reject the actual string $bbb$ because it does not contain an $a$?
Is $\log_2(2n) \in O(\log_2(n))$ ? I don't know how to prove whether this is true or false. Any help is appreciated
Given a 3xN board. Find the number of ways to cover it using 2x2 or 3x1 or 1x3 tiles.
According to image 1, for two way communication, each person needs to generate a pair of keys. However, according to image 2, only one pair of keys is required for two way communication. Thanks to anyone who can settle my confusion. Source 1 If a two-way communication is required between all five workers, then they al...
How to write a pseudocode to split a number value to array of numbers? Let's say the number value is 12345. I need to convert it into [1,2,3,4,5].
Assume we know that the implementation for the multiplication operator for a language is known to be $O(n^2)$. Given this pseudocode: func wibble_wobble(List<Integer> input): Integer constant = input.length; return List<Integer> { item * constant foreach item in input }; Since the loop inside the new list init...
Let $A$ be a randomised algorithm and $F$ be a function such that $A$ returns $F(x)$ on any input $x$. Furthermore suppose that, for input $x$ of size $n$, the $\textbf{expected}$ running time of $A$ is $O(n)$. Give an algorithm that is guaranteed to terminate in time $O(n)$ for every input, and which on input $x$ outp...
I'm taking a data-structure class, and the lecturer made the following assertion: the number of attempts needed to insert n keys in a hash table with linear probing is independent of their order. No proof was given, so I tried to get one myself. However, I'm stuck. My approach at the moment: I try to show that if I s...
I had this idea of program tohelp me in my everyday life. We both work and don't live in the same city. I was wondering how to make a program that calculate, depending on the work scheduleand the number of travel required between both our house, the best way to spend our weekend, like at which house we have to be and w...
Information theory to a large extent deals with how to efficiently encode messages given a probability distribution over messages. Intuitively, it seems like we can think of machine instructions (or programs) as "messages to the CPU". Some messages are more probable than others. E.g. "add numbers x and y" is more proba...
I want to calculate/estimate the energy consumption for the different convolutional neural networks. Is there any possibility to measure the energy consumed by AlexNet for example with a tool or with Keras or something else?
Lets say I have a list of many (10s of thousands - millions) objects, and each of these objects has a given number of 3-D vertices (my current implementation uses 8 vertices each, but this number can be reduced if it causes a very significant increase in performance). These vertices are currently stored as floats from ...
Suppose, you are given an array of strings of different lengths, but the total number of characters over all the strings is n. Describe an algorithm using Counting Sort to sort the strings in alphabetic order (eg. algorithm < cs < hello) in O(n) time.
Convert CFG to CNF The Grammar E→E+T E→T T→T*F T→F F→(E) F→x Step 1 Assign variables to terminals A→ + B→ * C→( D→ ) F→x Step 2 Remove epsilon which in this grammar is not available Step 3 Remove useless symbols which there are none Step 4 Remove unit rule S→E E→T T→F So we have E→T*F|E+T T→(E)|x F→(E)|x Step 5 A...
I've been given a grammar definition of "Simple C language" in Backus-Naur to write a compiler for a class assignment. I've been trying to implement the parser for some time now and I just can't move forward due to some endless loops and I think the definition might be wrong. This is the full definition of "Simple C La...
I came across following problem: Find number of binary trees possible with 2 as roots. Nodes={1,2,3,4,5} There was no solution given. I knew number of binary trees for given preorder is given by Catalan number as $\frac{1}{n+1}\binom{2n}{n}$, where $n$ is number of nodes. So does the above question same as asking: ho...
I want to space points evenly (i.e. maximizing minimal distance between two points) on some smooth surface $S\subseteq\mathbf{R}^n$ (usually $n=3$), where I have a projection operator $p:\mathbf{R}^n\to S$ which approximates the closest point on the surface. My idea is to place them randomly first and then let some re...
Hello and thank you for helping me understand the following: I am trying to understand why the following cannot exist: A P-Complete language in regards to a log-logarithmic space. context: Defining a new kind of reduction: a reduction in log-logarithmic space. For this purpose, we define a log-logarithmic transformer t...
I am currently struggling with a bin packing variant, where we have fuel and compartments of a tank truck. Some industry constraints apply, but the whole picture is that you must fit the total volume with the optimum way through the compartments. I have created a model, which works almost perfectly, where I try to mini...
I have no idea how to solve this one - I end up with $\sum_{i=0}^k (2^k * 5 * 3^i)$ but I have no clue how to get any further than that (e.g. resolve the sum even further, if it's even correct to begin with). This is the task - masters theorem is not allowed: T(n) = 2 * T(n/3) + 5n T(1) = 5 and we know, that n = 3^k Th...
I'm looking for a way to cluster points in a given space, where clusters form around specific closed, allowed zones of that initial space. Each allowed zone should be surrounded by points of its cluster. However, it is not only necessary to match the points to the closest allowed zone, but also to take into considerati...
I have this problem that is very similar to the minimum k-union problem: Given a collection $C$ of subsets of a finite set $S$ and each set $c\in C$ has a label that is its category. The problem is to select at least one $c$ from each category such that the size of their union is minimized. Is this problem NP-hard?
Currently I am working on getting lots of html code and its related css, via id or class name. Once I have enough data to work with I am unsure how it would be easiest for any model to learn what css should be generated for each element. My idea is to make a script to extract all html elements from a given file and the...
In Sipser's book page 351: Recall that Savitch's theorem shows that we can convert nondeterministic TMs to deterministic TMs and increase the space complexity $f(n)$ by only a squaring, provided that $f(n) \geq n .$ We can extend Savitch's theorem to hold for sublinear space bounds down to $f(n) \geq \log n .$ The pro...
A union of sets can be decomposed into a disjoint union of intersections. Rather than writing confusing notation, this is easiest to to see in an example of three sets. This clearly generalizes. If we want to calculate the disjoint pieces, we have to compute $2^n$ intersections, where $n$ is the number of sets. Howev...
I want to prove that $\{A^iB^jC^k \mid i=j \text{ or } j=k\}$ is a not a regular language using the pumping lemma. I've found that the only way to obtain a contradiction is when $x \in A^*$, $y \in B^*$, $z \in C^*$, as $y$ is unable to be pumped up and still fit in the language. However if I have any combination of ...
If you want to convert a rational number into its continued fraction, what is the circuit depth of this process, in terms of the total number of bits of input? I was reading through some notes which mentioned that the work being done while computing the continued fraction is basically the same as the work being done wh...
AFAIK, a hierarchy of type universe(Type^0: Type^1: Type^2: ...) was introduced to avoid inconsistency caused by Type: Type. But some functional language(e.g. Idris) also allows subtyping of these type universes(x: Type^n then also x: Type^n+1). From my understanding, this is not mandatory to solve the inconsistency. S...
The English Wikipedia article about Turing machine opens with: A Turing machine is a mathematical model of computation that defines an abstract machine,[1] As a Hebrew speaker, I read a similar explanation in Hebrew Wikipedia: מכונת טיורינג היא מודל חישובי מתמטי אשר באמצעותו ניתן לתאר באופן מופשט את פעולתו של מח...
I am reading Computability by Nigel Cutland and I'm stumped on a brief statement about generating particular sets of strings that is not explained or given any examples. First, here are some definitions provided by Cutland. Let $\Sigma$ be a finite set of symbols, called an alphabet. Write $\Sigma^*$ to denote the set ...
As a hobbyist problem-solver, recently I stumbled upon two problems related to Frobenius numbers on one of the competitive coding websites I like: Zombie Apocalypse: the Last Number Standing and Matunga coins. I did some research (i.e. googling), found some information, and most notably a paper that describes a couple ...
Suppose I have a categorical distribution on items $1,\dots,n$, that assigns probability $p_i$ to item $i$. I now repeatedly sample from this distribution, until I have obtained $k$ unique objects. I'd like to compute the probability that the set of objects obtained is exactly $\{1,\dots,k\}$. Is there an efficient w...
How to compare the asymptotic growth of a function containing a sum with another function? I'm not sure how I'm supposed to dissolve the sum. Usually I just take the limis of f(x)/g(x). If that fails I take the limis of f'(x)/g'(x). But I'm not sure what to do in the following task (to prove whether the marked statemen...
I have found the following question from internet. They have even given the answer as option c. But i am confused because the grammar also does not looks like a Regular. Please help me to understand this answer
I have seen some algorithms with complexities like $\log^3 n$ and $\sqrt n$. In view of getting a better idea on how to compare these I wanted to know for which values of $k$ does $\log^k n \in \Omega(\sqrt n)$ hold true? I suspect $k$ would need to be a function of $n$. Because if it were a constant $C_1$, we could al...
I would like to know if there exists a closed form formula to the following recurrence: $f(s, 0) = 1$ $f(s,b) = \displaystyle\sum_{i=1}^{min(s, b)} \left[ (s-i+1)\times f(i, b-i) \right] $ This recurrence gives the solution to problem F of the ICPC Latin American regionals of 2019. The problem itself can be solved ...