instruction
stringlengths
35
29.1k
I'm looking for some resources on what happens on the low-level with databases. I've found that indexed data is looked up using b+ trees, but could not find anything on non-indexed columns. Is there any algorithm better than fetching values of every row?
I have a linear program over real variables for which it can be shown that all the vertices of the polytope describing its feasible region are integral. Obviously I can just solve this using a standard linear programming solver. However I would like to know if I can take advantage of the known integral nature of the fe...
The calculation of the period of the "modulo exponentiation" function: $$ f_a(r) = a^r (mod \ N) $$ is a step of the quantum algorithm for factorizing $N$, where $a$ is a number chosen with some limitation. The quantum circuit is able to find the period of $f(r)$ in time polynomial in the number of bits of $N$. This al...
In looking into the problem of low-rank matrix completion / relaxations of the general problem to derive exact solutions, many papers cite that the original formulation is NP-hard but I cannot find a proof of this fact. The problem is as follows. Given a matrix $M \in \mathbb{R}^{n \times m}$ of rank $r$ (again, assume...
If $f(n)$ and $g(n)$ are T, show that $f(n)^{g(n)}$ is Turing computable too. I started by designing this machine: on the first tape I have n written in unary ($1^n$). Then on the second tape I write $f(n)$ and on the third one $g(n)$. I have one additional tape and the one with output (write-only). The first step wo...
I am given an undirected connected graph with $n$ nodes, average degree $\sqrt{\log n}$, and each edge having integer weight in $\{1,..,5\}$. I am asked to describe MST algorithm which is as efficient as possible. I read https://en.wikipedia.org/wiki/Minimum_spanning_tree about Dense Graph and Integer weights, but it s...
Wikipedia gives the path cover definition as: Given a directed graph $G = (V, E)$, a path cover is a set of directed paths such that every vertex $v \in V$ belongs to at least one path. I'm reading the paper "On k-Path Covers and their Application" (Funke, S., Nusser, A., & Storandt, S. (2014)) and they gave the defini...
I am trying to work out some analysis for an algorithm I am trying to write, one step of what I am doing require knowing the answer to the above question. I know it might sound a bit simple, but I am not sure of the approach (formally using probability theory). Assume I have an algorithm that loops over a bitstring (x1...
I'm stuck on something in in Shan's article Shift to Control, about CPS. On page three he writes the CPS transform x --> (lambda (c) (c x)) (lambda (x) E) --> (lambda (c) (c (lambda (x) E))) (E1 E2) --> (lambda (c) (E1 (lambda (f) (E2 (lambda (x) ((f x) c)))))) Shouldn't the innermost expression on the third line be...
I have the following problem: Given a graph of persons and their relationships. Suppose I have a classification of the risk of some of those persons. How can I calculate the classification of the others? For instance, suppose I have a graph with 100 persons with the relations between each other (for example A is a fr...
Consider this kind of optimization problem: (1) The problem aims to minimize a value. Let n denote this value. (2) To determine whether n = 0 is a NP-Complete problem. It is obvious that this kind of problem is at least NP-Hard. My question is, can this kind of problem be approximated? It seems that for any polynomial-...
I've been following Automata and Formal Languages in my college and I came across this particular exercise. While the solution presented seems correct, I take on Automata Tutor trying this exercise a 0 out of 10. I can't understand what was wrong here cause overall it seems correct. Thanks a lot if you can help me.
I am trying to understand mathematical proofs and their applications to big-omega $\Omega$ and big-theta $\Theta$ notations. The first one is transitivity: $f \in O(g) \; and \; g \in O(h) \Rightarrow f \in O(h)$ I am having a lot of trouble with this and any help will be greatly appreciated.
Person $A$ is chasing person $B$. Both people can only travel between $n$ vertices of a graph by running through one of $m$ one-way pipes labelled $1,2,\cdots, m$. For each pipe we know the starting and ending vertex. Each pipe has two values $A_i, B_i$ which are positive real numbers and represent the multipliers of p...
I need a little help regarding this problem: Let L = {w ∈ {0, 1} ∗ : w has an even number of 0s and the last character of w is a 1}. Give the equivalence classes of the relation ≡L using regular expressions. What does it mean with equivalence classes? Is it right that i have found a regular expression for it: 1*(1010)1...
I encountered a problem, where I am given a (fully-connected) graph within a metric space, where each edge weight is either 1 or 2. My task is to prove that the following greedy algorithm gives a $\frac{3}{2}$-approximation for finding a TSP path: Start from an arbitrary node, pick the nearest neighbour node, go to thi...
I am currently reading Formal Methods - An Appetizer and am stuck in chapter 3 (Program Verification). I am unfamiliar with logic and I do not think I understand the $\vDash$ notation correctly. I tried to work through Definition 3.8 by giving myself a super-simple example: Let there be an edge $(q_1, \texttt{y:=1}, q...
I was studying Skip Lists in section 3.10 of Advanced Data Structures by Peter Brass and was confused about a detail of how the search algorithm in implemented. (This is self-study, not homework). The book explains the find algorithm for a Skip List as follows: ...any access to an item, given a query key, starts on th...
I'm taking a grad level algorithms course and we just ended the course talking about linear programming, and we had previously talked about the max flow/min cut problem. Our professor said that the max flow/min cut problem can be formulated as an LP problem. I asked the professor what the non feasible but locally optim...
What does the computer do when an I/O operation needs to be done during the process? Does the message that we need to do some I/O operation directly reaches the device controller or device driver? What does the operating system have to do with this?
So I have a complete digraph with non-zero positive edge weights. The nodes represent locations and edge weights are the travel times between the two corresponding nodes. I have 2 or more agents traversing the graph. The goal is that they visit as many nodes as possible within a certain amount of time. I have the follo...
A priority search tree is a binary tree satisfying the following: every node $u$ stores a point $p_u = (x_u,y_u)$ every nonleaf $u$ stores an x-coordinate $x_u'$ called the split-line coordinate. If $v$ is a descendant of $u, y_v\leq y_u$. If $v$ is in the left subtree of $u$, then $x_v < x_u$ and if $v$ is in the r...
Frog game initializes by placing one frog on every vertex of a simple connected graph $G$ with $n$ vertices. A move consists of moving all $x\gt 0$ frogs from one vertex to another non-empty vertex to which a path of $x$ unique edges exists. A vertex is solvable if there is a sequence of $n-1$ moves to move all frogs t...
The proof in the wikipedia article for the uncomputability of Kolmogorov complexity uses the fact that there are strings of arbitrarily large Kolmogorov complexity. What if we restrict to a finite domain so this no longer holds? Specifically, what if I am only interested in strings of length $\le N$, is there an algori...
Problem: Design a data-structure $BankAccount$ that supports the following operations in $ \underline{\text{constant time complexity}} $. Meaning $O(1) $. $Init()$ - initializes bank account $L$ with $0$ dollars. $Receive(L,d)$ - adds to the account balance $ d $ dollars. $Send(L,d)$ - decreases from the account balan...
I created an algorithm which I cannot resolve. Imagine you have list of number like: val list = mutableListOf(1, 2, 3, 4, 5, 2, 6, 7, 2, 9) And if some number is duplicated (in this case 2 is 3x times) we have to remove 3,6 and 9. I was trying to resolve it, but I can only remove 6 and 9 and even without whole solutio...
I am given the definition of a unit interval graph, e.g. $G = (V, E)$ such that $\forall v \in V$ there is a weight $x_v \in \mathbb{R}$ and nodes $u, w$ has an edge iff $|x_u - x_w| < 1$. I am asked to find a dominating set of minimum cardinality in $G$ greedily. And prove it is a dominating set and it is also optimal...
Is it possible to construct different systems of logic in Coq or Agda? I ask because I'm interested in using a proof assistant to construct (and verify) theorems in things like many-valued logics, relevant logics, and conditional logics in Graham Priest's 2nd edition of An Introduction to Non-Classical Logic (I keep go...
I'm having a problem determining whether [F(a, b, c) = a' + b] is functionally(logically) complete or not. I would really appreciate it if you could help me. P.S: I can't have 1 or 0 as input.
2nd year college student here, I have trouble finding for the regular expression for that grammar, any help would help :D Regular Language of the grammar: X → aY → ab X → bZ → ba X → aY → abZ → aba  X → bZ → baY → bab X → aY → abZ → abaY  → abab X → bZ → baY → babZ → baba X → aY → abZ → abaY  →ababZ → ababa X → bZ → ba...
We have this example: {true} assume x > 1; y := x * 2; z := x + 2; assert y > z; {true} They then show this: {true} wp(assume x > 1, x * 2 > x + 2) = x>1 -> x*2 > x+2 assume x > 1; wp(y := x * 2, y > x + 2) = x * 2 > x + 2 y := x * 2; wp(z := x + 2, y > z) = y > x + 2 z := x + 2; wp(assert y > z, true) = y > z -> true...
I had a question about EXP^P (EXPTIME with access to a P oracle). I thought I had read somewhere that EXP = EXP^P, and that seemed fairly intuitive to me: I thought "adding polynomial power to something that already has exponential power must not change a lot". Now I am questioning myself: I was searching for something...
Given a binomial heap of $n$ nodes (where $n$ divides by 3), how can I split the heap to three binomial heaps with an equal number of nodes (every heap contains $n/3$ nodes). The time complexity needs to be $O(\log n)$.
Again, I must apologize if this is "easily googlable". I have tried. My understanding is that the BIOS typically looks for the magic number 0x55aa at the end of a 512 byte sector (so bytes #511 and #512). Once it finds that, it begins executing that code. That code can then load the operating system. It finds this by c...
How can I represente finite language using set notation? G = {ab, bb}, which means G = ({a} ∪ {b}{b}) D = {ca, aa}, then D = ({c} ∪ {a}{a}). How about {aaac, aacc, abac, abcc}? Also, can I represent A = {ardor, ardour, glamor, glamour, labor, labour, neighbor, neighbour} as A = {ar, gla, la, neighb} ∪ {o{u}?r}?
As of now, the only method I know for evaluating postfix expression is using a stack. The following question was asked in a past semester: What are the two different methods of evaluating a postfix expression? I skimmed through online references but couldn't get any answer. Your answer could be of great help!
As you all probably know, Gödel’s incompleteness theorem states, that it will never be possible for mathematics to prove its own correctness. Mainly because that proof would be part of mathematics too, and hence need proving itself. And that leads to an infinite loop in logic. But I realized that a quine, as in, a prog...
I have been studying different topics within the realm of concurrent programming and came across "Lamport's bakery algorithm" which is based on the original version of the bakery algorithm by Peterson. While studying I came across a paper showcasing the following program: with a question for the reader reading "Show t...
I am trying to analyze a series that I found, in the analysis of an algorithm. And I was wondering if the following was true: $$\log_{2}{\left(\frac{1}{2}n\right)} + \log_{2}{\left(\frac{1}{4}n\right)} + \log_{2}{\left(\frac{1}{8}n\right)} + \cdots + \log_{2}{\left(\frac{1}{2^{log_{2}(n)}}n\right)} = \mathcal{O}\left(\...
I have a data structure supporting the operations Insert(X) and Remove-Min(). Remove-Min() is performed in $O(\sqrt{\log n})$. And I am supposed to show that the Insert is bounded by $\Omega(\log n)$. I would like to ask how to approach this problem. $O(\sqrt{\log n})$ never really occured to me and I do not know how t...
Given underirected $n$-regular graph with $2n$ nodes, I am asked to show it has a matching of size $n/2$. My attempt: At each step I will also remove the edge from the graph that I am adding to the matching $M$ edges. I start at random edge $(u,v)$ and add it to $M$. The degree of nodes $u$ and $v$ is now decreased. I ...
The following problem is a variant of the all pairs shortest path problem: Given a weighted, directed graph $G=(V,E), |V| = n,|E| = m,$ and an integer $\alpha\ge 1$, how can I find an efficient algorithm to construct an $n\times n$ matrix where the entry corresponding to vertices $u$ and $v$ is the minimum weight path...
Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal. This is leetcode problem #698. Below is code that I have written with backtracking to solve the problem (it is correct and passes all test cases). When we apply memoization...
i am looking to convert regular expression 0* 1* to deterministic finite automaton (DFA) I have tried creating the NFA for the regular expression as given in the above image, From the regular expression, the strings that can be created are {€, 0, 1, 001, 011, 0011, ………} My doubt is how do you even create DFA That can ...
Denote by $A(n,d)$ the maximal size of a binary code of length $n$ with distance $d$. How to show that $A(3k, 2k)=4$? From Plotkin bound: $$2k > \dfrac{3k}{2} \Rightarrow A(3k, 2k) \leq 4$$ But I don't know why here equality. I also tried to use Gilbert–Varshamov lower bound. But it doesn't help to obtain $A(3k, 2k) \g...
Is any technique present in this technical world regarding accessing data directly from any type of storing device without recovery it. For example if I deleted permanently data and then want to access it without recovering data using any software, but done some program as programmer and directly access that data witho...
Copy from Wikipedia Cycle sort is an in-place, unstable sorting algorithm, a comparison sort that is theoretically optimal in terms of the total number of writes to the original array, unlike any other in-place sorting algorithm. It is based on the idea that the permutation to be sorted can be factored into cycles, wh...
After reading a lot of materials related to the Primary key and Unique key, I am in doubt. Let us consider a primary key (AB) in table R (ABCDE). AB together can not be null as AB is a primary key. But, is it possible for a row that A is null? Or, B is null?
I'm working on my bachelor thesis (on Computer Science) and right now I'm having a problem about finding shortest path between two points on 3D triangular mesh that is manifold. I already read about MMP, but which computes distance function $d(x)$ between given point and vertex $x$ on mesh. I got to know that the prob...
Let $\Sigma$ be an alphabet of some symbols, and let $\mathrm{lcs}$ denote the length of the longest common subsequence of two or more sequences defined on $\Sigma$. For some $A,B,C\in\Sigma^{\star}$, given $\mathrm{lcs}\!\left(A,B\right)$, $\mathrm{lcs}\!\left(B,C\right)$ and $\mathrm{lcs}\!\left(C,A\right)$, what can...
I was self-learning the complexity theory using the Computational Complexity: A Modern Approach by Arora and Barak. When studying the Ladner's Theorem, the textbook mentioned a function $H(x)$ as shown below, and claim that the complexity of $H(x)$ is $O(n^3)$. But I don't understand how to proof this claim. In the boo...
(Most fair region) Let $P$ be a set of $n$ points in the two-dimensional plane. Each point in $P$ is either colored red or blue. Given an axis-aligned rectangle $R_{ab}$ of size $a\times b$ , design a fast algorithm to decide where to place $R_{ab}$ in the plane so that the absolute difference between the number of ...
How do I go about producing the context-free grammar for something like $\{a^i b^j \mid i<j\}$? If it was $i=j$, then it's simple. But for something like this, is there a process to achieve it, or does one rely on intuition and practice?
[My apologies, I am not a computer scientist, merely an interested amateur. I apologise if this question does not make sense, is a known result, or a duplicate] To quote Wikipedia: The halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program w...
John McCarthy won the Turing Award in 1971 [1]. Two students whose PhD he supervised went on to win Turing Awards: Raj Reddy (1994) [2] Barbara Liskov (2008) [3] What other Turing Award winners supervised the PhD theses of other Turing Award winners?
I am having trouble understanding the proof given below: \begin{align} (u \cup v)^* &= (u^* \cup v)^* \\ &= u^*(u \cup v)^* = (u\cup vu^*)^* \\ &= (u^*v^*)^* = u^*(vu^*)^* \\ &= (u^*v)^*u^* \end{align} In more detail, why does $(u + v)^* = (u^* + v)^*$ hold? Why can we just put a star on $u$? Is it a property? Also, ...
Is the following true: $$ f(n) \in O(g(n)) \text{ then } 2 ^ {f(n)} \in O(2^{g(n)})$$
I'm reading the paper: "Model Checking Games for Branching Time Logics" by Martin Lange and Colin Stirling - https://carrick.fmv.informatik.uni-kassel.de/~mlange/papers/jlc2000.pdf. The paper defines a model checking game for $\text{CTL}^*$. The main result of the paper is the following (page 10): $$\textbf{Theorem 16 ...
I have written an article on a new way of non comparison sorting and I want it to get peer reviewed. The sorting algorithm uses Trie data structure to store digits of numbers as nodes and iterating over each node 10 times (k) in a depth first traversal returns the sorted list. Time complexity O(n log m), log to the bas...
A step of an algorithm I’ve designed requires computing the minimal closure under intersection of a set of sets of arbitrary size. By the "minimal closure (of a set $S$) under intersection", I mean: Given a set $S$ containing sets $s_1, \cdots , s_k$, the smallest set $′$ such that $S\subseteq S'$ and $x\cap y \in S'$ ...
Given an output sequence, $S$, we can use the Berlekamp-Massey algorithm to find the shortest LFSR, of order $n \leq |S|$, which exactly generates that sequence. Is it possible to efficiently compute an LFSR, in $GF(2)$, of order $n \leq n_0 < |S|$, which best approximates $S$? Best approximation means with the fewest ...
Is there a quantum SAT algorithm, a quantum analogue of the DPLL or CDCL algorithms? Note: I'm not looking for the quantum analogue of the Boolean satisfiability problem (though that would be interesting), but a quantum algorithm that solves Boolean SAT problems.
There are a bunch of lines in the 2D Plane. Is there an efficient algorithm to find the line that has the lowest y value given the same x? Thank you! Could we also generate a list of ranges, where for each range, we know which line has the lowest y? For example, for y = x + 2 and y = 2x for x in [0,100], we know that y...
I'm currently trying to understand a step in the proof for in the Crama and Hammer book on Boolean Functions. The proof is Proposition 4.12, which claims that the self-dualization of Boolean $f$ is bijective. The specific statement that I am confused about is a step showing that: $$f^d(X)f(X) \lor f(X) \bar{x}_{n+1} \l...
I am building an application which compares time series at a very high volume and velocity. My approach of using Dynamic Time Warping (DTW) in combination with scaled time series (range between 0 and 1) seems to work alright. I want to detect occuring anomalies in those time series. For that i am calculating a score (r...
So does anyone know the formula in order to get the number of cycles, I'm not directly asking for the answer but at least someone guides me on how to get a cycle given a grid such as an image above.
In the densest-subset problem, given an undirected graph $G = (V, E)$, the goal is to maximise the “edge-density” ratio $|E(S)|/|S|$ over all non-empty sets $S ⊆ V$ , where $E(S)$ denotes the set of edges whose both endpoints lie in $S$. The Primal LP is of the form: \begin{align} \max & \sum_{e \in E} y_e \\ \text{s.t...
While my question stems from game dev, the problem itself isn't as much about the game, but more about correctly representing my problem as a linear programming problem that I can solve with a linear programming library (alglib.net, in this case). Problem description I'm creating a prototype of a 2D space game. The spa...
Say we have bit mask with some bits on and off: 1001110010101 We want to "deduce pattern", by covering this mask with as few strided masks as possible. By "strided mask" I mean masks like: 11111111.... 01010101.... 00100100.... We can choose any length of strided masks and we need to cover initial mask completely. Sa...
I came up with the following after reading the Wikipedia page about EXPTIME, and I am wondering if I am right. I don't think I invented it, I just don't have any textbooks about this subject to find the answer in. Background The question of what state a Turing machine will be in after k steps is a simple example of a p...
I am reading Advanced Data Structures by Peter Brass for self-study, and was confused about the book's example of a Canonical Interval Decomposition for the Segment Tree section (section 4.2): So, the key 3 is halfway between 2 and 4, the key 6 is halfway between 6 and 8, and the key 9 is halfway between 8 and 10. 4 i...
This is the definition of theta notation: The function $T(N)$ is $\Theta(g(N))$ if there exist positive constants $C_1$, $C_2$ and $N_0$ such that $C_1g(N) \le T(N) \le C_2g(N)$ for all $N \ge N_0$. My calculation is below. When I solved the inequality, $N \ge 0$. Am I making a mistake or am I on the right track? Ass...
I was solving some basic problems about the theory of machines and automata. The topic was about pumping lemma, but I could not solve the below question and prove that it is not regular. $$L=\{a^{b+cd} \mid \text{$b$ and $c$ are constant, $d \in \{0,1,2,3,…\}$}\}$$ This is my incomplete solution: Assume for contradicti...
I have a set of segments. None of them intersect or touch each other, and none of them have slope $0$ or infinity (i.e. the endpoints have different $x$ and $y$). All segments have length $> 0$. What I want to achieve is, a sorting order similar to what would happen if they were ceilings in a house and rain falls on th...
i was given a this circuit as exam question So we need to define functions g and f. I defined them as $g(x,y,z) = x \oplus y \oplus z$ and $f(x,y,z) = (x \oplus y) \cdot z$. By definition known that $S=A \oplus B \oplus C_{in}$ and $C_{out}=A\cdot B + (A\oplus B)\cdot C_{in}$; $S_{FA(top,\ left)}=x \oplus y \oplus 0 ...
We describe formal languages with their finite descriptions. For example we can describe a language simply by set-builder ( $\{ x : \phi(x)\}$) or we can describe something with its corresponding Turing machine. If we consider a fixed property of languages, then we have class of languages that have this property. For e...
These terms are often used to describe algorithms but I'm not really sure what they mean. I would like to see more examples of what each one is like and how they can be identified. Can anyone please provide a thorough explanation or any links/books that can help me understand these terms better? thank you!
I am learning about designing Turing machines and I am struggling when it comes to creating the states diagram, for example if I wanted to design a Turing machine of the language $L=\{a^nb^n, n\geq 0\}$, here its state diagram: I understand the concept behind the solution, i.e: replacing the first with a with an X the...
Given a set of tuples, I want to determine if the set covers the whole space of possible values, and in which order the indices vary. This is best explained with 2-dimensional examples: In the following examples, suppose that: X has 2 possible values, in this order: 1, 2 Y has 3 possible values, in this order: 1, 2, 3...
I am wondering what exactly the difference between CTL and CTL* is. I know that CTL* is strictly more expressive than CTL, but it is not clear to me how the "restrictions" to CTL accomplish that. I.e., why do we have to alternate quantifiers and do not allow negation nor conjunction (no boolean logic)? In the book I am...
Given an undirected weighted connected graph. How to determine the edges that appear in all minimum spanning trees. I know the Kruskal and Prims algorithm to find a minimum spanning tree. But how does one ensure that a particular edge appears in all possible minimum spanning trees? My Thoughts: If an edge has degree 1,...
n teams play pairwise matches. If the match is a draw, both teams get 1 point. The winner gets 3 points, and the loser gets 0 points otherwise. Is it possible that all n teams finish with the same total points, and how? Could we devise an algorithm for it that includes the fewest drawn matches among such a possibility?...
Is it possible to extend the Bellman Ford algorithm to output all shortest simple paths without repeating vertices? The issue is that the Bellman Ford algorithm doesn't make any checks for whether the shortest "paths" it counts have repeating vertices. Also, if one were to keep track of all of these paths, I think it w...
I try to solve a computational problem, but its solution lives on a generalized Venn diagram statement. I was able to obtain its general formula, but now I require some necessary conditions to avoid k combinations evaluation of intersection between sets. The general formula is below, as well as its statement. Statement...
The problem is defined as https://npcomplete.owu.edu/2014/06/10/exact-cover-by-3-sets/: Given a set $X$, with $|X| = 3q$ (so, the size of $X$ is a multiple of $3$), and a collection $C=\{(x_{i1},x_{i2},x_{i3})\}_{i=1}^n$ of 3-element subsets of $X$. Can we find a subset $C’$ of $C$ where every element of $X$ occurs i...
In a card, game opponent places $n$ monster cards onto the board, the $i$th of which has $h_i$ health points. You, in turn, have $m ≥ n$ hero cards in your hand, the $j$th of which deals $d_j$ damage per turn. To begin the game, you will choose $n$ heroes from your hand and assign each of them to a different enemy mon...
I have a test that asks to build a register file using only a single port. The register file should also output 2 values, the read values, and be able to write one. I tried to build it, but ,simply put, I think this is impossible, isn't it? I also have another task , in the very same test, asking me to do the same exac...
I have a list of $n$ variables, exactly $k$ of which should be true. Is it possible to encode this as a 2-SAT problem in time polynomial to $n$ and $k$?
Let there be a list of $n$ elements $S$. Let $T$ be a set with $m$ elements ($m \leq nC2$), with each element in $T$ being a pair of distinct elements of $S$. For $k\geq2$, is there a polynomial-time algorithm to find the number of combinations of length $k$ of the elements of $S$ that at least one of the elements of $...
I've faced this question in my homework and I couldn't provide elegant proof for it. We're given $\Sigma_n=\{1,\dots,n\}$ and a language: $$L_n =\{w\in\Sigma^*_n\ |\ \exists\sigma\in\Sigma_n\ :\ ⋕_\sigma(w)=0\}$$ That is a language that consists of letters from $\Sigma_n$ but doesn't contain all the letters. Question: ...
Let $f$ be a function of 2 variables. Consider $f\colon X \times Y \rightarrow Z$. Let $P_i$ (for $i=1,\ldots,n$) be $n$ probability distributions on $X$, and let $Q$ be a distribution on $Z$. We know that if we choose $X$ according to any of the $P_i$ (the distribution on $Y$ is fixed throughout), $f_{x \leftarrow P_...
While solving This algorithm problem I was unable to come up with condition for the collision to occur ( other than the naive O(n^2) algorithm ) on reading the explanation they say Let’s deepen the observation. For a set of people with the same y coordinate, let’s consider “in what condition does a collision occurs?”...
The complexity class $\mathit{DP}$ is defined as follows: $L \in \mathit{DP}$ if $L = L_1 \cap L_2$ where $L_1 \in \mathit{NP}$ and $L_2 \in \mathit{coNP}$. I'm trying to show that $\mathit{DP} \subseteq \mathit{EXPTIME}$. My idea was as follows: For all $L \in \mathit{DP}$, $L = L_1 \cap L_2$, where $L_1 \in \mathit{N...
I'm looking for a randomised algorithm (specifically an epsilon-delta approximation) which takes as input a graph G, a subgraph T (which is a tree), and outputs an approximation to the total number of copies of T within G. If we are given a colouring of G I think it's a little easier but I don't have any concrete resul...
I have unit intervals given such as $I = \{\{s_1, s_1 + 1\}, ..., \{s_k, s_k+1\}\}$ ($\forall s_i \in \mathbb{R}$). I am given a list of $X$ reals, such that each of the reals belongs to at least one interval. I am asked to suggest a greedy algorithm to minimize the number of intervals required to capture all reals fro...
$$ T(n)=T(\log n)+1 $$ $$ T(n)=\Theta(...) $$ I want to find theta of $T(n)$. I tried the master theorem but failed.
I am trying to construct a DFA with $\Sigma = \{0,1\}$ that accepts $L = (0\mid10)^*$, below is my attempt, but I'm a bit stuck. The quiz marked it wrong since there's no transition from $q_1$ under $1$, but if I add a loop on $q_1$ for $1$ onto itself then I'm not actually accepting $10$, it would be $110$?
I need to show that in any regular graph, taking all nodes gives a 2-approximation vertex cover. My attempt: I am proving that every $k$-regular graph can be reduced to a 2-regular fully connected graph (ring). And then the ring case is trivial. However, I am unable to show that in the actual graph, there was no smalle...
The No Free Lunch theorems for search and optimization demonstrate that for search/optimization problems in a limited search space, where the points being searched through are not resampled, the performance of any two given search algorithms over all possible problems is the same. No Free Lunch for Search/Optimization...
I am given a graph of minimum degree at least 2 (not necessairly regular). I want to prove that there is a way to orient the edges of G such that each node of G has at least one out-going edge. As a hint I have that, in a bipartite graph $(U \biguplus V, E)$ if for every $U' \subseteq U, |N(U')| \geq |U'|$, then there...