instruction
stringlengths
35
29.1k
In class, professor mentions that there are Stream and Storage devices. I mean to ask about Stream devices. I've also heard the terminology character devices. On a Linux VM, the corresponding terminal devices can be seen via the proc file system: $ ls -l /proc/$$/fd total 0 lrwx------ ... ... ... 0 -> /dev/tty1 lrwx---...
I have a data (from simulations) that is coming from something similar to a bifurcation diagram: it is a lower hemicontinuous correspondence (actually limit points of each branch is included), or in other words a set-valued function mapping a point in the domain to a (non-empty) set in the codomain such that the set is...
I'm learning some computer science and mathematics by myself. I know that proving theorems in ZFC is undecidable in general, but, is there a formal way to express how complex it is? Is it as complex as the Halting Problem, i.e., knowing if a TM halts? Where can I learn more of this (subjects, books, articles)? Let me k...
Here is a very closely related, but NOT a duplicate question. One time, I decided to test how long it takes to compute $2^x$ compared to $e^x$ in Python. I expected $2^x$ to be faster as in binary, the base computers use, you can just append 0 to the number 1 $x$ times. I entered into Python IDLE (Python's Integrated D...
While removing null production from cfg as below, S->ABC A->aA|^ B->bB|^ C->aaC|^ now as shown above we know that A,B and C all are nullable that makes S also nullable. like I'd do as below: S->ABC|AB|AC|BC|A|B|C|^ A->aA|a B->bB|b C->aaC|aa The question is how do I remove null from S? I tried ...
I am trying to understand two player (prover-Merlin and verifier-Arthur) interactive proof complexity classes and had a few doubts. As I understand, the classes $MA$ and $AM$ involve two players, where Merlin tries to convince Arthur about solution to a problem by sending messages such that if the proof is correct Merl...
I have the following virtual address: +---------+----------+----------+ + 7 Bit x | 13 Bit y | Offset d + +---------+----------+----------+ I now have the following task: 1. Of how many pages consists the virtual address space? 2. What size has one page? 3. How much memory can be addressed by one entry in the page tab...
How can I prove that !(ab)(!a+b)(!b+b)=!a* in boolean algebra? This is an exercise from a past paper of my teacher but I can't really find the way to the answer. I would appreciate some help.
How do single and multiple dispatch differ? In particular, I am wondering why some programming languages, both interpreted and compiled (such as Python and Java), natively support single dispatch but not multiple dispatch. Possibly a bit naive to think so, but isn't multiple dispatch a straight-forward generalization o...
My CNF file ends with many pairs of clauses that represent that two variables are equivalent (eg: -3 7, 3 -7, 5 -11, -5 11, etc.). Do most SAT solvers automatically pre-process these and replace every occurrence of one variable by the other (eg: replace every 7 by 3, and every 11 by 5), or should I first do the replace...
Let $X_1,...X_T$ be i.i.d. random variables supported on the $[-1,1]$ segment, with an expected value of 0 and positive variance. Let $H_t = | \sum_{i=1}^t X_i|$, and let $H = \max_{1\leq t\leq T} H_t$. I'm interested in lower bounds on $\mathbb E[H_T]$ and $\mathbb E[H]$. Any ideas? Using Jensen's inequality, upper b...
I came across this definition in my book but I'm not sure that I understand it correctly. Isn't this the same as saying: $\langle S, s\rangle \rightarrow s = \langle S, s\rangle \rightarrow s$ implies that $s=s$? Why do they use a different prime symbol here even though they are the same statement $S$ being executed ...
The Maximum Acyclic Subgraph (MAS) problem is: Given a directed graph $G = (V, E)$, find the largest subset of edges which are acyclic. In this paper the authors state the following algorithm: A simple randomized algorithm achieves a factor 1/2 for this problem: Simply pick a random ordering of the vertices. In fact...
At work I'm looking for a data structure that supports the following operations: $$insert(X, A, B)$$ $$delete(X)$$ $$glb(C)$$ $insert$ adds the range $[A, B)$ into the data structure with value $X$ associated with it AND shifts all ranges after (exclusive) $A$ by $B - A$. $delete$ removes the range associated with $X$....
Sorry for making up a name for the thing, the main reason for posting this question is that I can't find out the name of the problem that i'm thinking about. I was messing around with min/max DP stuff, and when looking at a knapsack problem I wondered if you could apply DP if each item affected the total value of the o...
Let $M=\left\langle Q, \Sigma, \Gamma, \delta_M, q_0, q_{a c c}, q_{r e j}\right\rangle$ be a TM whose reading head can only move to the right. Prove that $L(M) \in R E G$. For simplicity you may assume first that for all $q \in Q$ it holds that $\delta_M(q, \sqcup) \in\left\{q_{a c c}, q_{r e j}\right\} \times \Gamma ...
I'm working on implementing a puzzle board game called Double-Choco published by Nikoli magazine Where the board is a 2-dimensional matrix with cells that are either white or gray. The goal is to divide the grid into blocks by drawing solid lines over the dotted lines. Each block must contain a pair of areas of white c...
Suppose I have an acyclic directed graph of Nodes which subscribe to Events. When an Event callback is activated for some Node, the Node's internal update() method is called. Then, because the Node has updated(), it needs to call all of the Nodes it is pointing to and tell them to update() as well, and this process rep...
My objective: is to have a robot follow me. (I'm using an arduiono bot for this) So I started off what some code that wasn't so dynamic. Essentially I had no issues with the robot following me (holding a cardboard because these robots need a good flat surface to see) when I was right in front of it, but when it turned ...
The following post discussed how to convert(approximate) NURBS curve into cubic Bézier curve: Convert NURBS curve into Cubic Bezier Curve I am trying to come up with an algorithm that converts(approximates) NURBS surface into cubic Bézier surfaces(patches), here is my thought(from the post): convert NURBS to piecewise...
I want to define a DPDA based on a set of rules: one or more uppercase letters ('A'-'Z') is a formula. one or more lowercase letters ('a'-'z') is a formula. if X and Y are formulas, then this is a formula: X followed by '&' followed by Y. if X is a formula, then this is a formula: 'μ' followed by one or more lowercase ...
I've run across an interesting problem at work that I'm not quite sure how to grapple. Broadly, there is a suite of of $n$ tests to ensure the quality of a product. However, the tests are both time-intensive and frequently run so it's necessary to tradeoff confidence for performance. Approach 1: knapsack For any test $...
The method to get the sat result is kind of straightforward, you can use some search algorithms like heuristic search to get a solution. But how does z3 get the unsat result like x < 2 && x > 2 I searched for some articles related to z3 but didn't don't know how. I would be very grateful if someone could give me the an...
When hand-manipulating algebra DNF (sum of products) is easier than CNF (product of sums). Possibly because factoring is more difficult than expanding. So why is it the opposite for computational boolean algebra? Perhaps one argument is that in CNF one can show that an expression is false by showing that one clause is ...
In the (unweighted) minimum k-cut problem, the goal is to partition the nodes in a given graph to at least $k$ subsets, such that the number of edges between different subsets is as small as possible. I am interested in a variant in which the number of subsets is not fixed in advance, but there can be at most $t$ verti...
I have an easy question about the DPDA. Could you read an input and push a different symbol to the stack. An example would be A transition from q1 to q2 where read input is v pop is epsilon(empty string) and push is x Both v and x are symbols
Give a real world, normalized example where table T1 has primary key (A, B), T2 has primary key (B, C) and T3 has primary key (A, C) and table 4 has a primary key (A, B, C) where (A,B) is a foregin key on T1, (B, C) is a foregin key on T2, and (A, C) is a foregin key on T3? The motivation is this form is allowed in a r...
r1 and r2 both are assigned 0.05 initially. If r1 is incremented by 0.01 in this way "r1 = r1 +0.01" we have 0.060000000000000005 as answer not 0.06.
I think the best way to explain my question would be to have sextuple (regular, context-free, Turing-recognisable, decidable, P, NP).were you fill out 1 for promblem which lies into that section, would an np problem such as chess be only 1 for NP or would also fall in decidable? Some other examples: The regular problem...
Let's say we have boolean functions $f_1, \cdots, f_n$, each of which operates on pairwise disjoint variables (i.e. the variables for each function are unique to that function). Then, how can we show that $L(f_1 \oplus \cdots \oplus f_n) \geq \frac{1}{2}\sum_{i = 1}^n L(f_i)$ (where we use the De Morgan basis)? Here, w...
They say that protein folding is an NP-hard problem, meaning that if we could figure out how any protein folds, we could solve any NP problem in polynomial time. However, doesn't this basically destroy the field of cryptography? Suppose I want to factor a large semiprime. Couldn't I convert it into a protein folding pr...
I am digitizing my old books and I was wondering if I needed to buy OCR software, or if the OCR software that came with my printer (Epson) would be sufficient. This made me wonder if there were any programs or software that tests the accuracy of OCR. I imagine the way this would work is you would manually enter all the...
I understand how backpatching works during intermediate code generation, but I do not understand why it is needed. A common argument for using backpatching during intermediate code generation is as follows: Suppose the intermediate code generated is: goto L1 ... L1: When goto L1 is generated, the actual address of t...
I have a computer architecture exam tomorrow and my professor gave us some questions for practice. I just need to clear some confusions. The first question is: "a) In a Direct-Mapped Cache, modify the following Page-to-Cache address translation circuitry (attached with the post) if the Page Capacity is 1 KiWords and C...
If there is no calculus,we can't solve a problem like “surface area”. Is there some math problem that can be solved thanks to category theory? If there is no such math problem, it means that category theory is an “abstract theory”:it can explain things clearly, but without it, man can solve the same problems too, maybe...
I have a question about the DPDA. Is it possibly to have two transitions that read the same input but do different in the stack? An example would be A transition from q1 to q2 where I read input ( pop v and push nothing to the stack. And the second transition is from q1 to q3 where I read input ( pop x and push nothing...
We consider languages over the alphabet {a,b,c}. Given a character t in the alphabet and a non-negative integer j, by t^j we mean the string consisting of exactly j occurrences of t. Now let m be an unknown but fixed positive integer in the following language definitions: L1 = { a^n a^n | n <= m } L2 = { a^n b^m | n > ...
I'm doing Neural Architecture Search (NAS) by varying the number of layers and neurons per layer for a neural network (connections are feed-forward throughout), and then training it on a fixed task to test its performance. The end goal is to perform topological data analysis (TDA) on the best and worst architectures (g...
I know that by definition, all NP problems can be reduced to NP-Complete problems. But does that also applies the other way around? Can all NP-Complete be reduced to NP problems? My understanding is that it cannot be done, since that would mean that both are equally complex, therefore NP=NP-Complete. But the answer to ...
I want to prove that if a graph is 2-vertex-connected, then it can be produced by $K_3$ (the simple triangle), using only edge division ("splitting" an edge, $(u,v)$, by creating a new vertex, $x$, deleting the edge $(u,v)$ and adding the edges $(u,x),(x,v)$) and edge addition (just adding any edge). I want to prove th...
Can you enumerate the set of all words over a finite alphabet?
I have a list of $n$ items, where each item gives a score to every other item, so I get a $n\times n$ square matrix $M$ of scores. Each score is a natural number. Items also score themselves. Example for $n=4$: $$ \begin{array}{c|lcr} scores & A & B & C & D \\ \hline A & 3 & 3 & 9 & 11 \\ B & 7 & 1 & 12 & 5 \\ C & 11 &...
I need to create a randomized function between two participants, 1 and 2. The two participants have both n bit sized strings, and they want to determine whatever they have the same strings. 1 and 2 can communicate using only log(n) bits. The probability of error should be at most 1/3, but the function can be run multip...
I came across a modification of the classic house robber problem where there is a cost to robbing each house, and we want to maximize the amount robbed using the array (exactly as in the original problem) but with the added constraint that we now have some array C, and C[i] is the cost to rob a particular house. We do...
A colleague and I with pretty low-grade practical backgrounds decided it's time to try learning theory. This question is asked in a slide-deck he tracked down somewhere or another online without an answer to go with it. We're both leaning towards a simple disproof by Counter-Example: $A = \{a,b\}$ $B = \{ab,a,b\}$ But ...
I hope this is the correct subpage of SE, if not please direct me to the more appropriate place. Imagine the following scenario: You are put into a random but known position inside a given maze. The maze contains, in addition to walls (█) and pathways (.), the following things: R - A refresh point which is single use ...
K = {<J, a, b, c> : J is a Java program, a, b, and c are integer variables declared in J, and throughout the execution of J, a never has the same value as b and a never has the same value as c}. I'm aware the problem is not actually decidable as I performed a reduction from ATM (or halting problem), which proves it is ...
Suppose I have already sorted an array $a$ of length $N$, each element having its position index into the sorted result recorded together with the element. Now I randomly sampled a sub-array $b$ of the original array $a$ without putting back (that is, no duplicated elements). Since the position index is recorded togeth...
I found the following question in my book and I have no clue on what the answer should be: What is the condition on search graph so that BFS Algorithm for graph and BFS Algorithm for tree generate and expand identical nodes in the same order? Please Note you don't have to write a proof as I will prove it myself and p...
Although I understand the definition of batch processing (a method of running software programs called jobs in batches automatically) and some applications of this system (bank statements and payroll and timesheet processing), how do emails use this system? I saw that emails use this system, but how are emails done in ...
$FPT$ is the set of parameterized problems that are fixed-parameter tractable. If $L_{w,h}$ is the language associated to boolean circuits of weft $w$ and depth $h$, then $W[t]$ is the set of parameterized problems that can be fixed-parameter reduced to $L_{t,h}$ for some constant $h$. (I know that there are multiple e...
I want to find how many shortest paths are there from Node A to node B. For example, let's say we have a graph with 3 nodes and 3 connections: from 1 to 2 weight 5 from 1 to 3 weight 11 from 2 to 3 weight 6 The answer is 2. Also I should keep track what vertices were visited for every path. In the example above, I woul...
I would like to know if there exist some complexity classes that are defined according to the integrality gap of their problems? In particular, is there a class of problems for which their integrality gap is unbounded? Where by unbounded integrality gap, I mean an integrality gap that is equal to infinite, where the va...
From OSTEP Chp. 43: The imap is a structure that takes an inode number as input and produces the disk address of the most recent version of the inode This makes sense to me as a solution to the problem of LFS scattering needing to keep track of inodes. It could live on a fixed part of the disk, of course. Unfortunat...
Let's say we're some function problem, $R \subseteq \Sigma^* \times \Sigma^*$, where $\Sigma = \{0, 1\}$ and some oracle $O_R$ that solves $R$. Now, we're given some language, $L \subseteq \Sigma^*$ and an associated oracle $O_L$ that solves $L$. We say $R =_{poly} L$ if a machine equipped with $O_L$ can solve $R$ AND ...
Algorithm fairness is the field of research aimed at understanding and correcting biases like these. It is at the intersection of machine learning and ethics. Specifically, the field includes: Researching the causes of bias in data and algorithms. There are several ways to define fairness. I am interested in the indivi...
You want to organize a party and invite as many of your N friends as possible so that the following condition is met: at a party, everyone invited must know at least three other guests and must not be familiar with at least three other guests. The input to the problem is number N and the list of pairs (i, j) where i an...
My lecture notes for $T$-joins states: If $T = V$ then $T$ -joins of cardinality $V/2$ are exactly the perfect matchings of $G$ = $(V ,E)$. So, the minimum weight perfect matching problem can be reduced to the minimum weight $T$ -join problem by adding a large constant to each edge weight (to get a degree of 1 for eac...
"Abstract": I have recently crafted a new algorithm for constructing code trees which I believe are optimal (the same thing that is constructed using Huffman's algorithm, at Wikipedia). It is based on one observation which is in form of an illegal property (i.e. code trees with that property are not optimal) and severa...
I have a question about an "apparent" contradiction I found in my lesson notes on Application Order Reduction (AOR) and the Church-Rosser Theorem (CRT). I'd like to emphasize that I'm not suggesting there's a real contradiction, and it is most certainly just my lack of understanding of CRT at issue. Ok here goes. The C...
I know this post. But I still have no idea to adapt the bucket sort algorithm to handle input with a gaussian / normal distribution. Can someone provide me a Pseudocode / Python code for that? So far I tried the following, but sadly it does not work, and I don't understand why. def bucket_sort(numbers): mean = sum(...
I want to learn more about parsing techniques, and to do that I'd like to start with the simplest algorithm, understand its limitations, and progress from there. From what I've seen, the best candidate so far is LL(1). Is this correct?
Find a Grammar G, so that L(G) = {a^i b^j c^k | k = i*j ;i, j ≥ 1} Hello, I have difficulties solving this. I had a similar exercise, where the k was i+j, which was easier, because the solution was to just add a c for every a or b. But I am having real trouble with this one. I am guessing Cfgs wouldnt be enough here, b...
I have seen a proof by contradiction for the uncomputability of Kolmogorov complexity. The idea the basically the same as in the proof for halting problem (i.e., there are cases that lead to Berry paradox example). However, I would argue that since there are infinitely possible ways to interpret a given string, this fa...
Given a string of characters (say a, b, ...) I want to wrap those characters by tags <a>...</a>, <b>...</b>, and so on, so that for each character the innermost tag wrapping the character should match with it. For instance, considering a string aabbaaca, we may have <a>aa</a><b>bb</b><a>aa</a><c>c</c><a>a</a> (naive w...
I have read the series of papers about "the structure of claw-free graphs" (https://doi.org/10.1016/j.jctb.2008.03.002). Here the authors used the trigraph, that is the adjacency relation contains three types: 1 strong adjacent, 2 strong non-adjacent, and 3 semi-adjacent. If two vertices $u$ and $v$ are strong adjacen...
Is there anything known about the hardness of Vertex Cover on the subclass of comparability graphs? In particular, is it known whether the problem is still NP-hard? Related Results: In "Modular decomposition and transitive orientation, McConnell & Spinrad, 1999" the authors show that the problem lies in P for co-compar...
We are given an array of size $n$ (it is not specified if we have an integer array, a specific range or any other assumptions), which might be unsorted, and a real number as a constant $k<1$. We need to prove or disprove that it is possible to output the $\lfloor n^k \rfloor$ smallest elements of a sorted order, in $O...
In PRIMES IS IN P paper, page 6 under Time Complexity section, authors have mentioned "In these calculations we use the fact that addition, multiplication, and division operations between two m bits numbers can be performed in time O∼(m)". What is O~(m)? -I am aware of O(m) notation. How is multiplication and division ...
Given a set of input strings, how do I find a shortest string S so that all input strings appear as a substring of S? for example: foobar + bar -> foobar foo + bar + rfo -> barfoo I guess it's related to graphs, but don't know how to solve it. first check all the "substrings", for example, "bar" to "foobar". Remove "...
I'm doing a review of sorting algorithms and trying to self-learn how to prove them as well. The foundation of the quicksort proof is intuitive enough if I'm assuming that the recursion holds - but you also need to assume that the partitioning algorithm works as well. I'm having trouble approaching an inductive proof f...
Suppose $2$ bits are used to encode a message, A and B. If you know $A$ is $1$, you have one bit of information. If you know $A\land B$ is $1$, you have two bits of information. If you know $A\land B$ is $0$, you have $0.415$ bits of information. When is this number ever useful? P.S: The formula for calculating the i...
I'm trying to create a game but I am having some difficulties in coming up with a suitable algorithm for my problem. I have elements from 1 to n and I am trying to cover all of the elements using the minimum amount of elements as possible. Each element can cover an amount of elements to the left (x direction) and an am...
There is a number of questions on this website about the reversal of regular languages: Closure under reversal of regular languages: Proof using Automata Proving that the reversal of a language reversal is that language etc. I was wondering what was this concept useful for. Does the fact that the reversal of a regula...
So I need to design an algorithm for the following problem: Suppose we need to build an optical fibre network for 20 cities. We are given a distance matrix of the cities which tells us which cities are connected so that we can make a connection between them and a cost matrix which tells us how much each connection cost...
Over the alphabet $\Sigma=\{0,\ldots,9,/\}$, is the following language regular: $$L=\left\{x/y/z:z=\mathrm{str}\bigl(\mathrm{int}(x)+\mathrm{int}(y)\bigr)\right\}$$ where $\mathrm{str}$ maps an integer to its decimal representation, and $\mathrm{int}$ does the opposite thing. It contains $0/0/0$, $10/34/44$, $1/999/100...
Let $A$ be a language and define $$ CYCLE(A)= \{ yx | xy \in A \} $$ I need to prove, or disprove, $ A\in LSPACE \Longrightarrow CYCLE(A)\in LSPACE $. First I tried to prove $CYCLE(A) \le_{L} A$ which if true means that if $A\in LSPACE$ then $CYCLE(A)\in L$, hence I tried to define a log space transducer $M$ that compu...
I'm starting to think there's no possible solution to this problem, but before jumping to conclusions I want to confirm it with collective knowledge. Let's imagine that there's a 2D grid, where S units need to go to T points, but the caveat is that going through a known/explored path has a lower cost than going through...
Several algorithms for sparsest cut (and other kinds of balanced cuts) in planar graphs have been published, like for instance: Finding minimum-quotient cuts in planar graphs, James K. Park, Cynthia A. Phillips, 1993 Sparsest cut in planar graphs, maximum concurrent flows and their connections with the max-cut problem...
How should I go about creating a single-tape Turing machine for the following language: $$ x_{1,2} = \bigl\{ (a\#b) \mid (a,b) \in \{0,1\}^* \text{and a is a substring of b or a is equal to b} \bigl\} $$ Some strings that should be accepted are: 10#11011 1101#1011010101 000#1001011000 111#111 Some strings that shoul...
I need to construct a Markov algorithm as a set of an ordered rules which will recognize a language $L = \{ww |w \in \{a,b\}*\}$ and give $$\begin{cases} Y, \: \text{if given word is in L} \\ N, \: otherwise. \end{cases}$$ Is there a solution for this problem? UPD. Omitting the formalities Markov Algorithm is an order...
I came across this problem while studying the FFT, but I have no idea how to solve it. Can anyone help?
Refers to: https://en.wikipedia.org/wiki/One_of_These_Things_(Is_Not_Like_the_Others) Some of the actual games The idea is that there are four different objects, but one in particular stands out from the rest. I've always said that I didn't think AI would ever be able to this, that this is something that kids instinctu...
I need to prove or disprove that for all languages in $R$ there is a reduction to all languages in $P(Σ^*)\backslash RE$. And I'm having trouble to figuring out the solution, especially with dealing with the trivial cases.
When my professor introduced regular expressions, he said that the empty string is the simplest regular expression, where it matches everything. How can this be true? I would think the empty string matches nothing, but perhaps I have an incorrect Computer Science understanding of what "null" or "empty" means.
I'm taking some college courses and they have so much math. Why is that? I'm very good with computers already software and a little bit of hardware and I fix other laptops/Desktops Linux Boxes, Macs etc.. Is this normal or is it just a requirement to get a good job?
Let $P$ be a constraint satisfaction problem with $n$ variables, each with the same finite domain $D$, and with $m$ > 0 constraints, where each constraint is an $AllDifferent$ constraint of arity $k$, for some fixed $k ≥ 2$ I'm trying to prove/disprove the following statements: If $|D|$ is equal to the treewidth of th...
My problem of understanding is how to create a new a before the b's if you create new c's. Hopefully someone can help me out.
I am trying to look answer for this question of toc please help me find the answer. The question is : Construct epsilon NFA(Non deterministic finite automata) for regular expression (0+1)*1(0+1)
Given a graph $G=(V,E)$ and any edge $(u,v) \in E$, let us denote by $G_{(u,v)}=(V,E\setminus\{(u,v)\})$ obtained from $G$ by removing this edge. I am interested in the difference between the average distance in $G$ and $G_{(u,v)}$ (or equivalently the sum of all distances in these graphs). This value is a feature of t...
Consider the following algorithm $A$ to 6-color an rooted tree within $\log^{*}n$ rounds in a distributed system: 1: Assume that initially the nodes have IDs of size $\log(n)$ bits 2: The root is assigned the label $0$, and each other node $v$ is assigned $c(v) = ID_v$ 3: Each other node $v$ executes the following: 3.1...
Here is the Question : The hit ratio is the percentage of times that a page number is found in the Translation look-aside buffer (TLB). An 80% hit ratio means that we find the desired page number in the TLB 80% of the time. Suppose we have a hit ratio of 70% and 40 ns is needed for TLB, where main memory access time is...
I have the following problem and I am wondering if it is NP Hard or not. Let $A$ be a binary matrix whose rows and columns are indexed by the sets $\mathcal{I}=1,...,m$ and $\mathcal{J}=1,...,n$. A rectangle is a set $R=I\times J$ with $I\subseteq\mathcal{I}$, $J\subseteq\mathcal{J}$ and its value is defined by $$f(R) ...
Trying to solve the zero-sum problem described here, where two opponent players at each turn can choose to collect 1, 2 or 3 stones with different values, with the objective of getting more points at the end of the game (and assuming each player is playing optimally). All presented solutions based on recursion suggest ...
We need to partition an undirected graph into connected subgraphs of size between $2$ and $k$, where $k$ is an integer. When $k=2$, the problem is equivalent to the perfect matching problem which is known to be solvable in polynomial time. When $k=3$, the problem is similar to the partition into triangles problem, whic...
Define: RE = {L : L is recognizable by a TM}, R = {L : L is decidable by a TM}, and coRE = {L : L-complement is recognizable by a TM}. The question is: Does the complement of coRE equal RE? I know that the answer is false, but I'm not sure why my proof is wrong:
There is a well-known problem of the best time to buy and sell stock. Assume now we have two arrays, SELL and BUY. Each time SELL[i] > BUY[i]. Assume we have initial budget B, and we can buy any amount of stock bounded by our budget. We want to determine the maximum profit we can reach using the best strategy. I've tri...
I've lately been struggling to write correctness proofs for various algorithms, even when it is "obvious" to me that the algorithm works and is correct. For example, take the following problem: Given a binary string $s$ of length $n$, you can perform an invert operation on index $i$ (0-indexed) which inverts the prefix...
Consider the language $$E_{T M}=\{\langle M\rangle: L(M)=\emptyset\}.$$ Prove that $E_{T M} \in \text{coRE} \backslash\text{R}.$ I proved that $$E_{T M} \in\text{coRE}$$ using Turing machine I built which recognizes the completement of the language. What left is to show that it is not in $$ R$$ Any suggestions how can ...
Suppose we have $N$ points on $XY$ plane, ie. $(x, y)$ and $x, y \in Z$ and multiple queries where each query is of the form $y = mx + c$ and $m, c \in Z$. Is it possible to count number of points that lie on the given line more efficiently than $O(N)$ per query? I believe some preprocessing might help or some data str...