instruction
stringlengths
35
29.1k
In Tacit Programming page on wikipedia, it is stated that the point free version of p x y z = f (g x y) z is p = ((.) f) . g and that the point free version of mf criteria operator list = filter criteria (map operator list) is mf = (. map) . (.) . filter. I can not figure out how can we get from one side to the other...
So far we have learned Recursion Tree, Substitution Method, and Master's Theorem. I'm not sure how we can find lower AND upper bounds. I know that using Master's Theorem, we get $T(n) = \Theta(n^4)$, but how can I find both upper and loewr?
I was reading book related to Time Complexity, and came up with 4 lines of equations that I could not understand properly, could you please explain why are those true? 1) $n = o(n\log\log n)$ 2) $n\log\log n = o(n\log n)$ 3) $n\log n = o(n^2)$
I have tried researching how I can handle multiple optimal solutions based using dynamic programming. The answer is found from this question is simply that you have to backtrack. What if this is not possible and one of my solutions can't be found this way? From this YouTube video we are given the problem of finding the...
Arora and Barak showed in their book that we can simulate a $O(T(n))$ time-bounded $k$-tape Turing machine with a $O(T(n)\log{T(n)})$ time-bounded $2$-tape oblivious Turing machine. But it seems that they assume that $T(n)$ is time constructible. What if $T(n)$ is not time constructible? Can we still do this simulation...
I'm interested in efficiently maintaining the set of strongly connected components (SCC) in a directed (unweighted) graph under edge deletions only. While searching for ways I came across an article [1] that uses a generalised version of EvenShiloach-trees (ES-trees) [2] to maintain shortest path trees for the graph. I...
If we use an ontology we can represent knowledge, using notably semantic triple <s,p,o>. I was wondering how can I represent this: A and B cause C or A or B cause C ? I don't want to do reasoning, I only want to represent. Is it possible to use and, or, negation as predicate/relation in an ontology? I only see that re...
I'm looking for an efficient algorithm (at least polynomial in the size of the graph, preferably linear) for the following problem: Definitions: Given a graph $(V,E)$, with non-negative weights assigned to it's edges $w_E:E \rightarrow \mathbb{R}^+\cup\{0\}$ and non-negative weights assigned to it's vertices $w_V:V \r...
Assume I have a list of $N$ surfaces $\{S_i\}, i \in [1,N]$ which may or may not overlap. I also have a boolean function $F(S_{i_1},\dots,S_{i_k})$ (with $1 \le k \le N$) which tests whether all surfaces $S_{i_k}$ overlap (or if they were discrete sets, then $F$ would test whether they contain a common element). In oth...
So my professor suddenly decided to make our homework difficult. He did not provide any examples or ways to proof so now I've been stuck on this for a while. I'm not asking for the solution but rather the right direction in order to get the right answer.
I'd like to Store a set of many infinite undirected 3D lines. Make lookups against this set - i.e. given an arbitrary line, ask "Does the set contain a line coincident with this one?" The incidence-checks would of course have to be fuzzy to account for floating-point errors. Question: What would be a good data struct...
I know that the Kleene star of an intersection is contained in the intersection of Kleene stars, but are they necessarily equal? For example, given two formal languages, $A$ and $B$, I know that $(A\cap B)^*\subseteq A^*\cap B^*$, but does $(A\cap B)^*= A^*\cap B^*$?
What is the point-free version of f(x, y) ? Is it just f or some kind of function composition, since when curried there is an implicit function which is made out of applying f to x?
I have to prove that the following languages are not regular using the Myhill-Nerode Theorem. $\{0^{n}1^{m}0^{n} \mid{} m,n \ge 0\}$ $\{w \in\{0,1\}^{\ast}\mid w\text{ is not a palindrome}\}$ For the first question, I did the following: I considered the set $\{0^n1^m \mid{} m,n\ge 0\}$. To prove that this set is pai...
The language is this: $L = \{w \in \{a,b\}*:$ each $a$ has a matching $b$ somewhere in $w$ $\}$ This wouldn't have an FSM since you'd need infinite states of depth for each unmatched a you have, right?
My understanding is that the answer is yes. To be θ(n) implies O(n), which itself implies O(n^2). In other words, a function that is tightly bounded by n is trivially upper-bounded by n^2 as well. The TA of my class tells me that I'm wrong, that a function that is tightly bounded by n cannot be upper-bounded by anythin...
Is there some kind of algorithm for sorting of set, when there is comparison of just some pairs? Example 1: set(a, b, c, d, e) pairs(a>b, ce) Example 2: set(a, b, c, d, e) pairs(a>b, d>b, c>d, d>e)
This appears to be a knapsack / bin-packing problem, but I seem to have got stuck and could appreciate contributions. Scenario 1: Tough (for me!) There is a one day conference with a set of (4 or more) sessions. The conference will be attended by a number of companies, each one being represented by a (1 or more) repres...
I got this idea recently. If we do not consider the data IO part of software, imagine the data is in the memory and we need to come out with some decision (which product to recommend to a user, how to render the 3D world in a game) by processing the data in memory. All of these tasks could be done through a sequence (p...
I'm evaluating the theoretical run time of matrix multiplication algorithms as it has improved within the last few decades. Algorithms to solve matrix multiplication run in O(n^w) time, where w has evolved in the following way: w = 3 if using a brute-force approach, w = 2.8074 if using Volker Strassen's algorithm [196...
Pedagogical question. Background A cycle in a graph can be defined as a sequence of vertices $v_1,\dots,v_n$ with $v_1=v_n$ such that, for each $i \in \{1,\dots,n-1\}$, the graph has an edge $(v_i,v_{i+1})$. (One can define it differently.) The point Every definition of simple cycle I have seen is: a cycle with no repe...
I am sure many folks here know the famous min-cut max-flow theorem - the capacity of the minimum cut is equal to the maximum flow from a given source, s, to a given sink, t, in a graph. Firstly, let's state (for completeness) that an s-t cut is the partitioning of the vertices in the graph, into two parts, such that th...
From what I have learned the number of reducing moves in the parsers are generally in the order LR(0)>= SLR(1) >= LALR(1). But I am unable to understand where should I place CLR(1) in this category? Is it CLR(1)>=LR(0)>= SLR(1) >= LALR(1) ?
I'd like to implement a high-performance implementation of a multi-threaded reduction, element-wise, on x86 CPUs. Without loss of generality, assume the reduction operation is a sum of integers (so, both commutative and associative). Each of the T threads has an array of N elements, and the final element-wise sum shoul...
Problem Statement Given a finite graph $G = \langle V, E\rangle$, consisting of vertice set $V$ and edge set $E$, and a finite set of colors $C$, a problem instance of graph coloring is to assign each vertex $v \in V$ a $\text{color} (v) \in C$ such that $\forall \langle v, w\rangle \in E, \text{color}(v) \not= \text{c...
I am trying to find the upper and lower bounds for this recurrence, but I am not sure how to handle to square root: $$ T(n) = 4T(n/2) + n^2\sqrt{n} $$
Generally most np complete problems seem to have the best strategies operate in time $O(c^n$) for some choice of $c$ Has something like $O(2^\sqrt{n})$ (or any other less than exponential but greater than polynomial running time) ever been encountered in the wild as a run time for an algorithm that solves an NP complet...
If we have the following in Haskell: f x y = x + y :type f f :: Num a => a -> a -> a then GHC would report Num a1 => (a2 -> a1) -> a2 -> a1 -> a1 as the type for (f .). Would you please explain me the steps through which GHC comes to such conclusion?
I know one can compute things using tail recursion with helper functions like: let sum_helper n accumulator = match n with | 0 -> accumulator | _ -> sum_helper (n-1) (accumulator+n-1);; let sum_tail n = sum_helper n accumulator 0;; sum_tail 3;; which gives: # sum_tail 3;; - : int = 3 but I wanted an example of som...
How do I add 3 bits using full adder and basic gates, when the initial carry bit is 0?? I have tried using two full adders where two terminals of the first adder gets the first two inputs then the output of this adder goes to of the inputs of the second adder and the third input is given to the second input terminal of...
Assume you have a game tree and the features $(f_1, f_2, f_3,\ldots,f_n )$ that describe the state of the game at any node. Also assume that you are using depth-limited minimax and always expand up to a fixed depth d. Say you have the following four evaluation functions: $F_1=w_1f_1+w_2f_2+\cdots+f_n$. $F_2=w_1f_1^2+w_...
From the definition of the $\Theta$-notation, $$f(n)=\Theta(g(n))\\\implies \exists n_0, \exists c_1,c_2\gt 0, \forall n\gt n_0, c_1\cdot g(n)\le f(n)\le c_2\cdot g(n)$$ We can see that the inequality is followed for all $n\gt n_0$, and hence we can say that $c_2\cdot g(n)$ is the maximum that this function can reach. ...
It is a well-known problem that many top-down parsers have problems parsing a context-free grammar with left recursive rules. There exist algorithms to convert grammars with direct or indirect left-recursive rules to equivalent grammars that don't have such rules. For example, a simple left-recursive grammar $$\begin{a...
this is the arithmetic series: $a/b,2a/b,3a/b,...,ba/b$ The new series: $log(a/b),log(2a/b),log(3a/b),...,log(ba/b)$ I want the complexity of sum of the latter. p.s: sorry about formatting. edit 1: I realized that I need to provide more info: $a,b \in \mathbb{N} $ $a>b$ a and b are not constants. and the answer is som...
What does Hindely-Milner refer to? In Types and Programming Languages by Pierce, I only find that Section 22.4 Unification mentions "Hindley" and "Milner", when introducing the unification algorithm. Does Hindley-Milner refer to the unification algorithm for type reconstruction/inference? https://en.wikipedia.org/wiki...
My question is: in a DAG, each edge has a different value of capacity, we can assume these capacities are integers multiples of the total number of edges. Also, sometimes we can have many minimum cuts, but these cuts have a different number of edges, how can we know which cut has the maximal number of edges?
Consider a $m \times n$ Matrix. Every column represents a class and every row an observation. Every row/observation is a probability distribution, hence every row sums up to 1. We now want to choose elements $a_{i,j}$ of the Matrix. For every column $k_j$ elements have to be chosen, but we can choose just one element p...
In my algorithms class I have generally been proving algorithms by induction. So for example, given some algorithm $A(n)$ that computes $x$, I show that the algorithm works for some base case, say $A(1)$, then I assume that the algorithm will work for $k<n$. Then I show that the algorithm works for some $z=n$. Are ther...
In Types and Programming Languages by Pierce, Ch11 Simple Extensions extends the typed lambda calculus. Section 11.5 Let Bindings says: In Chapter 22 we will see another reason not to treat let as a derived form: in languages with Hindley-Milner (i.e., unification-based) polymorphism, the let construct is treated speci...
I tried my best to solve the recurrence relation. $T(n) \le T(2n/3) + \Theta(1)$ Using the recursion tree. I could reach out the boundary condition when at depth i: $i= \log_{3/2}n$ Can someone please help me out in adding the costs and taking out the upper-bound. I know at each depth the cost is increasing by a power ...
In Types and Programming Languages by Pierce, ML-style let-polymorphism was first described by Milner (1978). A num- ber of type reconstruction algorithms have been proposed, notably the clas- sic Algorithm W (Damas and Milner) of Damas and Milner (1982; also see Lee and Yi, 1998). The main difference between Algo...
Write a regular expression for the language of words over $\{0,1,2\}$ satisfying the following requirements: The word has length at least 3. The last symbol is 2. The second to last symbol isn't 0. The combination of the last two symbols doesn’t appear anywhere else in the string.
Suppose we have $L$ being a regular language with alphabet $\Sigma$, if we define $M=\{ x \in \Sigma^{*} \mid xx^{R} \in L \}$, then we know that $M$ contains all half copies of palindrome strings of $L$, now here comes the question, is $M$ regular? Is it easy to see that when $L$ is finite, then $M$ is clearly also ...
Background: Normally in linear programing we have some objective function $$\text{maximize}\sum_{i = 1}^n a_i x_i $$ $$\text{subject to} \sum_{i =1}^n b_{ji}x_i \leq c_j \text{ for all } 1 \leq j \leq m$$ where $a_i, b_{ji}, c_j$ are all constants given in the problem statement and each $x_i$ is an optimization variabl...
This is what I got for the in-order of the bst but it's wrong because I'm answering some questions about some successors of some of the letters and I got them wrong. so I'm wondering where in this in-order i've gone wrong? d, b, m, h, i, e, a, j, k, f, g, c (Sorry if these questions aren't allowed here, please let me ...
In information theory, we deal with the quantities $I(X;Y), H(X),H(Y), H(X|Y), H(Y|X)$. These are just numbers, but I intuitively think of them as the "measure" of a set of information. There is at least one special case where this interpretation is exact: suppose there are independent variables $V_1,...V_n$, and the ...
I'm trying to prove the following identity: $$ ({L_A}^*\ L_B)^+ = (L_A \cup L_B)^*L_B $$ which is clearly true as both sides will exactly match "any sequence of A and B ending with B" : $$ B, AB,AAB, ABBABAB, ... $$ I tried thinking about the set properties and even tried to reasoning about the NFA constructed by the ...
I suppose that, since a Turing-complete language can simulate a Turing-machine, a non-Turing-complete language can't, but most programs do not have the simulation of a Turing machine as their purpose. I also know that some non-Turing-complete languages can't use unbounded loops, and I suppose that making unbounded loop...
Let's say we are given an infinite character stream like the following: nqDoo8NkPsDn0gVf(pAI)dwa^Vq7OfAgt@KDUkjN5ZXY1yK6w7ygW6S&@L0EsUEq9... What is the most straight forward way to construct a valid password from the stream? A valid password must pass a number of conditions, for example: At least 8 character long Co...
x = m; y = 1; While (x-y > ϵ) { x = (x+y)/2; y = m/x; } print(x); The answer is m½, its the Babylonian algorithm for square roots. I understand the algorithm but haven't been able to reverse engineer what this code does (which is the point of this question since its not part of the curriculum and almost no one ...
I was thinking about how many compares it takes to sort a list of comparable data, and I had an algorithm I was wondering the viability of. (Its not unlikely that someone has come up with this before me [though I didn't find anything by researching it]. So if either this isn't useful, or someone has already come up wit...
I know for a fact that algorithm A runs in $\Theta(\sqrt{n})$, but how does one derive that fact? Algorithm A i = 0 s = 0 while s <= n: s += i i += 1 Here is what I am thinking. We know that A is upper-bounded by O(n), as we increment $s$ by more than 1 in each iteration. We also know that it must be lower-bou...
I am looking for algorithm that quantize grayscale image that contains alpha to 4-bits (16 colors). I quite like the effect that is used in IrfanView to decrease color depth, however, I dont know the exact algorithm plus the alpha channel is lost. Currently I am using Wu's Color Quantizer that works with RGB images. I ...
I got this as the post order sequence but the answer says it is wrong. I do get a bit confused with the post order logic as well. 8 11 10 9 13 16 18 15
I need to define a method to construct a finite automata for a finite language L (part of my proof for something else). My idea: Create $|L|$ accepting states. For each input string $s$ from $L$, create appropriate transitions from a starting state to unique accepting state of s. I don't know how to formally describe...
https://en.wikipedia.org/wiki/Type_erasure says type erasure refers to the load-time process by which explicit type annotations are removed from a program, before it is executed at run-time. Operational semantics that do not require programs to be accompanied by types are called type-erasure semantics, to be contraste...
Here I have a proof related to strongly connected graph from Algorithms book. However, when I run DFS on the following 2 strongrly connected graph, I get different result than the proof. According to property, highest post number in C is bigger than the highest post number in D but it is not. Where am I making mistak...
The following DFA recognizes the language containing either the substring $101$ or $010$. I need to prove this by using induction. So far, I have managed to split each state up was follows: q0: Nothing has been input yet. q1: The last letter was a $1$ and the last two characters were not $01$. q2: The last letter was ...
I've been given the following values to add to a binary search tree (in the order given) 56, 35, 55, 58, 29, 15, 16, 5, 71, 92, 69, 95 and this is what my tree ended up like: but apparently it's wrong?
Let $L$ be a regular language ,and $M = (Q, Σ, δ, q_0, A)$ is a DFA such that $L(M) = L$. Prove that if $|Q| = 2$ then one of the following holds : a) $L=∅$ b) $ε∈L$ c) $∃a∈Σ$ and $a∈L$ The problem is, I think all of these are FALSE. If there is 2 states, none of them are accepting states, then L will have no elements...
I am looking for a formula to express the average number of full nodes (i.e. nodes having exactly $m$ children) in a $m$-ary tree having $n$ nodes, i.e., $$ \mu_{n}^{(m)} = \frac{\# \text{full nodes in all $m$-ary trees having $n$ nodes} }{\# \text{nodes in all $m$-ary trees having $n$ nodes}}$$. As to the denominator,...
For push-down automata it seems obvious to me that a program must always terminate (given the input is finite), because for each input symbol they advance until eventually they run out of symbols and then terminate. The opposite is true for Turing machines as they read their input from the tape and are able to alter th...
Is there a path finding algorithm that exploits a directed bipartite graphs' structure? I found this: Shortest-Path for Weighted Directed Bipartite Graphs but it didn't seem like the OP needed a bipartite graph and the answer reflected that. I also found this: https://www.degruyter.com/downloadpdf/j/comp.2013.3.issue...
https://en.wikipedia.org/wiki/Parametric_polymorphism says: Rank-1 (prenex) polymorphism In a prenex polymorphic system, type variables may not be instantiated with polymorphic types.[4] This is very similar to what is called "ML-style" or "Let-polymorphism" (technically ML's Let-polymorphism has a few other synt...
NL-Complete languages are defined by Log-space reduction, while PSPACE complete languages are defined by poly-time many-to-one reduction. According to these posts : Why not polynomial-space reductions for $PSPACE$-hardness? PSpace-completeness under PSpace reductions Every PSPACE language would be PSPACE-Complete if we...
I have seen a few examples of using the master theorem on this to obtain O(n*log^2(n)) as an answer. I am trying to solve this by unrolling and solving the summation, but I can't seem to get the same answer. My steps are below. Given $T(1) = 1$, $T(2) = 1$ (Time taken is constant in these two cases) I noticed that by u...
Are the elements of a modular ring simply the set of all the numbers from 1 to p−1? in this case p−1 = 6 ? I asked this on the math stack exchange https://math.stackexchange.com/q/3375667 and was told that 0 is included in the the ring. Is this treated differently in CS ?
Divide $n$ gifts of different values among three people so as to minimize the difference in the total cost of the gifts for the most lucky and the most unlucky persons. The total value of $n$ gifts is $W$. The most fair division will be to give all of them gifts of the total value $W/3$. Suppose $W_1, W_2, W_3$ are ...
There is a grammar that describes the walks of a turtle around Manhattan, such that the turtle always returns home. It is described in the book "Parsing Techniques" by Dick Grune and Ceriel J.H. Jacobs, page 18. Unfortunately, I could not find a source online, but the rules are rather simple: $$ G = \left\langle \{0\},...
So I need to find a form of a graph such that its vertex cover is twice that of its matching, but I am running into problems brainstorming, I know K3 is of this form, but not one at such a magnitude.
As in another question, let $$T(N) = \begin{cases}1 & \text{if } N = 1\\ T(\phi(N)) + \lg(\phi(N))^3 & \text{otherwise} \end{cases}$$ where $\phi(N)$ is Euler's totient function. Tasse kindly reasoned that we can write $$T(N) = T(\phi(N))+\log(\phi(N))^3 = T(\phi(\phi(N)))+\log(\phi(\phi(N)))^3 + \log(\phi(N))^3$$ I c...
I am asked to prove that every Euclidean models satisfies $\diamond \diamond \diamond \varphi \to \diamond \diamond \varphi$. How can this be done? I don't see how it could even be true.
Is language {M | M halts and print "Hello World"} recursively enumerable? I'm not sure my proof is correct. Let universal Turing machine U start another Turing machine M2 that reads result of work of given Turing machine M1, which halts on "Hello World" and goes to infinite loop otherwise. Then M2(M1) halts if and only...
Is $\Gamma \vdash x x : T$ possible? This problem appears on page 104 of Benjamin Pierce's "Types and Programming Languages". My conclusion is that it is was the case then we would get $x: T_1 \to T_2$ and $x: T_1$ and by some axiom, these types are not equal. The problem is identifying this axiom but I fear it might ...
Background I am working on proving a novel problem to be P-Complete, and this requires using a logspace reduction to reduce some known P-Complete problem to the novel problem. Particularly, I am reducing the Circuit Value Problem, the de facto P-Complete problem, to the novel problem. The Experienced Difficulty P-Comp...
Let's say there are two processes: p1 and p2, their arrival time and service time are 0,2 and 3,1 respectively. The time quantum is 2s. After excuting for two seconds, will the processor excute p2 or continue excuting p1?
As per Machine Learning, Tom M. Mitchell, Indian Edition, pp. 249-262, it is mentioned that "genetic algorithms employ a randomized beam search method to seek a maximally fit hypothesis". I have searched Wikipedia for the term beam search. I could understand that it is a variation of the breadth-first search method. I ...
Given a Büchi automaton what is the procedure to build an equivalent LTL formula? And what is its size? I'm looking for references but I haven't found them so far.
In the proof of Theorem 1 in this paper by Chen, McKay, Murray, and Williams the authors assume $\mathsf{NP} \subset \mathsf{P}/\mathsf{poly}$ and (in different parts of the proof) state this implies the following two inclusions: $\Sigma_3 \mathsf{TIME}(n^c) \subset \mathsf{SIZE}(n^{O(c)})$ for every $c$ $\mathsf{ZPP}...
I know there are proofs using an adversary technique. I've seen other proofs for search in a sorted list using information theory. But I haven't come across a proof using it to prove the lower bound for a search in an unsorted list using information theory.
Unicode has an abundance of open circles, diamonds and boxes. Using these, we can typeset linear-time temporal logic formulas such as $$ (\mathop{⬦}ψ)\ \,\land\ \,\mathop{⬦}(θ\ \mathsf{U}\ \mathop{◻}\mathop{○}φ)\ \ . $$ However, in my browser, the sizes of the symbols vary too much; the heights don't match, and the res...
The contraction algorithm for min-cut is: pick an edge $(u,v)$ uniformly at random, and "contract" it by merging $u$ and $v$ into a single vertex, deleting self-loops. Continue until two vertices remain; return this cut. The probability of finding the min cut can be shown to be at least $$ \frac{1}{{n \choose 2}} . $$ ...
as you know we have equivalent condition for graphs so I want to ask a very basic question and please help me what is exactly w1(e1) and w1(e2) and w2(e1) and w2(e1) ? If e1 means path from A to B so w1 means the weight of the path e1 and so what about w2 and what does it mean means ? is there any link for this kind of...
Let be $(I_n)_n$ a set of $p$ intervals each contained in $[0, L]$ for $L \geq 1$. I define $(J_n = [a_n, b_n])_n$ the set of intervals which have empty intersection with $I_n$ for all $n \in [[1, p]]$. I'd like to efficiently compute $\max_n (b_n - a_n + 1)$. A basic idea I'd try would be to: (1) Create a segment tree...
[Using Idris for code examples and terminology, but the question is not about Idris per se] In a post titled A Neighborhood of Infinity, @sigfpe argues that "the kind of open-ended loop we see in operating systems and interactive applications" is to be modeled mathematically using codata, and that these sorts of progra...
Given a directed graph G(V,E) and a node s, how do we determine what nodes are reachable from s? Do I need simple traversal algorithms or do I need to look at Tarjan's algorithm?
It sounds like the lecturer is speaking If you for example want to play a music file, mp3 file, well you know, given that you've taken a programming course before, all right? How would you do this? Well, you would look up on Wikipedia, what are the specifications of an mp3 file, and then you would sit down o...
Suppose I have the following subroutine, to a more complex program, that uses spaces to the right of the tape: $A$: "adds a $ at the beginning of the tape." So we have: $$ \begin{array}{lc} \text{Before }: & 0101\sqcup\sqcup\sqcup\ldots\\ \text{After }A: & \$0101\sqcup\sqcup\ldots \end{array} $$ And it is running on a ...
I wish to compare different optimization algorithms (gradient descent, Newton, quasi-Newton, conjugated gradient, etc) for a particular problem at hand. My main focus is on speed of convergence. The issue is that all methods rely on a step-size $\gamma$. How do I compare the speed of my algorithms when I don't know whi...
Say we have a constant-time function that accepts some integer set. The function outputs True if we can split the integers into two subsets of an equal sum. If we can't partition the integers given, the function outputs False. Suppose we can use this function at any time, with any set of integers. Can we make a greedy ...
Succinct data structure = succinct representation of data + bits for indexing. Link Let $S$ be subset of of $\{1,2,\ldots,n\}$ then $\lceil \log (2^n) \rceil + o(\log n )$ bits are needed in succinct representation. The $o(\log n)$ bits needed for the indexing of the succinct data structure. I have a doubt, why $o(\l...
Assuming a 2D maze, how would one go about solving it for rigid 2D object moving through it? Additional specification: The object shape - it is a single entity, not a swarm/fleet. A shape of something one could cut out of cardboard, no infinite areas, no infinitely asymptotic corners. The shape and size relative to ma...
In other words, what is the likelihood that a recognizer of a given regular language will accept a random string of length $n$?   If there is only a single non-terminal $A$, then there are only two kinds of rules: Intermediate rules of the form $ S \to \sigma S $. Terminating rules of the form $ S \to \sigma $. Such ...
Imagine trying to pick a random number from a pool of numbers that contains: i1 times the number 1 i2 times the number 2 i3 times the number 3 ... etc For example picking a random number in a pool of 30 times the number 1 90 times the number 2 would yield 1 with 25% probability and 2 with 75% probability. let NU ...
Line-search/backtracking in gradient descent methods essentially boils down to picking the current estimate $\theta_n$ (which depends on the stepsize $\gamma$ and the prior estimate $\theta_{n-1}$) by performing line-search and finding the appropiate $\gamma$. This search depends on a 'sufficient descent' criterion. ...
I like to reduce the number of exceptions raised in my code, and I thought it might help to consider why these exception are raised in the first place, and whether they are a really a fundamental part of code or just an artefact of not really finishing the program. As a related note I hear OS programming requires avoid...
The algorithms below has been taken from Discrete Mathematics and it's Applications 7th edition book by Rosen. p.253 says that "number of shifts required is $O(n^2)$" and "a total of $O(n^2)$ additions of bits are required for all n additions". Why isn't this algorithm $O(n)$? I can see only two non-nested for loops. ...
According to Categorifying CCCs: Computation as a Process, computation or β-reduction process in untyped-lambda calculus is in fact a 2-morphism in category theory. Can someone please describe me how is it so and elaborate on it? P.S. I understand that category theory is a mathematical concept but since this specific...
Suppose we are given an NFA $M$ (without $\epsilon$-transitions) that we only know the alphabet $\Sigma$ and the number of states $|Q|$ but we do not know any other details of the NFA. We want to develop a black box algorithm that can test if $L(M)=\Sigma^{*}$. My idea is that we can feed every string up to size $|\Sig...
I am looking for a possible algorithmic solution to this problem, but I can't figure out any. Let's say I have a weighted graph (call it G); each vertex on this graph represents a point in a plane, and each edge has the distance as its weight. Now I have another set of vertex, let's call it S, representing points in th...