instruction
stringlengths
35
29.1k
When I was going through the reductions from $HP$ and $\overline{HP}$ in this handout, I do not understand how everywhere the following claim is made: $$⟨M,x⟩ \in \overline{HP} ⇒ \text{M does not halt on x} ⇒ M′ \text{ does not accept any strings} ⇒ L(M′)\text{ is finite} ⇒ M′ \in L_5.$$ Why does $M$ not halting on $x$...
We are given a list $L = {(x_1, y_1, z_1), \dots, (x_n, y_n, z_n)}$ and an integer $m \leq n$. The goal is to find a subset $S \subseteq \{1,\ldots,n\}$ of size $m$ which minimizes the following cost function: $$\mathit{cost} = \max_{p \in S}(x_p) + \max_{p \in S}(y_p) + \max_{p \in S}(z_p).$$ Is there any subquadrati...
I am new to grammar and have written grammar for parsing math expression for asciiMath using ANTLR as below. expression : expression BINARY_OPERATOR expression | UNARY_OPERATOR(expression) | LEFT_PARAM expression RIGHT_PARAM | VARIABLE | NUMBER ; LEFT_PARAM : '('; RIGHT_PARAM : ')'; V...
Project schedules are made of activities, durations associated with each activity, and relationships between activities (SS, SF, FS, FF) with a lag (can be positive, negative, or 0). Let's say I have 3 activities A, B, and C with durations of 2, 3, and 4 respectively and FS relationships between A & C and B & C. A and ...
So for the question 'Given two identical DOM trees, and an element in one tree, find the same element in the second tree'. I can solve it in two ways - Start at the given element and traverse up to the root of tree A - save the path and then follow the path down the second tree to the element. Start at the root and t...
To solve an NP-hard optimization problem optimally, we can use mathematical programming or brute force techniques. I would like to know if it is possible to solve the problem in an online fashion optimally? Is there any mathematical tool that can perform this task? I can design an online algorithm to solve the problem ...
An odious number is defined as an integer that has odd binary Hamming weight. I need an implementation of algorithm that finds the nth odious number, preferably recursive. Any ideas? A python script is also wanted, but I can write it myself once the algorithm is found. More description can be found on formula section i...
This is a homework problem and I'm not sure how to do it correctly. It says "Prove ln(n) = Θ(log2 n) with n = odd number". Bu using Natural logarithm rules, we can somehow know this is partcially true However, I'm stuck with this since I don't understand how to do the whole procedure.
Given a nondeterministic finite automaton $A$, give an algorithm that checks whether the language $L(A)$ decided by $A$ contains a string whose length is a composite (i.e. not prime) number. My obvious [edit: wrong] answer is that, if $A$ has $n$ states, then I can simply check if it accepts any word of composite len...
In an unweighted bipartite graph $G = (X + Y,E)$, we would like to find a maximum matching, but among all those maximum matchings, we would like to find one that saturates a given subset $X_0\subseteq X$. A necessary condition for the existence of such a matching is that $X_0$ satisfies Hall's marriage condition, i.e.,...
I'm looking for a way to find out whether a specific rule in a BNF grammar can be converted to a regular expression. (With "regular expression" (RE), I mean the simple mathematical kind. I'm not interested in BNF rules that can only be done with the use of backreferences, lookarounds, or other advanced features.) I'm o...
Suppose you have a simple sort of lambda calculus abstract syntax tree. The fine details don't really matter. data T = Unit | Void | T :*: T | T :+: T | T :-> T | I data Term x a where Var :: x -> Term x x Int :: Int -> Term x I Add :: Term x I -> Term x I -> Term x I Apply :: Term x (a :-> b) -> Term x a -> T...
I have a directed weighted graph representing street (edges weighted by distance) and street intersections (nodes). Using this graph, I would like find central nodes that a person might find themselves traveling between. For example, I would expect nodes near bridges to have high centrality. What algorithms might I use...
Could you give me examples of polynomial-time algorithms that must compute a global property over their entire input? A purely illustrative example of this might be a graph algorithm that somehow must count the total number of nodes before computing its final answer.
Most discussion of naive (without Union-Find) implementations of Kruskal's algorithm for finding the minimal spanning tree that I see has a handwavy bit: "just use DFS to detect if there is a cycle" and then moves on to more optimised approaches. I like to understand problems so I'm not interested in just skipping to t...
This is a cross post of my question here on math.se. I have a list of $n$ items and would like to randomly select an $m$ set from it efficiently (in terms of time complexity). Also, I want all possible subsets to be selected with equal probability. The obvious solution is to pick a random integer from $1$ to $n$ and ch...
Little law states that the average arrival rate(AR) multiple the average rate of service time(SR) equals the number of customers in the system. But intuitively, if AR > SR shouldn't the system exploded with customers? because on avg, we 'can't keep up' with the number of customers that arrive? In a deterministic system...
I once thought that any analog computer is any computer which "doesn't need electrical current to work". I once thought that any digital computer is any computer which "does indeed need (a correctly distributed) electrical current to work". I found out both assertions as wrong. What are analog and digital in computer s...
I encountered two applications of RS codes - one in group testing, and another time someone said that a solution to an interview question was using it. But when I search for explanations, it's all about the cracks in the CD disks and such. Is there a good source that puts the math first?
I have read proofs that the function is not primitive recursive and I (think) I understand them. Most I've seen show that the set of functions dominated by the Ackermann are exactly the primitive recursive functions etc. But, coming at it from the point of view of the 'ground requirements' which define the collection o...
A unary Turing Machine X has input alphabet Σ and tape alphabet Γ. We represent the blank symbol belonging to the tape alphabet as _ . Given as input 11111 X writes 1_1_11_1 as output. Is the blank symbol discarded when considering the output, ie. is the input equivalent to the output in this case (regardless of how ma...
At page 156 there is an example on how to find the distinguishable states for the following automaton: The following table shows the distinguishable states: By applying the given definition for distinguishable states, it is not clear why E and G are considered distinguishable. For my understanding there is at least o...
Let $L$ be a language. The Myhill-Nerode theorem is based on the following equivalence relation: $$x \equiv_M y \Leftrightarrow \forall v \in \Sigma^*. (xv \in L \leftrightarrow yv \in L).$$ One corollary of the Myhill-Nerode theorem is that if $\equiv_M$ has infinitely many equivalence classes, then $L$ is not a regul...
The original formulation of the 3 restricted grammar types of Chomsky all included the restriction that the right-hand side of a replacement cannot be $\epsilon$ (non-contracting). This, however, can be (and usually is) lifted for regular and context-free grammars (i.e. they are allowed to have productions of the form ...
I have heard the simply typed lambda calculus is the internal language of closed Cartesian categories. I have a written a compiler from the STLC to CCCs but this involves a lot of ugly tuple shuffling. Is it possible to get the STLC for free from the definition of a closed Cartesian category?
Given $n$ distinct values $(x_i)_{i=1}^{n}$ with mean $\mu$ and standard deviation $s$, for all $i$, we have $|x_i−\mu| ≤ s \sqrt{n − 1}$. How does this inequality compare with Chebyshev inequality as $n$ increases?
I'm interested in learning about ranking algorithms that sort items based on preference. For example: If a person was food taster/judge and had 10 small bowls of chili that they had to rank in order from best to worst, in what way should the judge taste the chili from the individual bowls to complete the task of rankin...
Is it possible to have a regular expression from a language (that has strings of infinite length) which it describes ?
I have 2 different datasets with similar objects, one where each object is 50 pixels wide and the other where they are 150 pixels. Each photo is 512x512 for both datasets. These two datasets have the same number of photos. Taken with the same camera, so same focal length, resolution etc... So far, we agree that only th...
I am a little confused about stochastic encoding in channel coding. For example, in the identification problem (R. Ahlswede and G. Dueck, “Identification via channels”), the authors claim that we can achieve nearly 0 probability of error when using $O( \log \log M)$ bits, where $M$ is the total number of messages. Inst...
We are given a recursive definition: $a_1 = x,\\a_2=y, \\a_n= c_1a_{n-1}+c_2a_{n-2} \text{ for }n\ge3 $ where $x,y,c_1,c_2,n$ are natural numbers we are to prove that $a_n \le c_3^n$ for all n The base case is true Assuming $a_k \le c_3^k$ is true show $a_{k+1} \le c_3^{k+1}$ is true We have: $c_3a_k \le c_3^{k+1}$ ...
Let $L$ be a language, and consider the following relation $\equiv_L$ on strings: $s_1 \equiv_L s_2$ if and only if, for every string $w$, we have that $s_1w \in L \Leftrightarrow s_2w \in L$. This is an equivalence relation. Let $I(L)$ be the number of equivalence classes of $\equiv_L$ (a) Suppose $L$ is a language an...
Question Is there an NP-hard problem for which we can add a parameter1 to create a "natural"2 parametrised problem for which no FPT algorithm exists? The adding a parameter is needed because a NP-hard problem is normally just a question with a yes or no answer, if you want to limit some parameter you need to specify w...
Godel proved there are true statements in arithmetic that can't be proven true in any sufficiently strong Formal Axiomatic System (FAS). The authors of this paper use similar arguments to prove there are TM's that belong to a certain complexity class that cannot be proven to belong to that class. They refer to these ty...
I'm working on nandgame's website found here. I'm working on the ALU and here is an image of my implementation: My Implementation: And I compared it to this website's solution: Solution However when I try to submit this... The website gives me this message and error: And for the life of me, I don't see where any of...
$a_1=2,a_2=9,a_n=2a_{n-1}+3a_{n-2}$ for $n>=3$ Show $a_n<3^n$ for all positive integers n Base case: $a_3 = 2*9+3*2 = 24<=3^3$ is true Hypothesis: $a_k<=3^k$ for $k\epsilon\mathbb{N}$, show $a_{k+1}<=3^{k+1}$ Begin: $a_k<=3^k$ implies $3a_k<=3^{k+1}$ by definition: $a_{k+1} = 2a_k+3a_{k-1}$ $2a_k + 3a_{k-1} <= 2a_k + a...
The title could be a little bit confusing, and it is not easy to summarize it within a sentence, therefore I will explain it in detail below. If you have any thoughts on optimizing and rephrasing the title, please tell me in your answer then I will try to make the title much clearer. Suppose we have a list of integers ...
I was wondering for some time how to approach a situation like the following one. Imagine a standard binary tree data structure with $n$ nodes in it. Each node contains pointers to its left and right children, and from that node we can navigate to each of these children in constant time. We are looking to find whether ...
I have a 3D mesh comprised of city buildings, no ground surface, just buildings. The goal is to extract the buildings bottom surfaces. So far I have tried to cut the mesh by a threshold computed from the vertices height histogram - it works good for relatively flat areas, but fails badly for areas with uneven ground le...
Context: type theory. My understanding of: WN: every term can rewrite to NF. Canonicity: every term rewrites into canonical form. Then it leads to an intuition where if canonicity holds, then we get NF = canonical form and therefore WN holds. However, I don't see people state this often, like this question talks abou...
Let $G = (X+Y,E)$ be a bipartite graph and $k\geq 1$ an integer. A maximum $k$-matching is a subset of $E$ in which each vertex of $X$ is adjacent to at most $k$ edges and each vertex of $Y$ is adjacent to at most $1$ edge. A maximum-cardinality $k$-matching can be found by the following algorithm: Create $k$ copies o...
According to nLab article: https://ncatlab.org/nlab/show/functor Definition External definition A functor $F$ from a category $C$ to a category $D$ is a map sending each object $x \in C$ to an object $F(x) \in D$ and each morphism $f : x \to y$ in $C$ to morphism $F(f) : F(x) \to F(y)$ in $D$, such that $F$ preserves...
I'm reading Data Structures and Algorithms by Goodrich. The explanation that he gives for Big Oh notation is given below: Let $f(n)$ and $g(n)$ be functions mapping positive integers to positive real numbers. We say that $f(n)$ is $O(g(n))$ if there is a real constant $c > 0$ and integer constant $n_0\geq1$ such that ...
It's being said booth's algorithm produces the output exactly as normal binary multiplication while reducing the number of operations performed and can be used for both positive and negative numbers ! I tried multiplying two 4-bit numbers while I don't get the same result...Please guide what am doing wrong. Multiplican...
Question While trying to search for a (example of a) NP-hard problem that fixed-parameter reduces to another NP-hard problem that is known to be fixed parameter tractable, such as k-Vertex Cover, my search results are "poluted" by papers establishing $W[1]$ hardness through parameterized reductions. It is stated in num...
I'm exploring the idea of using machine learning to draw a topology of elements. For example, imagine a tree representing geological hierarchy (country -> province -> city). All countries are at the top-most level, then the provinces for each country, followed by the provinces splitting into cities at the 3rd vertical ...
In CLRS 3'rd edition there is a Lemma 26.2 which states that: Let $G=(V, E)$ be a flow network, let $f$ be a flow in $G,$ and let $p$ be an augmenting path in $G_{f}$. Define a function $f_{p}\colon V \times V \rightarrow \mathbb{R}$ by $$f_{p}(u, v)=\left\{\begin{array}{ll}c_{f}(p) & \text { if }(u, v) \text { is on ...
I am studying term rewriting by reading Baader/Nipkow's book: "Term Rewriting and All That". I want to prove a lemma about terms, position of subterms and replacement of subterms. The notation is as follows: $s|_{p}$ denotes the subterm of $s$ at position $p$. $s[t]_{p}$ denotes the term obtained from $s$ by replacing...
I have an array of 64-bit integers of length $n$ and I want to find the frequency of each element in $\mathcal{O}(n)$? is that possible? my idea was to use a hashmap but it seems to me that the adversary would always be able to find a pathological case.
The Number is given as : (C012.25)Hexadecimal I have to convert it into octal . So I converted it into Binary First and got the result as : 1100000000010010.01000000 (Since each bit in hexadecimal represents 4 bit in binary so C=1100,0=0000,1=0001,2=0010 and for 0.25=.01000000 ) The Solution mentions the Binary convers...
MCG Problem: Consider a positive integer R and an undirected graph G = (V, E), in which each vertex is assigned a weight (or value). The maximum-weight connected graph (MCG) problem is to find a subgraph with R vertices that is connected and maximizes the sum of the weights (or values) of the R vertices. CMCG Problem: ...
I've been given a question to solve: Given a set of non-negative distinct integers, and a value $m$, determine if there is a subset of the given set with sum divisible by $m$. For this question the answer is here I don't understand the part after if DP[j]==True what is actually the intuition behind this code. Please ...
Is there an algorithm on how to check if two LTL expressions (represented as binary trees) are semantically equivalent? Since there are many smaller equivalences such as $a\Rightarrow b \equiv \neg a \vee b$ or $F(a) \equiv true U a$ as well as commutativity, distributivity, etc. that need to be considered. My initial...
I'm wondering if it's possible for algorithms that have monotonically decreasing runtime with the input-size - just as a fun mental exercise. If not, is it possible to disprove this claim? I haven't been able to come up with an example or counterexample so far, and this sounds like an interesting problem. P.S. Somethin...
In "Finite Model Theory and Its Applications", page 152, it is said that Deterministic Transitive Closure, on ordered finite structures, captures LOGSPACE. Hence, taking into account that FOL captures LOGSPACE, the following should be possible: Given a functional relation R(X,Y) (e.g. "motherOf(X,Y)") Define, in FOL, ...
We can create variants of the loss function, especially of ridge regression by adding more regularizer terms. One of the variants I saw in a book is given below $min_{w \in \mathbf{R}^d} \ \ \alpha.||w||^2 + (1-\alpha).||w||^4 + C||y-X^T.w||^2$ where $y \in \mathbf{R^n}, s \in \mathbf{R^d}, X \in \mathbf{R^{dxn}}$ a...
Given a list X containing m number of x coordinates and a list Y containing m number of y coordinates. The coordinate (x, y) is valid if and only if the difference between x and y is less than or equal to d. I need to find out the maximum number of valid coordinates. Here is my algorithm. sort the list X in non-decreas...
I am reading some slides on Algorithm to understand why termination is an undecidable problem. The slides say the following: – Assume termination(P) always terminates and returns true iff P always terminates on all input data; – The following program yields a contradiction while termination(P) skip; But I do not see ...
Specifically, I have tried boiling down the operations of a VM into the smallest possible standardized units and arrived at this: allocate_stack(size) fetch(offset_from_stack_pointer) store(offset_from_stack_pointer) call(index) So you might have: allocate_stack 6 fetch -2 store 0 fetch -1 store 1 call 72 Basically, ...
NP4 = { L | There exists a non deterministic polynomial Turing machine M, such that for every x∈L, M accepts x on at least 4 paths in the computational tree of M on x. and for every x∉L,M accepts x on at most 3 paths in the computational tree of M on x. }
I'm developing an algorithm for concurrent heap garbage collection/compaction. It will be used in low latency systems that need to scale well to a lot of clients, e.g. web servers. I thought about an algorithm that would be suitable but it does have a few flaws. I'm not very good at describing algorithms, so please cor...
Let G be undirected graph, G=(V,E), and all edge weights are distinct. Consider an edge e=(u,v)∈E that wasn't included in the solution obtained from applying Kruskal Algorithm to G. Prove that this edge isn't in any Minimimum Spanning Tree of G.
When we write code, after compilation the code will be converted to machine language and then stored in the hard disk. But before compiling the code, it is still in the high-level language. How and where is the memory allocated for the source code before compilation? I assume that before compiling the code is stored in...
I am sorry for the repetition of the question. I understand that this question has already been answered before by the community, but most answers tend to focus on unweighted graphs. I want to know Can DFS we used to find the shortest path for weighted graphs? I know that Dijkstra's algorithm is used to find the shorte...
If $P=ab$ and $Q=a^*$, how do I use Arden's theorem to determine the regular expression $R$. I'm not sure if I am supposed to just substitute the values of $P$ and $Q$ in the equation $R= Q + RP$. Also how would I use that to check that $R$ satisfies Arden's equation.
I am having trouble understanding how to apply Pumping Lemma to show a Language is not regular. If the alphabet is $\Sigma = \{a, b\}$ and the language is $L = \{a^{i + 1} b^{4i + 2} \mid i \in \mathbb N\}$, how do I prove the language is not regular using pumping Lemma? Also what is a pumping length, how do i know to ...
I tried reading the wikipedia about Dominator (graph theory), which gives the following definition of a dominator node: a node d dominates a node n if every path from the entry node to n must go through d. I need to understand the concept of a dominator node but I do not need to go deep into graphs, so I'm trying to ...
My understanding of P. vs NP is quite limited. I can understand P refers to an algorithm with an upper bound (big O) with order of growth $n^c$ for some constant c and variable n. My question is, do NP problems have a hypothesized lower bound order of growth (big Omega) of $c^n$ for deterministic machines? I can't find...
I am studying the complexity classes and I am confused what is the complexity of the following problem: "Does a directed graph G has at most 1 Hamiltonian cycle?" So, from my knowledge and understanding: Existence of Hamiltonian cycle is a NP(C) problem. Existence of exactly $k$ ($k>1$) Hamiltonian cycles in a graph b...
Whenever CPU needs the data, it gives the address of that word to the RAM via bus, then the RAM generated the copy of that word and sends to the registers via bus. Why can't the RAM send the original data instead of the copied data? Are there any disadvantages of storing original data or reference in registers?
I wonder if there exists language-agnostic data structure notation. Preferably a standard, allowing to describe data structures and basic data types. e.g. something like a subset of WebIDL. A motivation is to describe data structures (a model) in a way that is standardized and language-agnostic. Then have a set of mapp...
Many standard Compiler Design texts mention constructing augmented grammar as first step of LR parsing. The reason frequently is It is required in cases where start symbol comes on right hand of any production It is required when start symbol's RHS have multiple production. I figured that if in the parse table's acti...
My question is: Is there a simple construction similar to Turing's 'liar' program that shows that Turing machines plus a halting oracle cannot decide if a given Turing machine halts on all inputs. When I talk about the liar program I am referring to the standard proof that a Turing machine can't determine the halting...
I'm trying to generate a graph based off some data I have. This graph should have N nodes where the number of edges each node has is equal to a random number P(k), where k is the "index" of the node (mostly arbitrary). My question is, is there an actual way to do this? I'm thinking that I need more data that either det...
lets say Given input is n = 6 (n is as large as 100000) My task is to divide {1, 4, 9, 16, 25, 36} into two groups and PRINT these two groups Possible Solution 1: dividing groups as {1, 9, 36} and {4, 16, 25} which gives abs diff as abs(46 - 45) = 1. So the minimum difference is 1 and the two groups are {1, 9, 36} and ...
Lets say I have the following DNF: (x or y) and (z or i) / $(x\lor y)\land(z\lor i)$ How do I convert that into a polynomial form?
I am new to the complexity theory and I am trying to understand what would be the complexity of the following problem: "Is a graph AT LEAST $k$-colorable?" Whether a graph is $k$-colorable is clearly a NPC problem and is explained by reduction to 3-SAT. However, I am not sure to which complexity class belongs the modif...
I know that $P \subseteq NP$, but for a problem in $P$, e.g. MST in a graph, is it a correct statement to say that: The MST problem belongs in NP-Class. (I mean, i think it is correct, but could someone classify that as wrong because he would expect P instead of NP?)
I'm currently working through Algorithms by Dr. Jeff Erickson. The following is an algorithm presented in the book: NDaysOfChristmas(gifts[2 .. n]): for i ← 1 to n Sing “On the ith day of Christmas, my true love gave to me” for j ← i down to 2 Sing “j gifts[j],” if i > 1 ...
Although many texts state Dijkstra's algorithm does not work for negative-weight edges, the modification of Dijkstra's algorithm can. Here is the algorithm to solve a single negative-weight edge without negative-weight cycle. Let $d_s(v)$ be the shortest distance from source vertex s to vertex v. Suppose the negative e...
First of all, I know objects are not meant to model the real world, although they have been marketed as such and perhaps that was an intention at some point. Here I say 'modeling the real world' in a general sense. That includes simulations, modeling of abstract (non-real) concepts and modeling of business support appl...
I'm new to writing math notation that describes algorithms and I need to translate some python code. Does the notation structure below correctly describe a nested for-loop that for-each value in p iterates over all other values in p? Example code function(p): for a in p: for b in p: // do something...
This problem is originated from the game MapleStory, where the player needs to build "tri-nodes" to enhance their skills, and each skill should appear in two different tri-nodes. For my character, Kanna, I want to enhance 9 skills with 6 tri-nodes (2x9=3x6). After thinking a while for an optimal strategy, it seems to ...
I am working with this code: function strange (list a[0..n-1] of integers such that abs(a[i]) ≤ n for every 0 ≤ i ≤ n - 1, list b[0..2n] of zeroes) for i ← 0 to n - 1 do a[i] ← a[i] + n for i ← 0 to n - 1 do for j ← 0 to abs(a[i] - 1) do b[j] ← b[j] + 1 return b I am trying to figure out ...
How do I name VRAM and RAM properly in a paper? "Video RAM" is clear but the "normal" RAM? Is it called "CPU RAM" or "Processor RAM" or "Main RAM" or totally different?
I am attempting to define an optimization for the following problem: given a graph find the largest interval(s) where S > S_th (the narrower the interval the smaller S will be) and P < P_th (the wider the interval the higher P will be). I am not 100% certain the claims in parenthesis are always correct as, I think, it...
I'm working through so textbook questions on regular languages, and came across a problem that amounts to showing the following language is regular, given that $A$ is a regular language: $$ \{x|\exists n \ge 0 \; \exists y \in A \; y = x^n\} $$ I've attempted to show that this is regular by a contradiction using Myhill...
In theory, given that: The LALR parser can be constructed by merging LR(1) states with the same core; If $I$ is a LR(1) set of items, then $\text{core}(\text{GOTO}(I))=\text{GOTO}(\text{core}(I))$; the SLR and LALR automata should be isomorphic.
In the standard 3-partition problem, there are $3 m$ integers, their sum is $m T$, and they have to be partitioned into $m$ subsets of sum $T$ and size $3$. Consider the variant without the restriction that the size is $3$ (but with the restriction that there are $m$ subsets with a sum of $T$). Are these problems compu...
Given a matrix $M$ of certain size $h\times w$, where $h\leq w$, for example $5\times 6$, are also given the following set $B$ of additional all-ones matrices, that I like to call target (b)oxes. $$ \begin{matrix} Boxes: & \begin{bmatrix} % 2 x 5 1 & 1 & 1 & 1 & 1\\ 1 & 1 & 1 & 1 & 1 \end{bmatri...
Prove that $3n^3 - 6n^2 + 9n - 9\log n \in \Theta(n^3)$ using So, how can I prove this by big theta definition? I don't what I should do with the log function
I have a recurrence relation as follows $$T(n) = 2T(\lfloor n/2\rfloor) + n\log(n)$$ Using the induction hypothesis how do I obtain a relation $T(n)\leq E$ such that $E$ contains neither $T$ nor floor operator ($\lfloor\cdot\rfloor$).
I’m an amateur in the study of algorithms. For a while I’ve had a burning question, why do we study complexity theory in computer science? The reason I ask is because algorithms with better asymptotic complexity are not always faster for practical purposes, in fact they can be absurdly slower. Why not instead develop ...
The master method works well on problems like $T(n)=kT(an)+cn$, but it does not handle problems like $$T(n)=n^{\frac{1}{3}}T(n^{\frac{2}{3}})+n^2$$ With the number of branches for each partition is a function of $n$. I wonder if there's a good solution to this kind of problems, I have no idea how to solve this, any hel...
I have heard the simply typed lambda calculus is the internal language of Cartesian closed categories. What's the internal language of the opposite type of category? The rules dual to currying and uncurrying are: $$ \mathrm{mal} : \mathrm{Hom}(b, a + c) \to \mathrm{Hom}(b \vdash a, c) \\ \mathrm{try} : \mathrm{Hom...
Given $T(n) = 9T(n/3) + n^3$, I know that $a =9$, $b=3$, and $f(n) = n^3$ and $n^{\log_{3}9} = n^2$ thus Case 3 applies: $n^{\log_{b}a} < f(n)$, $n^2 < n^3$. Can someone explain how to apply the regularity condition and how to check the regularity condition? $af(n/b) \le cf(n)$ where $c < 1$ I appreciate your help!
Which function results from primitive recursion of the functions $g$ and $h$? $f_1=PR(g,h)$ with $g=succ\circ zero_0, h=zero_2$ $f_2=PR(g,h)$ with $g=zero_0, h=f_1\circ P_1^{(2)}$ $f_3=PR(g,h)$ with $g=P_1^{(2)}, h=P_2^{(4)}$ $f_4=PR(g,h)$ with $g=f_3\left(f_1(x),succ(x),f_2(x)\right)$ (1.) $g:N^0\to N$, $h:N^2\to...
I am new to CFG's and automata in general and I came across an exercise where I needed to construct a CFG for the language {a^m b^n | n <= m + 3}. So m can be infinitely bigger than n but n can only be up to 3 more bigger than m and they can be the same. I have no idea how to make a CFG for this. What I came up with wa...
I am learning λ-calculus and I have some confusion about it. Is the term $(\lambda x.x)(y y)$ a normal form in call by value reduction strategy? (where $y$ is a free variable) From the wikipedia, it says: Call by value Only the outermost redexes are reduced: a redex is reduced only when its right hand side has reduced...
Can we construct an explicit Turing Machine with a Halt1 oracle that decides if a standard Turing Machine halts on all inputs? By a Halt1 oracle I mean that we have the ability to decide if Turing Machines with a Halting oracle halts or not.