instruction
stringlengths
35
29.1k
thanks for your help. This is my first question, so I am very sorry for the bad presentation of the question. I am studying computer science and this is the question I have been asked for the course of Theory of computation and complexity Edited question 1.For every two languages $A,B∈PSPACE$, there is a language $C∈PS...
I've invented an abstract structure to represent a comparison-based sorting algorithm, which I will call a comparison tree (similar to the decision tree of a comparative sorting algorithm). Specifically, a comparison tree is a full binary tree rooted at $s$ where each non-leaf node is labeled with an ordered pair $(x,...
For the algorithm provided in answer to this question, how would I go about proving the correctness of the algorithm? The referenced question is: “You are given an array $A$ of length $n$. Each value is $1$. However, you do not know what the value of $n$ is. You are allowed to access an element $i$ of the array by call...
I have two groups (GROUP1 and GROUP2) of undirected weighted graphs - one having properties more similar to small world network and other relatively random. These are represented as adjacency matrices with 32 nodes and weights 0 to 1 representing connectivity strength among nodes. I am taking help of small world networ...
Please tell me what is the correct formula for calculating the cost of an algorithm? I used this: number of calculated functions + 4 * number of calculated function gradients + 8 * number of calculated Hessian matrices of the function. I use this formula to calculate the cost of Newton's method of finding the minimum o...
There are $n$ sticks of lengths $1$ to $n$ in a row. Upon permuting them randomly, we may calculate the average number of peaks viewed from left. A peak is a stick such that all sticks to its left are shorter than it. For example, suppose there are $3$ sticks. The permutations and numbers of peaks are: 123 3 132 2 213 ...
Our problem is similar to this, but it details various approaches we can make. The problem also was formulated operation research, but got hit with numeric limitations. Here we seeking to find reference algorithms per each complexity added, its pratical limitations (limited numbers N, formulas for constant C factors to...
A process can receive two kinds of signals classified based on the source and reason. Synchronous are the one that are generated by illegal memory access or division by zero. Asynchronous are the one that are generated by another process like SIGKILL and etc. Quoting from the 9e OSC Book by Prof. Galvin, topic Signal...
Mitchell specifies a set data type: ie, an algebraic specification for set. He then asks to prove that the equation union s s' = union s' s [s, s': set] does not hold in the initial algebra. He suggests that we use the following result: two terms are provably equal iff they reduce to a common term. Here are the relevan...
I'm wondering where (how? why?) my reasoning (by imagining the recursion tree) deviates from the application of the Master Theorem (Case 1) to this recurrence. The Master Theorem gives $\Theta(n^{\log_{5}4})$, whereas reasoning from the recursion tree gives me $\Omega({\log n})$ and $O(\log^{2}n)$. My rationale: Each ...
$ Fin = \{ L \in \Sigma^* : |L| $ is finite and greater than 0 $ \} $ Proof or disproof Fin = Fin-Complete Where Fin-Complete means that for every $ L_1,L_2 \in Fin $ there exist a valid reduction $ L_1 \leq L_2 $ my trial: Consider two languages $ L_1 $ and $ L_2 $ where $ L_1 $ contains a single string s $ L_1 = \{ ...
How can I estimate the probability that the sum $S_n$ of $n$ uniform random 48-bit signed integers overflows a 64-bit signed integer? Edit: the overflow can occur at any step, not only on the final result. Since this is a normal distribution, I guess that the cumulative sums more or less oscillate around zero, and that...
I have a directed graph with unweighted edges between the vertices, and possible cycles. I want an algorithm that I can pass in the graph and a number N, and have it spit out a set of N clusters each containing some of the vertices, such that: Each vertex can only belong to one cluster The total number of original-gra...
I would like to prove or disporove: there exists infinitely many languagess that are RE-Complete. Here is my attempt of the proof. Let $L$ be any RE-complete language. Define a padded version of $L$, denoted $L'$ as follows, where $k \in \mathbb{N}$ is a fixed number: $$L' = \{x@^k \mid x \in L\}.$$ where $@$ is a new ...
While reading the example given in [1]., I couldn't understand how the authors set up the logic to compute the weakest preconditions (wp) in their car example in section 4.2. The dynamics of the problem are given by - $x' = x + 0.1v$ $v' = v + 0.1a + \epsilon$ I don't see the authors working on the former equation, onl...
I'm trying to prove the correctness of an interpreter for a simple extension of untyped lambda-calculus with De Bruijn indices. The interpreter is bounded, i.e. in order to ensure its finiteness it has an additional parameter $n \in \mathbb N$ that decreases with each recursive call. The function returns $\bot$ when $n...
I have exam next week about automata theory, languages and computation. I struggle with reductions (Undecidability). For example for this two problems, and need to check first if the language is recursive, RE but no recursive or NOT-RE. After that to prove with reduction, okay for proving is easy I think, but to check ...
public static void sort(int[] A, int i, int j) { if (i >= j) return; int m = (i + j) / 2; sort(A, i, m); sort(A, m + 1, j); if (A[m] > A[j]) { // swap A[j] and A[m] int temp = A[j]; A[j] = A[m]; A[m] = temp; } ...
The Green500 is a biannual ranking of the world's most energy-efficient supercomputers. It was first measured in millions of floating-point operations per second per watt of power consumed, and is now measured in billions of FLOPs/watt instead due to advances in distributed computing. For instance, the Simons Foundatio...
I'm reading about page tables in Patterson & Hennessy's Computer Organization and Design RISC-V Edition. The excessive memory usage of a single-level page table is noted w/: with a single level page table for a 48-bit address with 4 KiB pages, we need 64 billion table entries. As each page table entry is 8 bytes for R...
I am trying to design best solution for a chat application based on LLM model which has set of functions and based on user input can retrieve the information. I would like to ask you for some proposals regarding this because I am running of ideas. I've implemented PoC application where I am storing in mongo db collecti...
Problem Statement: We want to update(only decrease allowed) elements of array to obtain a new array which is in same ratio as ratio array. Example lets say you have quantity vector as [20, 50, 20] and ratio vector as [1, 2, 1]. Now you update quantity array to [20,40,20], so you have quantity elements in same ratio as ...
I am working on a project and came across the following problem I have to solve. Imagine we have a time series data Ts which is an array of pair, say each element is (Xi, Yi). The length of this array is constant N but is updated regularly. Each update consists of two steps, We remove Ts[0] Add a new pair (X, Y) to th...
Suppose an absolute beginner (in the field of data analysis/data science), which is indeed my case, has decided to create a project for his/her resume. These are the skills he has learnt: Python(Pandas, NumPy, Seaborn/Matplotlib) - 2 years of experience (intermediate level) SQL - 1 month of experience have knowledge ...
With Lamport clocks, each node keeps its own counter. Before sending a message, a node increments its counter by one: LC(A)=LC(A)+1, and sends {1,msg} to B. Upon receiving a message, B updates its counter using the following formula: LC(B)=max(LC(B),LC(msg))+1=max(0,1)+1=2. This works as expected when A and B take turn...
Given an alphabet $\Sigma$ of $n$ elements, whenever there is some order $\leq$ over the elements of $\Sigma$, we define $s^{\leq} : \Sigma^{*} \mapsto \Sigma^{*}$ as \begin{align*} s^{\leq} \left( (a_n)^m \right) &= (a_1)^{m + 1} & m \geq 0\\ s^{\leq} \left( \alpha a_i (a_n)^{m} \right) &= \alpha a_{i+1} (a_...
I am trying to convert the below context-free grammar into Chomsky Normal Form, specifically, removing rules that have three or more variables or terminators. $$S \to A a B \;\vert\; B b C$$ $$A \to A a B \;\vert\; B b C$$ $$B \to B b C$$ $$C \to x$$ I am trying to understand if the right converstion would result in th...
I was reading this post, and in it I learned how to make difficult instances of the SubSet Sum Problem. There the guy who responded to the post says that it is necessary to have density 1.0 and all elements of the difficult instance must have a size in bits equivalent to the number of elements in the vector $S$ of inte...
We know that Linear context-free languages are not closed under complement, so I encountered a challenge in finding an example to show the above theorem. I think the complement of $L={a^nb^n}$ is not linear, but I can't prove it.
I am trying to understand this question from Prof. Onur Mutlu's assignment solution on virtual memory. I am reproducing the problem and solution followed by my question: Problem: A dedicated computer architecture student (like you) bought a 32-bit processor that implements paging-based virtual memory using a single-lev...
In the Bellman-Ford algorithm's relaxation part, I can't seem to understand why we need to use (d[v] = min{ d[v], d[u] + c(u, v) }), the (c(u,v)) part. This uses the original weight. Why can't it use the least cost(shortest) between (u,v) instead of c(u,v)?
Let $H(n)$ be the average height of a BST with nodes from ${1,...,n}$. I think that $$H(n) = \frac{1}{n}\sum_{i = 0}^{n-1}\left[\text{max}(H(i), H(n-1 -i)) + 1\right]$$ But I don't know how to prove this is correct. Can anyone help me or explain why this is incorrect? Note proving it directly seems hard because you end...
Consider this context-free grammar: $$G:\\\;\; S\to aSbb|aaSbbb|\lambda$$ Is the string $a^{2020} b^{4020}\in L(G)$? I try to derive such a string but I can't, how it possible?
I wrote code for the Regular Simplex (RSM) and the Irregular Simplex (Nelder-Mead Method (N-MM)) in Visual Studio in C++. For given functions (quadratic (QF), Rosenbrock with alpha = 1 (RF1), Rosenbrock with alpha = 12 (RF12)), starting points ({-1, -1}, {2, 2}), accuracies (1e- 2, 1e-5) received the number of iteratio...
How is the best way to go about proving that a greedy algorithm is optimal, inductive vs contradiction, are there parts in the proof that are key to include. I did not feel that the lesson I was given adequately covered how to start a greedy proof, any advise on a general way to go about proving greedy algorithms woul...
I've implemented a ranking system (based on a score), using a Map<Player,Score> and an improved BST<Score, Set<Player>>. So now I can compute "rank of a player" in O(log(n)) time, "top xxx players", insert/update/remove in O(log(n)) time. Now I want to improve my data structure to remember the "best rank" of each playe...
Suppose I have a function $f: \mathbb{R}^n\rightarrow\mathbb{R}$. All I know about the function is, I have a set of pairs of vectors ($\vec{v}_a$, $\vec{v}_b$) for which I know which one is greater (i.e. I know that $f(\vec{v}_a)>f(\vec{v}_b)$). I want to find the minimum of the function (or at least a good approximati...
I have a problem where I need to connect branches of multiple trees with edges such that every start node is connected to every other start node. Each tree can branch at a second node into 1-3 branches, with the count of branches always being even. I've implemented a solution, but it's not very readable or maintainable...
I'm studying heuristics for a course in my Master's. Our professor has told us that in order to point to a higher grade in the exam, we should check if our algorithm hits a stagnation points and that we have not seen any clear improvements to the optimum we have found. He asked it for some algorithms, especially the Si...
Suppose $L=\{ww^r:w\in\Sigma^*\}$. Already, we know that we can draw a PDA for $L$ such that accept each $w\in L$ with space complexity at least $|w|$. My question is how is it possible to draw a PDA that accepts or rejects $w$ with space complexity $\frac{w}{C}$ for some constant $C$? Any help or hint will be apprecia...
In most US universities, undergraduate students must satisfy the requirements of a degree program in order to graduate. The general rules are: The university has a minimum number of total credits needed, and a series of subject-based baskets (e.g. sciences, humanities, writing, etc) with their own minimum credit count...
While reading an article devoted to the sparse self-attention, I came across a notation that was not very clear: $$ Attend(X, S) = \Big( a(x_i, S_i) \Big)_{i∈{\{1,...,n}\}} $$ What means $\Big( \space \space \Big)_{i∈{\{1,...,n}\}}$ ? It would be great to describe this in more detail. Link to the article (page 4): ...
Suppose $L$ is regular and we define $L'=\{x:\exists y\in L \wedge \text{ y be a subsequence of x}\}$. Could we conclude that $L'$ is regular or not? I think it's not regular because if $L=a^*b^*c^*$ then $L'$ could be $a^nb^nc^n$ so it can't be regular.
public void m1(int n) { sum = 0; for (int i = n/2; i <= n; i++) { for (int j = 1; j <= n; j = 2 * j) { for (int k = 1; k <= n; k = k * 2) { sum++; } } } } So, I know that the innermost loop and second loop are $\log(n)$ and the outermost loop is essen...
I am implementing Earley parser and using algorithm from Elizabeth Scott's paper "SPPF-Style Parsing From Earley Recognisers" (section 4). Author says A family of children of u will consist of one or two nodes. However algorithm as described in paper fails at following grammar: <S> ::= <A> | <B> | <C> <A> ::= 'a' <B>...
i'm trying to make a game in which the player faces an infinite (finitely specified) series of enemies and has to specify a strategy that provably defeats all of them (ie defeats enemy n in finite time for all n). i'm intending to do it by having the player describe their strategy in a decidable language, which is then...
I have to analyze how every sorting algorithm's complexity would change if it had to sort a linked list and which of all of them is the most efficient. I find everywhere that merge sort is the most efficient one for linked lists, but I don't understand why counting sort isn't better. I think it would still be O(n). Am ...
In literature, Convolutional Neural Nets (CNNs) are presented as a special case of Deep Neural Nets (DNNs) (e.g., here). I do not understand how the convolutional layer can be implemented through a layer of neurons though. As far as I understand, a $n \times m$ kernel is used to calculate a single output feature over a...
An integer is $k$-smooth if its prime factors are at most $k$. In the case where $k$ is not tiny (say $10^8 < k < 10^{10}$), are there algorithms to test for $k$-smoothness, other than trying every prime up to $k$? Context: (1) The largest component $p^a$ of an odd perfect number is known to be greater than $10^{62}$. ...
I was reading the NeRF paper recently (https://arxiv.org/pdf/2003.08934.pdf), and under the positional encoding section, I see that the authors propose usage of the following function for transforming the input $$ \gamma (p) = (sin(2^0 \pi p), cos(2^0 \pi p), sin(2^1 \pi p), ..., sin(2^{L-1} \pi p), cos(2^{L-1} \pi p))...
This question is kind of a follow-up to a question asked a few days ago. Both of the non-linear complements of linear languages found were also not context free. So the question is this: Is there some linear $L$ such that $\overline{L}$ is non-linear but still context free? One attempt I've made was to look at the line...
I can't understand why do we have to use NFA to prove that concatenation operation is closed. According to sisper's book it says that we can't determine where to split the string, i.e. where to determine that we now have to transition from string of one language to another language. I still don't have a clear understan...
Crank disclaimer: I don't doubt the undecidability of the halting problem, but one proof confuses me. We have seen this folklore proof of the halting problem on several occasions. Assume a HALTING SOLVER ($HS$) exists with argument program $P$ and it returns true iff $P$ halts. Let SMART PROGRAM ($SP$) do the following...
I am interested in circuits that reduce $2^n-1$ input bits into their sum, represented as an $n$ bit integers. For $n=2$, this is a full adder, which can be implemented with 5 gates of 2 inputs in various ways. Alternatively, it can be directly implemented using 2 gates of 3 inputs (a parity gate and a majority gate)...
Given are n gene sequences (words over the alphabet {A, T, C, G}), each of length m. Find a gene sequence (of length m) that minimizes the maximum distance to all given gene sequences. Here, distance is measured as the number of positions at which the sequences differ. Show that the following problem is not efficiently...
Suppose I want to prove that $NP \cap coNP = P$. Since clearly $P\subseteq NP \cap coNP$, I need to prove the opposite direction, i.e., every problem in $NP \cap coNP$ has a polynomial-time algorithm. Is there a shorter way to prove this equality than arguing about all problems in $NP \cap coNP$? One obvious way would ...
We are all familiar with Bitonic Sort. The computations are predetermined and data-independent. Let's say we have a table A = [ 1,3,2,5,6,3,3,21 ]. The output after performing the sort is: A [ 1,2,3,3,3,5,6,21 ]. Observe that we have three entries with value 3 in indexes 1,5, and 6. My question is: After bitonic sort,...
I am trying the understand the following statement from the book of Grotschel, Lovasz and Schrijver: Here, $\delta(W)$ is the set of edges incident to a set of vertices $W$. They define an optimization problem whose solution is a nonnegative real vector. If we add a constraint that all elements of the vector must be i...
I am working on a problem that involves distributing a set of N supplements across a predefined number of meals (M) in a way that maximizes the total number of positive interactions and minimizes negative interactions between the supplements. Each interaction between the supplements is known beforehand (positive, neutr...
What theoretical concept lies behind the strong restriction of acquire semantics - to reads, and release semantics - to writes? (With papers titles and authors, if possible.) Is it related to provision of correctness of more complex approaches than lock-based synchronization (as lock-free, wait-free algorithms)? How th...
We know that $\widetilde{O}(f(n))$ — $O$ with a tilde above it — which means $O(f(n) \text {polylog}(f(n)))$, i.e., $O(f(n) (\log f(n))^k)$ for some $k$. Also I have seen in Wikipedia that $n2^n=\widetilde{O}(2^n).$ My question is that if $\text{poly}(n) \space 2^{xn}\leq2^{yn}$ then how it implies $x\leq y$? I have se...
As motivation, a Space Craft known as the Mars Climate Orbiter failed in the year 1999. The failure occurred because the distinction between pound-force seconds and newton-seconds was made as an comment, instead of being part of the code itself. Suppose that a student created a generic class (also known as a template ...
In this problem we consider two stacks $A$ and $B$ manipulated using the following operations ($n$ denotes the size of $A$ and $m$ the size of $B$):   PushA($x$): Push element $x$ on stack $A$.   PushB($x$): Push element $x$ on stack $B$.   MultiPopA($k$): Pop $min(k;n)$ elements from $A$.   MultiPopB($k$): Pop $min(k...
I came across this weird expression while learning about regular expressions. $R^+ \cup \varepsilon = R^*$ why does doing union with an empty string makes this regex go from 1 or more to 0 or more?
I am reading the example given in [1], section 4.2. It deals with applying weakest precondition (wp) rules to ensure that the velocity of a car doesn't exceed a certain limit. We have the following reinforcement learning equation and we want to constrain it across 2 timesteps - $v' = v + 0.1a + \epsilon$ Based on a pre...
I am planning to apply for master's degree at TU Berlin and have to take some courses on theoretical computer science since the university requires me to take some credits on theoretical computer science.Do these courses come under this category? 1-Graph theory:Basic definitions, trees, Cayley's formula, connectedness,...
I am planning to apply for master's degree at TU Berlin and have to take some courses on theoretical computer science since the university requires me to take some credits on theoretical computer science.Do these courses come under this category? 1-Graph theory:Basic definitions, trees, Cayley's formula, connectedness,...
I am planning to apply for master's degree at TU Berlin and have to take some courses on theoretical computer science since the university requires me to take some credits on theoretical computer science.Do these courses come under this category? 1-Graph theory:Basic definitions, trees, Cayley's formula, connectedness,...
I would like to find a target point in a 3-dimensional space. I do not know the exact location of the target, but I can measure to it from some of the points in the space with a metric that roughly approximates distance to the target (smaller metric values are closer to the target). The metric is noisy and it's safe to...
I have questions about how to put the grammar below in CNF - Chomsky Normal Form: S ->aAa | bBb | ВВ; A -> C; B -> S | A; C -> S | ε; I did it like this: I eliminated empty productions: S ->aAa | aa | bBb | bb| ВВ; A -> C; B -> S | A; C -> S; I eliminated unit productions: S ->aAa | aa | bBb | bb | ВВ; A -> aAa | a...
I am preparing for my algorithm and data structures exam. In the code below, I need to prove the correctness of tripSort for arrays of a size >=3. I am trying to do that by using loop invariants. The subarray A[n-2j+1,n] is the loop invariant I chose, where j refers to the iterations of the while loop. Is this the corr...
Can putting information systems through a "functional bottleneck" to approximate their Algorithmic Information reduce their attack and argument surfaces substantially? Software surface may be defined in terms of its complexity, both as attack surface and as argument surface. While cyber attack surface is well known in...
Is the language $$L = \{M | \exists M' \text{ that stops on the same input words but L(M)} \neq L(M')\}$$ in RE or R? I suspect that it's not in RE, since you'd have to first know for M all the inputs for which it halts, which you can't do in a finite time. I wanted to show that $\overline {HP} \leq L$, and so because ...
I have large cnf with thousands of variables, but with known compact backdoor set. I think this set can be used by CDCL solvers to choose assignment variables to simplify formula much faster, but I failed to find solver with such feature. Kissat and cadical (top performers of SAT competitions) can't do that. Is there a...
What is the algorithm behind this routine and is there documentation available for it?
Show that it is not possible to construct the toffoli gate using only CNOT gates, given we are allowed to choose any number of ancilla bits. My Attempt The action of a toffoli gate can be defined as, \begin{align} f_{toffoli}:(x,y,z)= &(x,y,z\oplus xy)\\ =&(x,y,z\overline{xy}\vee\bar{z}xy)\\ =&(x,y,z(\bar{x}\vee\bar{...
Let $\epsilon > 0$. For $P\subset \mathbb R^d$, a subset $Q\subset P$ is called an $\epsilon$-packing if: for every $p \in P$ there is a $q\in Q$ such that $d(p,q) \leq \epsilon$, and for every $q, q' \in Q$, we have $d(q,q') \geq \epsilon$. (See also the definitions here). Question. What algorithms exist for computi...
this code aims to determine whether there exists a contiguous subarray starting from index 0 in the given array A whose elements sum up to the target value S. can we apply Master theorem to find out its complexity public static boolean subsumFun(int[] A, int S, int i, int j) { if (i >= j) return S == 0; ...
I am reading C++ Concurrency in Action and it says that always locking mutexes in a certain order prevents deadlocks. However, this is not a computer science book and no proof is given for this claim. I would like to develop some (more) intuition for why this is, with ideally a proof to convince me.
I am studying the greedy algorithm for maximal weighted matching in arbitrary graphs. I have proven that this algorithm has approximation factor $\frac{1}{2}$. Assume now that the weights in the graph are such that if $W = ⟨w_1, w_2, \ldots , w_{|E|}⟩$ is the weights sorted in increasing order, then $w_i \leq cw_{i+1}$...
Recently, when I self-learnt Discrete Mathematics and Its Applications 8th by Kenneth Rosen, it says in 12.4 Minimization of Circuits which uses the Karnaugh Map or the Quine-McCluskey method: Minimizing a Boolean function makes it possible to construct a circuit for this function that uses the fewest gates and fewest...
Let $I$ be a set of items; $C \subseteq \mathcal{P}(I)$ be a set of subsets of $I$, where $\mathcal{P}(I)$ stands for the power set of $I$; And $C(i) = \{ c \in C \mid i \in c \}$ be the set of sets, in $C$, containing item $i \in I$. We state the following definitions. Definition 1: We say that $\mathcal{C} \subsete...
To show $\text{PSPACE-completeness}$ of $\text{SPACE-TMSAT}$, we perform a polynomial-time reduction of $\forall L \in \text{PSPACE}$ to $\text{SPACE-TMSAT}$. The language $L$ can be decided by a TM $M$ that takes at most $O(n^k)$ space for some constant $k > 0$. Does the reduction require the value of this constant $k...
I have a weighted undirected graph G=(V,E,W), I want to find an independent set S of V, such that if we sort the vertices of S in increasing order of their weights, the cumulative sum of the weights is maximized. In other words, if we suppose without loose of generality that $S={v_1,...,v_h}$ are the vertices of $S$ so...
I am reading some heavy hitter (HH) papers when I run into the following reduction theorem. The theorem attempts to reduce an HH problem with a very small tail frequency $\epsilon$ to multiple HH instances with higher tail frequencies. More precisely, the reduction utilizes a random hash function $h$ that throws an ite...
In the Question here it is said that $|xy^2z|<2^{p+1}$ Considering that $|x| = 0$ and $|z| = 0$, y consists of $2^{p}$. It's probably trivial, but how do I see, that $|xy^2z| < 2^{p+1}$?
I have this proof trying to show L={0}^* {1}^* is not a regular language, I know that L is regular but I don't know what in this proof is wrong. If y contains a 0 and 1 and is pumped wouldn't that make the any word not be in the proper form like going from 000111 to 0000101111? Let p≥0 . We construct w=0⌈p/2⌉1⌈p/2⌉ ; w...
I need to find a way to split an AVL tree based on the amount of nodes in the tree, lets assume you get a number $k$ and if the number of nodes in the tree is multiplication of $k$ you need to find the maximum of each tree in the $k$ trees. for example: for $k=3$ 3 / \ 2 9 / / \ 1 4 11 after...
Using the Pumping-Lemma for $ \{L = a^nb^n | n \in \mathbb{N}\} $. We define $p \in \mathbb{N}$ It exists a word $w = a^pb^p$ For every $|w| \ge p$: $w=xyz$, $y > 0$, $|xy| \le p$ Because of $|xy| \le p$, we can say that y only consists of a's or b's. For the language to be regular $|xy^iz| \in L$ Which means $|xy...
I cannot help but wonder: how to compute an inverse of a suffix array, preferably in linear time? For $ISA$, it holds that $ISA[SA[i]] = i$.
Let $G = (V, E)$ be a directed weighted graph such that all the weights on the edges are positive. In $G$, we have two nodes, $v$ and $u$, that have a path from $v$ to $u$. The question asks to find a set of edges $ E' \subseteq E $ with the minimum weight such that $G' = (V, E') $ has no path from $v$ to $u$. I tried ...
I'm taking an automata class and one of the examples is showing this is regular. My initial thought was to make a DFA to show it is but i'm a bit confused on what a DFA with a standard 5 tuple would look like for this. I know my alphabet is all the combinations of 0,1,2 for the columns and that my final state would be ...
Something I was asked to solve and tried to come up with a formula or some method to solve it after I did and couldn't. Given is a graph G=(V,E) that is undirected and weighted. Say we want to find the lightest paths tree (assume using Dijkstra's algorithm), we will call it K, and the Minimal Spanning Tree (assume usi...
I'm kinda confused on how to construct this DFA. I'm trying but keep running into the problem of reading an a after the b's or what to do if starting with a 'b'.
I'd like to count the number of left to right maxima in a permutation in Sage/Python, i.e. the number of times a number appears in the permutation that is greater than all of the previous numbers. The first number will always count as a maxima. I'm struggling with how to formulate the 'if' statement to include all prev...
The problem statement is the following: given a non-empty set P of (x, y) points with an associated reward, find the path through P that gives the maximum earning. The earning of a path is the sum of the rewards minus the total cost of visiting each point, measured as the distance between any pair points. I have to des...
I am reading about Datalog+- (e,g, https://ieeexplore.ieee.org/abstract/document/5571709), and I have a doubt about its semantics, and about the complexity of query answering. In Datalog+-, you write sets of TGDs whose chase is not guaranteed to terminate. However, Datalog+- guarantees that, for the problem of query an...
Lets take the Language $$L = \{ (ab)^na^k | n \ge k \}$$ Does it dictate, that the $(ab)^n$ comes before the $a^k$ ? Or is the order irrelevant as long as it matches the $n \ge k$ criterium? In simple terms: is the word $aaaababab \in L$ ? And if so, does this apply for every language?
Example $L = {(ab)^na^k|n\ge k}$ When searching for a word $w$, using $p \in \mathbb{N}$, for instance $(ab)^pa^p$, but wanting to pump $a$ (which is not possible because $|xy| \le p$ holds), how do I deal with that? I would need a variable $j \lt p$ for $(ab)^ja^j$ to have the possibility that $a \in y$, so I can pump...
Given the language $L = \{ a^n | \text{n is odd} \}$ I'm looking for a word $w$ using $p \in \mathbb(N)$. For example, if it would be even, instead of odd I'd choose $w = a^{2p}$. But with odd, I'm really struggling to find a word. What do I do? Define a variable $j$ and say $\text{j is odd}$ so $a^j \in L$ I know the...