instruction
stringlengths
35
29.1k
Let $B$ and $C$ be collections of finite sets. We say that $B$ is a normal basis of $C$ if for all $c\in C$ there is a pairwise disjoint subcollection of $B$ whose union is exactly $c$. The input of the normal set basis problem is a collection $C$ of finite sets and an integer $k\geq 1$, and we need to decide whether $...
As far as I know, the K coloring problem is NP-complete. However, I'm a bit confused about how to determine whether a problem is weakly or strongly NP-complete. If an NP-complete problem is decidable by a pseudo-polynomial time algorithm, it is called weakly NP-complete. If an NP-complete problem's unary version is NP...
What data structure would be optimal in terms of time and space for the following usecase: Given information about rectangles in the form of- {rectangle_id,left_bottom_corner_x, left_bottom_corner_y, right_top_corner_x, right_top_corner_y}. I need to use a structure which will answer the following queries: 1...
When a CPU needs to get more instructions from storage and copies them to RAM, how does the CPU jump to previous instructions that are no longer in the RAM? Would it have to copy the old instructions back into RAM? I feel like that would take a very long time to do. FOR EXAMPLE: this is storage xsxx xxax. Pretend the "...
I'm new to recurrence relations and master theorem so trying to learn. Say there's an algorithm $A$ whose input is the root of a binary tree $T$. $A$ recurses so that it's called on each and every node in $T$ exactly once. The time complexity of $A$ called on a node $X$ is $O(number\:of\:nodes\:in\:subtree\: rooted\:at...
Motivation. This is a variant of the subset sum problem involving the bitwise ${\tt XOR}$ operation. Problem. Given a set $X$ of $n$ bit-strings of length $n$, determine if there is a non-empty subset $S\subseteq X$ such that the the bitwise ${\tt XOR}$ of the members of $S$ is $0$ everywhere. For example, et $n = 4$ a...
I struggle to understand a step in the following solution to a RISC-V exercise. Exercise: a pipelined RISC-V processor with no data forwarding paths executes the following program. For each instruction and clock cycle, determine the stage of the processor involved. Solution: What I expected: What I fail to grasp is...
Here is my algorithm with inputs $a$, which is an integer and $n$, which is an odd natural. Is $\mathcal{O}(n)$ the time complexity of this algorithm? My thoughts: The if-cases in the lines $1$ up to $20$ and $32$ up to $37$ are checked in $\mathcal{O}(1)$. In lines $21$ and $22$, the symbol is reduced. My guess it t...
The decision version of the problem Integar Linear Programming is the following: Input: two matrices $A\in \mathcal{M}_n(\mathbb{Z})$ and $B\in \mathcal{M}_{n,1}(\mathbb{Z})$. Question: is there a matrix $X\in \mathcal{M}_{n,1}(\mathbb{Z})$ such that $AX\leqslant B$? (the inequality being component by component). Thi...
As we know, if we want to make a $LR(0)$ (say) parsing table for a context free grammar (CFG), we prepare the $LR(0)$ itemsets with $.$ (dot) in RHS of the CFG production. With this $.$ we keep track of characters that compiler has seen yet, and continue to make states of these itemsets, which ultimately make a determ...
Given an undirected graph, two vertices $s$ and $t$, and two integers $k$,$l$ - what is the complexity of finding $\ell$ edge-disjoint $s$-$t$-paths such that at least $k$ of them are pairwise internally disjoint? Being internally disjoint means that the paths are vertex disjoint except for $s$ and $t$. I know that dec...
I recently had an interview to identify all of the hazards in the following instruction set. I was told by the interviewer that there was some hazard between instructions i3 and i4 and it's not a RAW hazard on R4 so I'm a little lost. Any insight? Thanks! 1: ADD R1, R2, R3 2: ADD R4, R5, R1 3: LOAD R4, R3(src addr) 4: ...
Recently, when I self-learnt Discrete Mathematics and Its Applications 8th by Kenneth Rosen, I had some questions about some statements in it. Fur- thermore, if a polynomial worst-case time complexity algorithm were discovered for the traveling salesperson problem, many other difficult problems would also be solvable ...
In the wikipedia page for the NP-intermediate complexity class, the following observation is made: Under the assumption that P ≠ NP, Ladner explicitly constructs a problem in NPI, although this problem is artificial and otherwise uninteresting. It is an open question whether any "natural" problem has the same property...
Assume that a matrix $M\in [0;1]^{n\times d}$ is given, i.e., all values in the matrix are in the range 0 to 1. I would like to compute the following function for all rows of $M$: $$ f(m_1,m_2,...,m_d)=\frac{1}{n}\sum_{i=1}^{n} \begin{cases}1 \quad \text {if} \quad M[i,j] \le m_j \text{for all} j\\ 0\quad \text{else} \...
(Given a graph $G$ with $|V|=n,|E|=m, max(c(a,b))=C$ and with integer capacities) Dinic's algorithm with scaling is defined the following way: set $\Delta = C$; run Dinic's algorithm, only allowing augmenting $\geq\Delta$ at a time (at any point, if edge we're looking at in the created DAG is $<\Delta$, delete it). if...
I have to find 2 efficient ways to sort 1000 exams according to the students' last names and give the complexity. The task has to be divided between m teachers. I think one efficient way is to give each teacher a range of letters, for example one teacher has to sort the exams with the last names from A to D, the other ...
In a 2 by n grid there is a character in each cell. A path can start at any cell and then you can move to right or down. This way each path will denote a string written by characters on cells visited in visiting order. I wanna try finding efficient methods for pattern searching queries (number of paths resulting a stri...
I'm curious about how much complexity is introduced to an algorithm while it's being debugged. Is there a general theory for optimal debugging algorithms and theoretically optimal debugging performance? The curiosity is a consequence of the following question: If I mean debugging to be the process of making information...
I found an algorithm for determining if a binary tree is height-balanced. It Gets the height of left and right subtrees using dfs traversal. Return true if the difference between heights is not more than 1 and left and right subtrees are balanced, otherwise return false. algorithm code: /* CPP program to check if a tre...
I'm looking for a data structure that would allow storing samples (in O(1)) from a data stream in a fixed-size buffer while the stream length isn't known in advance. Once the buffer size is exhausted it should start overwriting previous elements in a staggered manner, retroactively reducing the sampling rate of the dat...
I am using the GraphBLAS C API (https://graphblas.org/) which provides an interface for performing mathematical operations on sparse matrices. Given an adjacency matrix $\mathbf{A}: \mathbb{R}^{n \times n}$, I would like to remove duplicate rows from the matrix. Instead of implementing this in the standard $\mathcal{O}...
Suppose I want to introduce a new family of types $B(a)$, where $a:A$ into a type theory using inference rules. First of all, my understanding is that $B:A\to U$, where $U$ is some universe. So my first question is: should I necessarily introduce the universe $U$ before introducing the family $B(a)$? And secondly, assu...
I was wondering if a variation of the bin packing problem where the 'size' of a bin is calculated as the product of item sizes in a bin instead of their sum is NP-hard. It seems like it must be, but I don't know how to prove it. More formally, the problem is as follows: Given a list of positive integer item sizes $a_1,...
At first I thought it is obvious, since the NOP instruction does not have any operand, we say it is zero-operand instruction. But then looking on the zero-operand instruction, But looking after the definition I am confused to classify the instruction into $n$-operand category, where $n \in \{0, 1, 2, 3\}$ ref These in...
I have researched multiple solutions to the convex hull problem, but I am afraid I don't really understand some of them. For example, Graham's scan is a bit confusing as it is not very clear if the n given points are sorted at the start of the algorithm or not. And if they are, how and why? I guess I don't really know ...
There is an exercise in a book about finite automata that I couldn't solve: Prove that if $L \subseteq b^*$ isn't regular then $M = a^+L \cup b^*$ isn't regular either, using the fact that REG is closed under inverse morphism (paraphrase). I think one obvious approach would be to find a Language $L'$ and morhpism $\var...
What method(s) could be used to solve this? I am still new to this stuff and would appreciate detailed justification for every step as well as some intuition and the examination of all possible viable methods to go about this, not just one. Thanks.
Assume that we are given a formula in 3-CNF such that at least 1% of the complete assignments satisfy it. My question is how to find a satisfying assignment in polynomial time without the use of randomness? Prove the correctness and the upper bound on the running time for the algorithm that you suggest.
I'm trying to solve an exercise from "Algorithmics for hard problems" but I have no idea how to solve it. First the definition of one-sided-error Monte Carlo algorithm is a little different than usual. We say A is a one-sided error monte carlo algorithm recognizing L if for every $x \in L, Prob(A(x)=1) \geq1/2$ for ev...
On the proof assistants StackExchange site, someone gave this example of a dependent product: $$\prod_{i\in I}\sum_{j\in J_i}x_{ij}=\sum_{f\in\prod_iJ_i}\prod_{i\in I}x_{if(i)}$$ The dependent product is the $\prod_iJ_i$ bit, and just what role it plays in this case is mysterious to me. It's a very short answer, and th...
That's what I'm formally asking: Let the algorithm $A$ have the worst-case time complexity $\Theta(f(n))$, such that for any algorithm $B$ with the worst-case time complexity $\Theta(g(n))$ doing the same job as $A$, $g(n) \in \Omega(f(n))$. Let $\Theta(s(n))$ be the worst-case space complexity for the algorithm $A$, s...
I am looking for an unranking (and ranking) algorithm for permtuations that is consistent with the order that Heap's Algorithm generates permutations. I have been researching a bit on ranking and unranking of permutation algorithms. A ranking function for the permutations on n symbols assigns a unique integer in the ra...
In my university class, I received this homework assignment on computer architecture, but I don't know how to solve it. I already know that the correct answer is 0, but I don't understand why. Could someone help me? Problem: The byte-addressable memory has a 16-bit address. The directly addressed cache has 7-bit tags a...
People I know said that converting a Regex to DFA is just a "matter of judgement" (I do not believe them, there has to be a more systematic approach). Is there a simple/intuitive, yet concise way to convert a Regex like this a*b+a(b+a|aa+b)*ab(a?|bb?a)+ into a DFA?
Neither could I find any counterexamples, nor could I show that if indeed the complement of NP-hard problems was NP-hard, one could deduce some unknown results from it, which would imply that it is indeed probably unknown. If someone knows the answer or a paper where this question is discussed or any other reason why t...
Given an undirected graph, two vertices $s$ and $t$, and two integers $k$ and $r$, then a $k$-set of internally disjoint $s$-$t$-paths is defined to be a set of exactly $k$ $s$-$t$-paths that share no vertex except for $s$ and $t$. What is the complexity of deciding whether there are $r$ pairwise edge-disjoint $k$-sets...
Suppose you have a Knapsack (optimisation) problem with integer values and weights, and you know the optimal value $OPT$. Can you compute an optimal solution in polynomial time by using a PTAS or FPTAS and setting $\epsilon < 1/OPT$, since this would mean it computes a solution in polynomial time which is of value $\ge...
A is an array of size n of different numbers (not necessarily integers). Indexes start from $1$ to $n$. S is an array with the property: $$S[i] = |\left\{A[j] \ : 1\le j<i \ \text{and} \ A[j] \le A[i]\right\}| $$ For example, for $A=[2,7, 4,5,15,9,12]$ , $S=[0,1,1,2,4,4,5]$. I want to sort $A$ with time complexity...
The 2-coloring problem is in P. How can I prove that it is in NL or L? I see that I should create a deterministic/nondeterministic algorithm with logarithmic space, but I have no idea how to store the coloring in logarithmic space.
I have a 12-dimensional state-space and would like to use a kd-tree to partition my data, so that nearest neighbour operations can be performed quickly. Unfortunately I have the issue that three of the states are angular values which wrap-around (360 degrees and 0 degrees are the same), which will mislead the nearest n...
Suppose we've to pick $K (\le N)$ random integers in the range $[0, N - 1]$ for very large $N$ such that there is no repetition, while also deterministically minimizing the number of calls made to the $rand()$ function. How would we do it? Assume $rand(X)$ produces a random integer in the range $[0,X - 1]$; calling it ...
I know what P-hard means. Let's denote the P-hard problem as H. For any problem A in P, there exists a polynomial-time reduction from A to H. I think the answer is yes (I suppose that every "easy" problem can be reduced to a "harder" problem (in this case problems in P to an NP-complete problem), but I am not sure.
I`m currently doing my homework that solving TSP using DP algorithm or branch and bound algorithm or backtracking algorithm only to solve up to 40 vertices and I can solve up to 30 vertices when I try 35, it get bad_alloc at memory location 0x00000059F29EEB30. I try to figure out the algorithm but it doesn't get any be...
If yes, could you say an example? P=NP would result in NP problems being solvable in polynomial time, but there would still be problems in the EXPTIME class.
Imagine two vectors $V=[v_1, v_2, \ldots, v_n]$, $S=[s_1, s_2, \ldots, s_n]$ where $S$ is a rearrangement of $V$ based on some relation $\leq$. Imagine that, instead of computing $S$ using as input $V$ and $\leq$, and want to returns an index map $Idx$. There are two possibilities, where: $Idx[i] = j$ means that $v_i$...
I am practicing paging in virtual memory and came across a question with the following details 44-bit address space 16KB page size 16 Bytes Page table entry (PTE) If I understand paging correctly then there would be 2^30 pages, and the page table size if 2^44 bytes My questions is, do I use a single-level page table ...
If I start with $n$ different points $P_1,\ldots,P_n \in \mathbb{R}^2$ and want to select a set $X$ of cardinality $m \leqslant n$ from them subject to the condition that the value $$d_\text{min}(X) = \min_{P, Q \in X, P \neq Q} d_\text{eucl}(P,Q)$$ is maximized by my choice of $X$, then I understand, that this an inst...
Given an array of size $n$ that has the item of the heap. To remove an arbitrary element from the heap we would need $O(n)$ to find the element and then $O(logn)$ to reheapify if I am commrect, which means total time complexity is $O(n + logn)=O(n)$. In study notes, I saw it's written $O(nlogn)$, which does not make se...
For an NFA with language: {w ∈ {0, 1}*: the length of w is odd but not a multiple of three}. How many states are required? This is the work I have come up with so far: q0: non-accepting state - because of even length q1: accepting state - because odd length and not multiple of 3 q2: non-accepting state - because even l...
We are given an undirected graph $G(V, E)$, and let $n = |V|$. The task is to find a bijective function $\psi: V \rightarrow \lbrace{1, 2, \dotsc, n \rbrace}$ such that the following objective is minimized: $\sum_{(u, v) \in E} \max(\psi(u), \psi(v))$. I am interested in the complexity of this problem. Note that this p...
The Bucheim-Walker algorithm is used for drawing trees. However, there are many real-world examples where Directed Cyclic Graphs would benefit from such an algorithm (e.g. family trees with intermarriage or incestual relationships, dependency graphs, etc.). Can the algorithm be modified to support DCGs? If so, how? Spe...
Consider a graph $G$ with $N$ nodes, with the distance of each node initially set to infinity (there is no start node). If there are no negative cycles in the graph, then after $N - 1$ iterations of Bellman-Ford, any additional iterations will not modify the distances (the distances are stable). On the other hand, if t...
I am trying to find complexity for following algorithm. It is from "The Algorithm Design Manual" book. for k = 1 to n: x = k while (x < n): print ’*’ x = 2x I simulated algorithm for some values. Each time inner loop operates on n-k value. k=1 x=1 x=2 x=4 x=8 ... k=2 x=2 x=4 x...
Given an array with the size of $n$ of integer numbers. Our goal will be to analyze the expected running time of an algorithm that uses a hash table to find (if exists) a pair $(a,b)$ subject to $2<|a-b|<5$. The answer is $O(n)$ but I have no idea to convince myself. Some thoughts that come to my mind are as follows: c...
Solving $N$-player general sum matrix games is known to be PPAD-complete, and even for two players algorithms such as Lemke-Howson can take exponential time in the worst case. On the other hand, verifying that a solution is indeed a Nash equilibrium can be done in polynomial time. Are there standard examples/benchmarks...
In an answer to this question: For instance, modern Intel TLBs have a process context ID (PCID); each TLB entry is tagged with the PCID of the process that the page mapping is for, and the processor will only use that TLB entry if its PCID matches the ID of the currently running process. The processor fills the PCID w...
I am trying to find the Big O notation of this code below, really its the big theta, but whatever I believe its the same in this case. for (i=2; i < n^2; i++){ for (j=3; j < 4i^3; j = 2*j){ x = i+n } } One, I believe that the constant in 4i^3 can be dropped. And so, the inner loop is maybe, O(i^3) => (2^k)...
Given a set $S$ of N-element sets, I want to generate all (N+1)-element sets (call this set $T$) such that for each element of $T$ each N-element subset is in $S$. My current naive algorithm performs quite badly. Set $S$ ~ 100-10000 elements and $N$ ~ 5 or so. More concretely (although perhaps more confusingly). Let $N...
Context: I was reading a research paper related to polyhedral representation(citation given in last). Got confused while trying to understand the notation by implementing them with example code. Paper Citation: Bastoul, Cédric & Cohen, Albert & Girbal, Sylvain & Sharma, Saurabh & Temam, Olivier. (2003). Putting Polyhe...
Lets say I have a SAT problem with variables $x_1,...,x_n$. For a given subset of the variables I want to create a clause which forces an even number of the variables in $S$ to be true. Of course there is the brute force solution, but I would like a more efficient solution with as few clauses/variables as possible.
I suppose that this statement is true if NP equals with coNP, otherwise not, but I don't know how can I prove that.
I know the double tree algorithm and Christofides algorithm with 1.5 approximation ratio. We got this question from the teacher.
One version of the minimum sum vertex cover [1] is the following problem: We are given an undirected graph $G(V, E)$, and let $n = |V|$. The task is to find a bijective function $\psi: V \rightarrow \lbrace{1, 2, \dotsc, n \rbrace}$ such that the following objective is minimized: $\sum_{(u, v) \in E} \min(\psi(u), \psi...
Suppose a generalized version of k-SAT where the usual clauses (disjunctions of literals) are generalized to arbitrary Boolean functions of k variables. (For example, $(x \oplus (y \land z)), ((x \land z) \lor (y \land z))$ and $(x \implies z)$ could be generalized clauses for k = 3.)(Just a note: there are $2^{2^k}$ B...
I know that when I compile a program and then I inspect with objdump, I have addresses. These are relative addresses. But if it's a C program and I printf with %p a pointer, that is a virtual/logical address. Who generates this? Is that the loader? If yes, why do I need that a loader does this? Isn't it sufficient a re...
I know that exists problems that surely cannot be decided in polynomial time because P class doesn't equal with EXPTIME (for example Go, generalized chess etc.). But I assume that there may be problems for which we currently only have an algorithm with exponential time complexity and yet can be solved in polynomial tim...
I have proved that $\overline{A}\le\overline{B}$ is true, but I have no idea how to prove or disprove the opposite direction.
Proove or Disproove $ \exists L_1 , L_2 \in RE \setminus R $ such that $ L_1 \cup L_2 \in R $ and $ L_1 \cap L_2 \in R $ I tried to use the languages the union is $ \sigma^* $ and the intersection is empty language but I am really not sure if that really answer the question
proof or disproof if $ L_1 \subseteq L_2 $ then $ L_1 \leq L_2 $ I tried to think with HP and the empty language because HP is in RE and the empty language is in R but how do I prove this does not always happen? I don't understand whats the formal way to write it down
Is $L =$ { $\langle M \rangle$ | $M$ moves left on at least one input } decidable? What would the proof look like? Intuitively, I would say it's undecidable: We cannot predict if a given TM ever reaches an accepting transition on a specific input, let alone predicting if it would reach some transition $\delta(q,a) = (...
I am very interested in the following questions, which sprang out from the topological study of loops in surfaces and their intersection numbers. Consider, over a finite set of boolean variables $X$, a Boolean formula in CNF (conjunctive normal form) whose clauses only contain non-negated literals. Assume the following...
Problem Description I have two sets of 2D points with flavours: Noisy points $$p_i = (x_i, y_i, f_i) : p_i \in N : |N|\approx 10^8 $$ and true points $$p_{t_i} = (x_{t_i}, y_{t_i}, f_{t_i}) : p_{t_i} \in T : 10^6 \lt |T| \lt 10^7.$$ Each noisy point $p_i$ has been generated by adding errors $p_{e_i} = (x_{e_i}, y_{e_i...
There is a directed acyclic graph with M edges. There is only one component (If they were undirected edges all nodes will be reachable will from one to another). An edge from a to b means value of node a is strictly greater than value of node b. What is the total number of combinations of assigning natural numbers as n...
For cases where recursion is used as well as memoization (so that a number of subtrees of what would otherwise be the overall recursive call tree are each replaced to be O(1)), I am wondering what the resulting runtime is (such as whether it is the same as the corresponding dynamic programming approach), or really, how...
Proof or Disproof if $ L $ is a Regular language then it has to be that $ L\leq HP $ $ HP=\{<M,x> | M \ halts \ on \ x \} $ Regular language is a language that can be expressed with a regular expression or a deterministic or non-deterministic finite automata I know that HP is in RE\R and I know the regular language...
I considered the Euler circle problem to decide this. The polynomial reduction is: I add a new vertex in the graph: If the degree of each vertex is even, then I connect all the vertices with this new vertex Otherwise, I only connect the vertices with an odd number of degrees to the new vertex Is this a correct reducti...
$L_1$ = {$a^nb^mc^xd^y$|$n=m$ or $x=y$} $L_2$ = {$a^nb^xc^md^y$|$n=m$ or $x=y$} For $L_1$: Push a's Now pop the same number of b's , Given n=m If Stack is empty and x=y=0 accept the Langauge else push c's and pop d's If Stack is empty accept the Langauge It's DCFL and also CFL. For the $L_2$: It's Not CFL. But the an...
In stack languages (e.g. PostScript, Forth), return values are passed on the stack - zero, one, even a variable number. Python supports tuples of values there, frequently used "without tuple syntax", but creating a tuple regardless (garbage if not kept but unpacked immediately). Is there any non-stack language handling...
The SAT is in NP, I suppose that the complement of the halting problem is in coNP-hard. I suppose the answer is no because SAT is not in coNP, but I am not sure.
I am trying to implement a BTree. As far as I understand the lower the height of the Tree the faster the search (This could be wrong, please correct me if it is). Is pre-emptive split with non-pre-emptive merge the best or non-pre-emptive split with pre-emptive merge or the other 2 combinations left? Which offers bette...
I consider a deterministic pushdown automaton. Given that there are some differences between definitions, here is mine: the syntax is given $A = (Q, \Sigma, \Gamma, \Delta, q_0, Z_0, F)$, with $q_0\in Q$ is the initial state, $Z_0\in \Gamma$ is the starting stack symbol, $F\subseteq Q$ is the set of final states, and ...
I attempted to create a language $L_1$ = {$<M>| L(M) = 1^*$} and prove using a reduction that $L_1$ ∌ RE and $L_1$ ∌ CoRE by showing that $HP ≤ L_1$ and $\overline{HP}$ $≤ L_1$. But my instructor said this isn't correct.
let L be defined as $L = \{0^{2k} | k \in \mathbb{N}\} \subset \{0,1\}^*$. language L can be described by a nondeterministic pushdown automaton P such that there exists at least one input for which P accepts the input by falling into an infinite loop is this statement true or false? if it's true, then why? here is wh...
It is a very straightforward question. I know that the following holds, and I know why it holds: $DTIME(f(n)) \subset DSPACE(f(n))$ However, is there a language $L \in DSPACE(1) \setminus DTIME(1)$? The "1" is supposed to represent a constant complexity. It seems to me there is not such language but I don't know how to...
I learned the amortized analysis of Prof Demaine's 6.006 videos. The Erik's thesis was, If we reallocate memory by doubling capacity => $$1 +2+4 + 8 + 16 +..+n = \theta(2^{lgn}) = \theta(n)$$ From Amortized analysis, we can say that after an operation we get linear complexity so the overall complexity of inserting is c...
My question is about LeetCode "137.Single Number II": 137.Single Number II Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. You must implement a solution with a linear runtime complexity and use only constant extra sp...
In the book A Science of Concurrent Programs Leslie Lamport describes alternative way how to look at safety and liveness properties in distributed algorithms. A.5 Another Way to Look at Safety and Liveness This section provides a different view of safety and liveness based on viewing behavior predicates as sets of beh...
I was referring to the textbook Artificial Intelligence: A modern approach 3rd by Stuart Russell and Peter Norvig. what to prove about the general "graph search": (Here I assume "within a factor of b" means multiplier $b$ instead of addition $\pm b$ based on the complexity context. So if time complexity is $O(b^d)$, th...
Let $G = (V, E)$ be a flow network with a source $s$ and sink $t$. However, the constraints are a bit different: Conservation constraint is as usual. For each edge $e \in E$, we have that the flow $f$ maintains that $f(e) \geq c(e)$ when $c(e)$ is the capacity of $e$. The question asks to write an algorithm that finds ...
Let $\alpha \in (0, 1),\space l \geq 2$ and $T: \mathbb{N}\rightarrow\mathbb{R}^+$ such that, $T(n) = \begin{cases} n^l + T(\alpha n) + T((1-\alpha)n) & : n > 1 \\1 : n=1 \end{cases}$ Bound $T$ asymptotically tight. So I understand that I need to split into cases, the first one is where $\alpha < \frac{1}{2}$ and ...
Prove that there isn't a complete language over a given alphabet $\Sigma$. That is, there is no $C \subseteq \Sigma^*$ such that every $L \subseteq \Sigma^*$ is Turing-reducible to $C$. Attempt: Let $L$ be a language and let $\overline{L}$ be its complement. And let's say there is a reduction between $L$ and $\overline...
I have a bunch of values, some that are given by an end user input and some that are calculated based on that input. The way that the values are calculated are input by a different group of users of the software. My goal is to give the second group of users feedback that their input can always be solved. Now to the act...
I'm new to the complexity theory and have a basic question about the big-O notation that I encountered. I came across a complexity of $O\big(\frac{n}{m-n}\big)$, where both $n$ and $m$ are independent variables in my algorithm (assuming $m \geq n$). Since I haven't encountered the subtraction of two variables in the de...
Are languages generated from a statically typed language statically typed? So say, generating Python from C++. to generate a language from another language: You write a transpiler in a static language $L_s$ so that it can produce the equivalent program in language $L_{sORd}$. Issues: The statically typed language mus...
Pattern matching in programming languages as for example in Racket is some kind of parsing. Which level in the Chomsky hierarchy does this parsing technique have? Is it type-3 like regular expressions or type-2 or even lower?
I'm seeking information about a specific sorting algorithm. This algorithm performs pairwise comparisons and distinguishes between three states: a > b: In this case, standard sorting logic proceeds (b precedes a). a < b: As usual, a precedes b. a = b: when elements are considered equal, both a and b are "fused" through...
Suppose we have an approximation algorithm to some maximization problem, that returns a solution with value $(1-\epsilon)*OPT$. If the runtime of the algorithm is polynomial in the input size and $1/\epsilon$, then it is called an FPTAS. If the runtime is polynomial in the input size and $\log(1/\epsilon)$, then the a...
The hierarchy $$\text{regular languages $\subset$ deterministic context-free languages $\subset$ context-free languages $\subset$ context-sensitive languages $\subset$ recursively enumerable languages}$$ has an 'extra level' with respect to the Chomsky Hierarchy. Why is the Chomsky hierarchy taught, as opposed to s...
The first example of a (nondeterministic) pushdown automata given in Linz' An Introduction to Formal Languages and Automata is the following: Example 7.2: consider $Q = \{q_0,q_1,q_2,q_3\}$, $\Sigma = \{a,b\}$, $\Gamma = \{0,1\}$, $z = 0$, $F = \{q_3\}$, with $q_0$ the initial state and $\delta (q_0,a,0) = \{(q_1,10...