instruction
stringlengths
35
29.1k
I am wondering what the time complexity of a for loop that increments the control variable, but also multiplies it inside the loop. For example for (int k = 0; k < n; k++) { stuff k *= 2; } I am thinking it must be something like O(log n), but I know that is not it. Any help would be appreciated.
My textbook says that the Dijkstra algorithm's runtime is $O(n) + O(m \log(n)) = O((n+m) \log(n))$. How did they come up with that? Dijkstra algorithm pseudocode: 1. Dijkstra(V, E, s): 2. Create an empty priority queue 3. for each v ≠ s: 4. d(v) ← ∞ 5. d(s) ← 0 6. for each v ∈ V: 7. ...
Given a dictionary of words and their frequencies (how many times they appear in a universe and given a string(no spaces, punctuation, etc.). What is the best way to segment into individual words? I believe a dynamic programming approach would be best. But I am not sure how to proceed about throwing away unnecessary pr...
I don't understand why when proving if Halting on all inputs problem si not in RE using the complement of the halting problem, I have to take a turing machine and simulate the machine M(the machine that the halting problem receives as input) on w(the word received as input) for n steps. Can somebody explain to me who i...
I have recently learned about artificial neural networks (very interesting) and genetic algorithms (also very interesting). I have read some suggestions concerning how to crossover two parent neural networks to produce a child. For example, randomly selecting weights and biases from either one parent or the other, or s...
So, if you have an 8-bit computer and it can perform a fetch cycle, meaning it can access its memory, how do you create words the computer understands. If LDA "load the accumulator" is in the instruction set and its just something we named for humans and the computer understands binary... How was this idea communicated...
Let G be a connected, undirected graph containing some vertex s. let's say that BFS and DFS are both run on G starting at s and that the breadth first search and depth first search trees produced are the same. Show that G is a tree. Would this be good enough? In order to show that G is a tree Let ...
I have a problem that asks me to consider the string abbbaacc. I'm supposed to figure out which of the following lexical specification produces the tokenization ab/bb/a/acc. The options are: A. a(b+c)* b+ B. ab b+ ac* C. c* b+ ab ac* D. b+ ab* ac* I just learned ab...
Given a state $s$, and a value function $v^i$ that determines the expected payoff for the i-th agent in that state, can the two definitions below, one of Nash equilibrium and another of Pareto optimality be compared to one another? Nash equilibrium: $$v^i(s, \pi^i_*, \pi^{-i}_*) \ge v^i(s, \pi^i, \pi^{-i}_*)\ \ \ \for...
We know that minimal edge cover for the normal graph is polynomial time solvable. Is it also true for hypergraph?
I came across this question in a coding interview and couldn't figure out a good solution. You are given 6 dominoes. A domino has 2 halves each with a number of spots. You are building a 3-level pyramid of dominoes. The bottom level has 3 dominoes, the middle level has 2, and the top has 1. The arrangement is such that...
I have the following task (no homework). Find all equivalence classes of the Myhill-Nerode relation of the language $$ \mathrm{A} \triangleq\{w \in \Sigma^{*} | w\text{ does not end with }01\}\,. $$ Because I have no Idea how I to find does classes -I know the theory, but I can't use it -. So I build a DFA (what i sh...
Let $\Sigma = \left\{ 0,\,1,\,2\right\}$. I want to look at the following language: $L=\left\{ xyz \, | \, |x|_0 + |z|_0 = |x|_2 +|z|_2 \wedge y \in \left\{ 1 \right\} ^{*} \right\}$. I would like to prove or disprove $L$ being context-free I'm having a very hard time to construct a context-free grammer for $L$, so I ...
I have a problem like the knapsack problem, except instead of finding the max value, I'm trying to find the closest value to a given value. Anyone know where to start, have a name for this problem, or can point me to an example? Thank you!
I have an undirected weighted graph. I want to find the path from A to B which length (sum of the weights) is as close as possible to a specific value "L". To do that, I have been doing a DFS to check all the possible paths... When L is relatively small, it's ok. But when I ask for a bigger L, it takes too much time to...
I am reading https://www.irif.fr/~mellies/mpri/mpri-ens/biblio/Selinger-Lambda-Calculus-Notes.pdf and would like to know, what the following statement means: Lambda terms: M,N ::= x | (M N) | (λx.M). It is from page 11. What does for example mean? Is x a type of M and N?
So I’m making a program where I generate a computation graph that will be executed on an external device, where the goal is to order the computations in the graph so that the whole computation is done as efficiently as possible. I wonder if any of you know how my problem can be mapped to existing compiler or graph algo...
There are many different explanations of the Hungarian algorithm. My favorite explanation is the one based on matrices, for example here, since it is very intuitive and easy to carry out in a spreadsheet. The problem is, I could not understand the argument of why this algorithm, in its matrix formalism, is polynomial i...
Suppose I have $n$ horizontal segments in the plane (i.e. their end points share the same $y$ value). I want to determine if there exists a line that intersects all such segments. I think I can assert that (by some argument based on shifting the line), there exists such line iif there exists a line positioned on some e...
Say you have a bunch of rectangles like these: They get organized into 3 distinct final shapes like this: As you can see, there are a few "complete contours", as in here: The way you figure out the contour of the thing is by visually going around the edge of the final shape, sort of like this: The question is, give...
we have a six-sided dice numbered from 1 to 6, and each has the probability $p =\frac{1}{6}$. My task is to create a unbiased method to generate a random number from 1 to 10 using the given dice. I am aware that the method should maps the following set $$ \{1,\dots 6\}^k\mapsto \{1,\dots, 10\}$$, with $k$ is the num...
Tarski proved that the first-order theory of real-closed fields is decidable. Is the exact computational complexity known? The best upper bound I could find is EXPSPACE [1], where it is also conjectured to be EXPSPACE-hard. Update: The complexity without multiplication, i.e., of FO$(\mathbb{R},+,<)$, is complete for t...
Pushdown automata have an interesting property: non-deterministic ones belong to a different computational class than deterministic ones. This is in contrast to finite state and turing machines, for which adding nondeterminism does not change the computational class. Is there a class of automata that is not Turing comp...
For example, a sequence has the defined growth property: if it is a sequence of positive integers $a_{1}, a_{2}, a_{3}....a_{n}$ and such that: $a_{1}=1.$ $a_{n+1} \leq$ Max$_{1\leq i \leq n}$ ($a_{i}+1$) We can quickly compute the number of such sequences of length n with the power of dynamic programing: Let s...
Not having received a satisfactory response to this question in math.SE, I am asking it here: In this question, it is mentioned that the best known Boolean circuits for the Clique problem are non-monotone circuits that are smaller than monotone circuits for Clique. I’m looking for a reference to these best-known circui...
I'm wondering if anyone has experience trying to solve a weighted set cover problem over the power set (i.e. all possible subsets) of an $n$-element ground set where the number of sets included in the cover is limited by some constant $k$. This post indicates that the problem is in $\mathcal{P}$ with running time $\m...
I am self studying automata theory and I found a problem set from an old class I took a few years ago, but I have no clue how to solve the following problem, any help would be appreciated. Suppose we have a regular language $L \subseteq \{0,1\}^*$ and the language $ \mathbf{S} = \{uu: u\in \{0,1\}^*\}$ is a subset of $...
Let $e_1,e_2,\cdots,e_n$ are some events are given by their starting time and ending time. I have to find an event that conflict with maximum number of other events. Conflicts means interval overlaps The idea is as follows: Sort events according to their starting times and then for each event check whether it conflic...
Given a tree $T$ rooted at $1$. Each node might have more than 2 children. You want to create a tree $S$ where each node have $2$ or less children or a binary tree. For each node $u$ in $T$ which had more than $2$ children. Let $D$ be the number of $u$'s children. You can add $D-2$ node to replace the edge connecting $...
This is a problem I found in an old exam in my school. I have to solve this Genetic Algorithm problem: N students $x_{1},..,x_{N}$ have answered a quiz of 10 questions (True or False questions) and have obtained scors $s_{1},..,s_{N}$ (score can go from 0 to 10). From these scores we would likw to deduce what are the c...
Sorry for asking such a dumb question. I am CS student and I am trying to understand the basic tenets of Logic. I am new to the subject and I am lost understanding Implication. In formal logic, $(P\rightarrow Q)$, The sentence letter $P$ is premise and $Q$ is conclusion, right? Now, we know that $(P\rightarrow Q)$ is ...
I'm trying to allow an empty transition in a PDA for the following language: Alphabet: $Σ = \{a, b, c\}$ Language: $L = \{ a^ib^j \mid i \neq j \} \cdot \{ c \}^\ast$ Examples of words in $L$: $\varepsilon$ $aabccc$ $abbccc$ Not in $L$: $abcc$ $aabbc$ Here is what I came up with: The diagram above uses JFLAP - w...
I read that "Memory Mapping Segment"/"memory mapped file" is a segment of the virtual memory of a process, where a file or file-like Ressource is loaded into. It is for high performance file I/O. I wonder.. (1) Is this normally done automatically by the OS? (2) What are reasons to do this other than loading shared lib...
Given the following recursive equation $T(n)=3T(\dfrac{n}{8})+ Θ(n^{1/3})$ I want to know how to explain the applicability of the Master theorem in a rigorous way and what means asymtotic limits of complexity exactly? I remarked the two cases are not satisfied. So I have to check the third case and i saw that $n^{1/3}...
I am trying to prove that $L = \{\langle M \rangle \mid L(M) = \{\langle M \rangle \}\}$ is undecidable, where $\langle M \rangle$ is the code of the TM $M$, and $L(M)$ the language recognized by $M$. I think I can't use Rice's theorem, so I tried to find a reduction. The halting problem for example does not help me i...
I wonder if there are more things we can do with bits aside from NOT, AND, OR, XOR operations? I got this question from my teacher and I'm not really sure. How about bit shifting ">>"? Could we count this? Thanks for replying.
My understanding is that a production is a 'rule' of a grammar which defines how a symbol sequence can be rewritten into another symbol sequence. A derivation on the other hand is the process of forming a new symbol sequence by following the rules (productions?) of the grammar. The Wikipedia-page in my language contra...
wondering if you can help me with the following problem. I have one table consisting of items in each person's bag: name | item1 | item2 | item3 ____________________________________ jack | pen | pencil | eraser ____________________________________ jane | phone | pen | camera ________________________...
On the boolean cube $\mathcal{B}=\{0,1\}^n$, we assign each vertex a value by $p:\mathcal{B}\rightarrow[0,1]$. Let $$\tilde{p}_i=\sum_{x\in\mathcal{B}}(-1)^{x_i}p(x).$$ What is the value of $\max_p\sum_{i=1}^n|\tilde{p}_i|$? Since the objective $\sum_{i=1}^n|\tilde{p}_i|$ is convex on $p$, we can safely assume that $p...
In the CLRS, there's this part, where it's shown that $$\lim_{n\to\infty}\frac{(n^b)}{(a^n)} = 0$$ In the same chapter, it uses the aforementioned equation to prove that any polylogarithm function grows slower than any polynomial one, thus, $$\lim_{n\to\infty}\frac{\log b^n}{ n^a}$$ It does that by substituting lgn for...
The Church-Turing thesis proves that there is no algorithm (or program) $H$ that says whether a program $P$ written in a language, say $C$, on an input $I$ outputs the sentence Hello World or not. This is his proof, visit Hopcraft and etc. introduction to automata theory languages and computation, chapter 8. The proof ...
I have a sequence of points $(x_1, \ldots, x_n)$ and a function $f$ that maps every consecutive subsequence (ie. of the form $(x_i, x_{i+1}, \ldots, x_j)$) to a real number. I want to split this sequence into partitions of consecutive subsequences so that the sum of $f$ on each partition is maximized. For example, supp...
Let $T:Σ^*\to Σ^*$ be an operation such that $T(L)$ is regular for all regular languages $L \in Σ^*$. Is it possible to prove $T^∞(L)$ is regular? $T^∞(L)=\bigcup_{i=1}^{\infty}{T^{i}\left(L\right)}$
I have a question about makespan calculation. I know that makespan formula is like this: Makespan = Time of completion of last job - Starting time of the first job but I can't figure out how we should use it for several machines. I have a load balancing algorithm that helps in processing of several independent jobs...
I have a question about method that I saw on internet and method that my professor showed me. I have this finite state machine: q1(a)=q1 q1(b)=q2 q2(a)=q2 q2(b)=q3 qf3(a)=qf3 qf3(b)=qf3 My professor using a method r(p,q,k+1)=r(p,q,k)|r(p,k+1,k)r(k+1,k+1,k)*r(k+1,q,k) and he start from (1,3,3). He get r(1,3,3)=a*ba*b...
Given $n$ arrays. Each has size of $h$. Let $a_{i, j} \in \mathbb{I}$ be the $i$-th element of $j$-th array. You can select at most $k$ numbers from all arrays but if you pick $a_{i, j}$, you have to pick $a_{1, j}, a_{2, j}, \dots, a_{i-1, j}$ as well. Each element can only be picked once. Find maximum sum of elements...
I saw a question similar to this one, and it was answered but the answer was kind of vague and I'm looking for a little more detail than that. The question I'm referring to is this one. The answer simply states that there are more page tables, one for each process. And the same thing is said in the book that I'm studyi...
I am trying to implement a 3-term recurrence relation: $$ p_{n+1} = ap_n + bp_{n-1} $$ This can be implemented as p0 = P0 // starting value p_0 p1 = P1 // starting value p_1 loop n = 2,...,N pn = a*p1 + b*p0 p0 = p1 p1 = pn Depending on $(a,b)$ and also the stopping point $N$, this can sometimes over...
I'm new to the CS stack exchange, so a fond hello to you all! I joined since I have a question I've been curious about. I have recently been running some experiments in transfer learning - specifically I train a network to recognise a certain image, let's say a cat, and then I transfer the input and hidden layers of th...
NP COMPLETE problems are hard in the worst case (assuming $P \neq NP$). What that means is that for every polynomial $p$, sufficiently large integer $n$, and algorithm $A$, there is an instance $x$ of size $n$ for which the algorithm takes more than $p(n)$ time. But this is one instance for every (sufficiently large) $...
This was a question from the 2016 local (selection) contest in ETHZ, You have a high-precision alarm clock with three operations: 1) reset wake-up time to midnight (00:00:00.000000) 2) modify the wake-up time by  ± 1 microsecond (wrapping around at midnight). You know your wake-up time ("hh:mm:ss.yyyyyy") for the next ...
Simulated annealing and genetic algorithm are examples of evolutionary optimisation algorithms. Both of these methods entail doing a search on a graph of candidate solutions. Do all other evolutionary algorithms too entail - performing search on a graph?
This is a problem from Skiena's excellent book The Algorithm Design Manual: Give an algorithm for finding an ordered word pair(e.g."New York") occurring with the greatest frequency in a given webpage. Which data structure would you use? Optimize both time and space. We need to look at all the words, so clearly we...
Finding sum of a geometric progression is simple when we just need to report the sum, but when some modulo or multiplicative inverse is asked of that sum the task become tedious for me. I have a geometric progression: $$\frac{1}{n} + \frac{n-1}{n^2} + \frac{(n-1)^2}{n^3} + \dots$$ Now the sum will be something like $$...
this is my first post on this exchange. I am looking for some help with defining a proof that a set of operations I have designed forms a commutative monoid. (Disclaimer: I am not sure that I have phrased the question properly so I will be very grateful for restructuring it if necessary.) I think it will be better if ...
Consider the following statement In FOL, we can reduce entailment checking to satisfiability checking: $S \models S' \iff S \land \neg S'$ is satisfiable (This proof strategy is called refutation). Is the above statement true? If yes, then I got confusion because of the following steps $ S \models S' \iff S\impl...
I'm not sure how to solve apply the master theorem in order to solve this recurrence: $$ T(n) = 4T(n/3) +O(n\log n),\text{ where } T(1) = 1.$$ The master theorem I have been shown is normally used to solve recurrences of the slightly different form $$ T(n) = aT(n/b) +O(n^d),\text{ where }T(1) = 1.$$
Let's say I have a hash table of 10 buckets where each bucket is of a number of bits. However each bucket doesn't have to have the same number of bits. Is it possible to achieve this? Or does it require padding every entry? For example: Index 0 has 12 bits. Index 6 has 5 bits. Index 1-5, 7-9 are empty. Does this imply ...
John joined a meetup where organize day long fishing trip once a month. The organizers are vary poor at planning, so will organize fishing on a random day of the month without any advance notice. Sadly, John needs to inform his boss in order to get time off from work at least a day in advance. With this situat...
The base scenario is this: We're given a weighted, directed graph $G= (V,E)$, and are tasked to find an approximating algorithm which returns a digraph $G' = (V,E')$ (i.e. which only deletes edges) so that $G'$ is acyclic, and so that the sum of the weights of the remaining edges $\sum_{e\in E'} weight(e)$ is as big as...
I understand the differences between Regular, Context-Free, and Context-Sensitive languages. Designing a Regular Grammar can be easier if you have a DFA. Designing a CFG isn't too hard for the palindromic strings, but not easy per say for other combinations. But when asked to produce a CSG for Context-Sensitive languag...
In some scientific work describing Discrete Fourier Transform-algorithms, such as the well-known Cooley-Tukey algorithm, I came across the term 'Butterfly operations' and 'Butterfly combinations', which seem to refer to the fact that an algorithm takes elements that are half an array away (where the array itself is a p...
Does language $L ={\varepsilon}$, where $\varepsilon$ - empty word has suffix/prefix property? The definition says that language has prefix/suffix property requires that there is no code word in the system that is a prefix (initial segment) of any other code word in the system. So if we have this finite language with $...
We are given a set of names and a set of papers with names written on each side of the paper (not necessarily different ones and either side of the paper can be empty). Can we place the sheets on a table such that every name shows up? Show that this problem is NP-complete. I have difficulty in finding out an NP-complet...
As far as I can tell, these two directed graphs are reflexive, symmetric and transitive.
The Short Story A famous computer scientist, Tarjan, wrote a book years ago. It contains absolutely bizarre pseudocode. Would someone please explain it? The Long Story Tarjan is known for many accomplishments, including the fact that he was the coinventor of splay trees. He published a book, "Data Structures and Networ...
Given a graph $G$ with weights $w_e$ on the edges, choose a subset $S$ of the ''edges'' such that $S$ doesn't contain any 3-cycles, maximizing $\sum_{e\in S} w_e$. Is this problem NP-hard? I thought I saw some mention or folk-theorems that it was, but I can't find anything. There is a similar problem which is known to ...
I have read Chater 17. Balanced Allocations and Cuckoo Hashing in Mitzenmacher. Upfal. Probability and Computing: Randomization and Probabilistic Techniques in Algorithms and Data Analysis and got stuck with a problem. We have $m$ elements and $n$ buckets. Each element is hashed into two random buckets (we assume that ...
There is D-dimensional array A. The number D and the size Sd of every dimension d=1..D is input from keyboard. There is also 1-dimensional array E of size N. It consists of unique integer numbers 0..N-1. N is also input from keyboard. First we need to fill A with elements of E so that every element is presented at leas...
I have an exercise: We are given a finite deterministic automaton. It has 5 states and is based on the alphabet $\{a, b, c\}$. It can accept $n$ different words, $n <\infty$. What maximum value can $n$ be? W have 5 states so it should be something like this: $\varepsilon \ | \ (a|b|c) \ | \ (a|b|c)(a|b|c) \ | \ (a|b|c)...
I am studying CSP problems in artificial intelligence. I don't understand the MAC-3 algorithm especially line number 10. Could you tell me with step by step? 1. Function AC-3MAC(Q,CV) 1.1 Q ← {(V i ,V cv ) in arcs(G),i>cv} % start with arcs going to cv cv means current variable 2. Begin 3. consistent := tru...
There exist various Turing-equivalent models of computation, such as lambda calculus, Turing machines, or register machines. It seems that dependent type systems (like Coq, Agda, Idris, homotopy type theory) all have a lambda-calculus-based model of computation at their core. That's because they use term substitution (...
Use the DFS and BFS algorithms to solve the Towers of Hanoi problem. Which performs better and why? Towers of Hanoi Towers of Hanoi visualization When I think of the Towers of Hanoi problem, I think of moving the three disks in a LIFO order. The last disk you place on a rod must be the first one to move off the rod. ...
from my understanding the truth table is supposed to generate every possible combination of true and false values without the order of the combination taking into account. however one of my teachers said that their is a particular order to each row that is used to generate multiple combinations. can you please explain...
This is a possible duplicate of the following (but not sure it answered my question): Is it possible to support .(any symbol) or \d, \w, \W in DFA My professor is asking for a finite automata state diagram for some language that accepts even length strings (actually it's more complicated than that, but I'm starting wit...
first of all I'm sorry for my bad English and second I'm sorry for my mistakes of understanding the following topic, I still going to school and learning this for interest. The topic is Myhill-Nerode and the equivalence classes of a regular or non regular language. I know that every element of a equivalence class by My...
Lamport's distributed mutual exclusion algorithm (also described here) solves mutual exclusion problem for $N$ processes with $3(N-1)$ messages per request ("take and release lock" cycle). It requires that for each pair of processes $P$ and $Q$ all messages send by $P$ to $Q$ are received and processed by $Q$ in the sa...
Given a set of numbers $D$ and some number $k$ I want to find all numbers that are in $D$ such that the distance between $k$ and any found number is less or equal to integer $n$? Example: suppose we have $D=\{5,9,0,6,7\}$ and $k=8$ and $n=1$ then the result should be $\{9,7\}$. I was thinking to use a k-d tree or VP tr...
Suppose that L0, L1, L2 are languages over the same alphabet and that L0 ⊆ L1 ⊆ L2. Is it true that if L0 and L2 are regular, then L1 must be regular as well? By regular = the set of words accepted by a finite automaton. Suppose L0 = { $a^{\textrm{n}}$ | n = 2} L2 = { $a^{\textrm{n}}$ | n => 0} how can i find a se...
I have the set: B = {x ∈ {0,1}* | there is an equal number of 0's and 1's in x} and therefore, B* = {e,01,10,0011,0101,0110,1100,1010,1001,....etc} I need to either prove or disprove that B*=B I believe they are equal, because B* is just the concatenation of one string onto another. I think the trick is since the 0's a...
I have a problem where given an infinite binary sequence S ∈ {0, 1}∞ to be "prefix-repetitive" if there are infinitely many strings w ∈ {0, 1}* such that ww is a prefix of S. I need to prove that if the bits of a sequence S ∈ {0, 1}∞ are chosen by independent tosses of a fair coin, then Prob[S is prefix-repetitive] = ...
I don't understand why O notation is the worst case. If this notations describes a function f such that 0 <= f(n) <= cg(n), we can see that in any case f will be smaller that the original function g that describes the running time. In my idea, f(n) describes a better option because the running time is less for any inpu...
I understand how the recurrence relation of quicksort is $T(n) = 2T(n/2)+\mathcal{O}(n)$, but if we are guaranteed a certain pivot, for example $n/4$th smallest element to be the pivot every time, how would it affect the recurrence relation? I would love some insight on how to approach analyzing such performance.
If a given heap has $k$ inversions, what is the complexity of making it into a valid min heap? We could define an inversion as a tuple (node, descendant), where the node has a key value strictly higher than its descendant (all nodes have distinct key values). This isn't an interview question, but is something that I th...
I am having a hard time understanding homomorphism. All I seem to understand is that it is a substitution. When I look at examples of proving closure of a particular operation over a regular language, I don't understand how people come up with the substitution strings that they choose, and how they use them to produce ...
I have used programming languages which generate a random number in a given range. Let's say we have a range of 1 to 10 each number has the probability of 1/10 to get selected. What is the criteria on the basis of which a random number is selected with uniform probability by a programming language.
I'm an entire outsider to computer science eventhough I've been programming for so many years. As we know, modern audio-visual media codecs are essentially entropy codings of subjective preceptual information. Well known codecs such as AVC, HEVC, AAC, AC3 are highly efficient at compressing AV data. So I wonder, what...
For the problem of a subsequence of maximum product with negative, zero and positive integers, I have the following working solution (inspiration from here). Let us first show how to solve the problem when the array contains no zeroes: If there is a single entry, return the entry. If the number of negative entries is ...
If a hash table is using open addressing as the collision resolution strategy, then during deletion, we mark that slot as dummy. I understand the reason behind that is because while probing, a dummy would indicate there are still used slots further down the chain to search for. But my question is that is there any way...
Is there any possible general algorithm for constructing a DFA such that it accepts any string, which has a given sub-string in the suffix(end) for any given language. The algorithm should directly construct the DFA transitions, and not create an NFA first and then convert it to a DFA. In other words, the algorithm acc...
Typically, add/subtract/multiply/divide are primitive operations in an Instruction Set Architecture (ISA). I am interested to know if they can instead be implemented efficiently using only bitshift operators. I'm interested to know what sequence of bitshift operations can reproduce the addition operation.
I want to ask that between turing machine and pushdown automaton: which abstract machine can handle context-free language (CFL) in a more efficient way, and why? I know that a pushdown automaton can use exactly one step per input symbol, which is a tight lower bound on efficiency. (If we’re measuring in number of steps...
So you can have One Instruction Set Computers. But typically these instructions have rather complicated underlying implementations. addition (addleq, add and branch if less than or equal to zero) decrement (DJN, decrement and branch (jump) if nonzero) increment (P1eq, plus 1 and branch if equal to another value) subtr...
Background I'm looking at Transport Triggered Architectures (also this), linked to from an OISC page listing many different 1-Instruction Set Computers. It basically says the following: TTA programs do not define the operations, but only the data transports needed to write and read the operand values. Operation itself...
I want to generate pseudo-random hashes of inputs in a way that is optimally time and space efficient. I'm not at all concerned about security. The output should be evenly distributed and appear random in relation to the input, but it doesn't matter if it's possible - even trivially possible - to determine the input t...
A(B ∩ C) = { UV | U ∈ A, V ∈ B and V ∈ C } for the left part. ΑΒ = { UV | U ∈ A, V ∈ B }, ΑC = { UV | U ∈ A, V ∈ c }, AB ∩ AC = { UV | U ∈ AB and AC, V ∈ AB and AC } for the right part. How can I continue further into the proof?
At work I stumbled across this problem of allocating resources: We are given a set of objects belonging to one of seven possible classes (multiple objects per class are allowed). We distinguish between classes A, B, ... G, because they have 3 possible attributes (weight, interest, size). We also have four boxes X, Y, W...
I'm learning about monads, I understood why they are useful, I understood in general what bind, join, return do. I also looked at basic usage examples for the basic reader / writer / state / list / maybe monads. Still, being a beginner, I still don't feel I have a grip on what the "run" function means in general. It do...
We can compute the binary representation of $n$ and similarly by decrementing the value of $n$ by $1$ each time we can get all values from $2$ to $n$. We can now use a Turing Machine that multiplies binary numbers to get the value of $n$. But will this computation be bounded by $O(n)$? That is, can $n!$ be a time const...
In "Computational Complexity" textbook by C. H. Papadimitriou, p. 141, he proved the following claim. Proposition 7.1: Let there be a DTM/NDTM M that decides a language L within time/space $f(n)$, where $f$ is a proper function. Then there is a precise TM $M'$ that decides L in time/space $O(f(n))$. Proof. We start s...