instruction
stringlengths
35
29.1k
Consider how one would represent the following image in vector graphics: Pretty simple, right? The entire shape can be represented by a single path element. But suppose additionally that you want to color the heart at the top red. The path element is an open shape, so trying to fill it results in an appropriately re...
I know finite-state machines can be used to solve yes/no kind of problems, such as finding whether a word is in language or not. Can somebody tell me exactly what FSM cannot do and why?
When a DFA is converted into an equivalent NFA, the NFA gives more convenience to many yes/no kind of problems (such as a word belong to a language or not?). I want to know in general at what price this convenience is achieved?
Given a regular language $L$ over a unary alphabet $\Sigma = \{ a \}$. How to decide whether there are two words $w,w' \in L$ such that the length of $w$ is relatively prime to the length of $w'$ ?
Multi-label classification is a machine-learning problem where each sample can have zero or more labels from a closed set of possible labels. This task has applications in several fields. For example, in dialog systems, each sentence that the human says may have several intents, and the classifier should detect all of ...
I am looking for advice in the following optimization problem. I have a website (system) that receives database updates. The updated information is later returned in queries made to the same system. In order to speed up the system the obvious solution is to cache data in each location. I have begun to decompose the tim...
There are n men and n women. I am unable to understand how stable matching done by simply searching through all the matchings takes n! steps i.e., I cannot figure out why there are n! matchings possible.
I have encountered a surprisingly challenging problem arranging a matrix-like (List of Lists) of values subject to the following constraints (or deciding it is not possible): A matrix of m randomly generated rows with up to n distinct values (no repeats within the row) arrange the matrix such that the following holds (...
I would like to check time complexity of two procedures for which I am not totally convinced that I got it right. Now the first procedure is this: public static int c(int n) { int i, j, s = 0; if (n > 1) { for(i = 0; i < n; i*=2) { for(j = n; j > 0; j/=2) { s++; }...
Let $B$ be a recursive enumerable set and $B = W_n$, where $W_n = \{x \in \mathbb N \mid \Phi(x,n)\downarrow\}$ and $\Phi^{(n)}(x_1, \ldots, x_n, y)$ is the value of the function at the terminal snaphot. There is a definition that leaves me really confused: $$n \in W_n \Leftrightarrow \Phi(n,n)\downarrow \Leftrightarro...
I was going through a past paper question but I don't have any answers to know if I'm working out the problems correctly or not. I need to find the time complexity for: i) repeat n:=n div 2; until n=1; ii) for i:=1 to n do begin for j:=1 to n do begin for k:=1 to ...
Let $B = \{z \mid (\exists x)\; P(x,z)\}$ and $P$ be a computable predicate. Show $B$ is a recursive enumerable set. My attempt As $P$ is a computable predicate then there is a program that computes it, therefore $B= \{z \mid (\exists x)(\exists t)\;\text{STP}^{(1)}(x,z,t)\} \Rightarrow B= \{z \mid \Phi(x)\downarrow\} ...
I'm trying to calculate $\text{pred}\, c_0$, where $\text{pred}$ is the previous church encoded number and $c_0$ is the number $0$ ($\lambda s. \lambda z. z$). The formula for $\text{pred}$ is $\lambda n. \lambda s. \lambda z. n (\lambda g. \lambda h. h (g s))(\lambda u.z)(\lambda v.v)$ My $\beta$ reduction looks like ...
Let's say we have an inequality, $p \le {a \choose b}$ where $p$ is a fixed constant and $a, b$ are variables. The problem is that, we are trying to find the minimum $a$ with respect to the inequality $p \le {a \choose b}$. Is there a closed form solution (can be approximate as well/doesn't have to be exact) for that c...
At my university, a degree is "Computer Science and Engineering" but at US universities I understand that the degrees are different so what is the fundamental difference? Is computer engineering lower level like hardware and operating systems while computer science is more like language technologies?
I am a newbie here I recently read tutorials on java about collection framework. The time complexity of various objects in reading/writing data What does it mean? what is O notations? can anyone make me understand these notations and about time complexity measures using these notations
I am trying to figure out the result of the concatenation among different language types (regular, context free, ...). I think the result strongly depends on the nature of the languages which will be concatenated, but I have some doubts on determining the category the result belongs to. Maybe troughout an example it wi...
Does anybody know whether the multiset of the determinants (possibly together with the order of the submatrix they refer to) of all the principal minors of the (symmetric) adjacency matrix of a graph is a complete invariant for graph isomorphism (i.e. that multiset uniquely identifies a graph up to isomorphism)?
I'll phrase my question using an intuitive and rather extreme example: Is the expected compression ratio (using zip compression) of a children's book higher than that of a novel written for adults? I read somewhere that specifically the compression ratio for zip compression can be considered an indicator for the inform...
Given complex number $C=a+ib$, I want to find two complex numbers $C_1=x+iy$ and $C_2=z+iw$ such that $C=C_1*C_2$ (a,b,x,y, z and w are all non zero integers). This problem is at least as hard as Integer factoring. Prime complex number has one as its only factor. Does this problem reduce to integer factoring? Is it NP-...
Let $L = \{xyx \mid \text{ for some }x,y \in \{0,1\}^+\}$. Is this language regular? So I was trying to construct a DFA, but I don't how to do this with this language.
What is the difference between approximation schemes and approximation algorithms? Why do we study approximation schemes?
Say you have n bottles. each with a ratio of $(a_i: b_i: c_i)$. ($a_i/(a_i+b_i+c_i),\cdots$ swap out the numerator for $b_i$ and $c_i$ respectively). Now you are given a ratio of $(a:b:c)$. Use Linear programming to find an efficient algorithm to this problem. If it's yes, you can output the parts of bottles that gave ...
Yesterday I wrote my undergraduate exam in complexity theory. I had to leave off one question, which bugs me since then. Consider: $$ HALF-SAT = \{ \varphi \mid \varphi \text{ is a formula which is satisfied by at least half of all assignments }\} $$ I'd like to know how I can prove NP-hardness. FWIW, here's what I fig...
I'm interested in the first appearance in the CS literature of the data structure described here which is used to answer Range Queries. Although I have come across the same data structure many times with the name segment tree (mostly in algorithmic competition sites), it seems that the same name is also used for this d...
For inclusion to hold between two cache levels L1 and L2 in a multi-level cache hierarchy, which of the following are necessary? L1 must be a write-through cache. L2 must be a write-through cache. The associativity of L2 must be greater than that of L1. The L2 cache must be at least as large as the L1 cache. This was...
At many places I have read that the following language is not a regular, and thus it is impossible to express this in terms of Finite Automata. L={0^i1^i | i>=0} But I tried this as follows. Can somebody explain the fallacy?
In order to use large size page table hierarchical paging is done . In case of two level page table scheme . for : logical address space - 32bit - $2^32$ page size - 4kb i.e $2^12$ It is mentioned that page number is divided evenly : i.e page number p1 - 10 bits page number p2 - 10 bits page offset d - 12bits....
Apart from $2SAT$, what versions of SAT problem is complete for the class NL? Is there dynamic programming algorithm to solve the $2SAT$ Problem?
Part (a): Let $L = \{x \in \{0,1\}^* \mid \#0(x) \neq 4\times\#1(x)\}$, where $\#0(x)$ means the number of 0 in string $x$ and $\#1(x)$ means the number of 1 in string $x$. So I want to use the pumping lemma. But I'm having a hard time choosing a string so that I can show that it is not regular. I've been thinking abo...
I'm trying to understand how Automatic Differentiation (AD) works. For simple algebraic operation, I get the chain rule thing. But, when the code contains conditional statement like 1: test_sign = x*y < 0 2: if test_sign : 3: biggest = max(x,y) 4: else 5: smallest = min(x,y) Does AD work? If it works, can you...
I'm having difficulties understanding lambda calculus, specially identifying what's a redex. Which redexes are there in $\lambda s. \lambda z. (\lambda u. z)(\lambda v. v)$? The book uses $(\lambda u. z) [u \to (\lambda v. v)]$, but isn't $(\lambda s. \lambda z. (\lambda u. z))[s \to (\lambda v. v)]$ valid too?
Is there any formula for computing the number of 5-cycles and 6-cycles in a simple undirected graph?
As I understand it when doing a DFS run when every new node is discovered and edge is added to the DFS tree from the parent of the new node to the new node. If that's the case how are back edges are created?
Suppose we have some regular language $L$, then can we say that $$L_{half} = \{w : \text{for some } z \in L, x \in \Sigma^*, z = wx \wedge |w| = |x| \} $$ is also regular? I have a 'feeling' that it is, but I can't sketch a proof for it.
as the title states, I am trying to figure out if my approach to solving mapping reduction from $E_{TM}$ to some other language is correct. As you surely know, $E_{TM} = \left \{ < M> \mid M \ is \ a \ TM \ such \ that \ L(M)= \emptyset \right \} $. What i am trying to check is whatever a string x is in L(M). My idea i...
Suppose that there is an algorithm which sorts a sequence of $n$ elements $$a_1, a_2, ..., a_n$$ Each of the $a_i$ is chosen with probability $1/k$ from a set of $k$ distinct integer numbers. Is it true, given that $k \to \infty$, that: The probability that any two of incoming sequence elements are equal, tends to $0...
When inserting an item into a splay tree, rotations are performed in pairs based on either a zig-zag or zig-zig pattern. When there is an odd number of rotations to be performed, one could either do the extra rotation beginning at the leaf or save the extra rotation and do it at the root. Does it matter? For example, i...
I'm thinking of an application for diabetics, that, given previous values of blood glucose and insulin dosage, predicts the glucose level for the next few hours. I know a few things about neural networks and perceptrons, but not much. And there are probably whole other worlds of other machine learning methods. So I'd l...
The junta problem is the following: we have a boolean function $f:\{0,1\}^n \to \{0,1\}$ that actually happens to depend on only $k$ of its input variables. Given the value of $f(x)$ for many random values of $x$, we want to identify the $k$ input variables that $f$ actually depends upon. In other words, secretly $f(...
I have already posted this question on Stackoverflow, but I'm starting to think that this is the right place. I have a problem where I am required to associate unique combinations from a set (unique subsets) to a given value. e.g.: Let S={a, b, c, d}, the required data structure should perform the following: Key -> val...
Now I tried tackling this question from different perspectives (and already asked a couple of questions here and there), but perhaps only now can I formulate it well and ask you (since I have no good ideas). Let there be $k, n \in\mathbb{Z_+}$. These are fixed. Consider a set of $k$ integers $S=\{0, 1, 2, ... k-1\}$. W...
We have a tree with $N$ nodes. $N \le 10^5.$ Each node has a value $V$ associated with it. Now we have $Q$ $(\le 10^5)$ queries. There are two types of queries: Q X Y: in this type of query we have to decrement each node of the subtree rooted at $X$ by value $Y$. C X: in this type of query we have to count the number ...
Given a Turing machine $M$, we say that $L(M) \in P$ if the language decided by the machine can be decided by some machine in polynomial time. We say that $M \in P$ if the machine runs in polynomial time. Note that there can be machines that run needlessly long but still decide a language in $P$. By Rice's theorem, we ...
Assume that I have a file that consists of pairs of numbers separated by a space. These numbers are the labels for vertices in my graph. For example: 0 5 0 7 2 3 4 5 1 5 . . . I want to create a graph (adjacency list) by reading this file line-by-line. For each line, I will create an edge between the two vertices. Of ...
I can define any boolean function (I think) using and and not, or using or and not (plus a constant 0 or 1). And I can define or in terms of xor. And then there are nor and nand. So I am wondering: Why are we traditionally taught boolean logic using and, or and not? Is there a "simplest" set of boolean functions th...
I have an array of size $N$ $(N \leq 10^5)$. I need to perform two types of operations on the array. Decrease elements in range $[L,R]$ by $X$. Count the number of negative elements in range $[L,R]$. There are $10^5$ queries. All I can think about is using a segment tree with lazy propagation, but I believe there wou...
This is very much clear to me that an FSM has limited memory (sufficient to store present state). How do I prove that (intutively or otherwise) that a CFL has more memory than a DFA or NFA (thus making a CFL more powerful than FA) ?
library(ggplot2) compress <- function(str) { length(memCompress(paste(rep("a", str), collapse=""), type="bzip2")) / nchar(paste(rep("a", str), collapse="")) } cr <- data.frame(i = 1:10000, r = sapply(1:10000, compress)) ggplot(cr[cr$i>=5000 & cr$i<=10000,], aes(x=i, y=r)) + geom_line() The compression ratio st...
Let $\Sigma = {1,2,3,4}$ . We say that symbol $\sigma $ bonds with symbol $\tau$ if $\sigma = \tau$ of $\sigma = \tau +1$ for even $\sigma$ and $\sigma = \tau -1$ for odd $\sigma$ . In other words , 1 and 2 bond , and 3 and 4 bond (in addition to every number bonding with itself ) . The Pattern bonding ...
Many sites give the Sobel operators as the convolution mask for smoothing an image. However, I haven't found a single site that describes how you can derive the operators from partial first derivatives. If anyone can explain the derivation, I would highly appreciate it.
Wikipedia says that shared memory comes with lots of costs associated with cache coherence costs. But I thought the whole idea of shared memory is that all the CPUs access the same memory? So if one CPU changes that memory then other CPUs would access the same value? It would seem like this would require FEWER cache co...
While reading A.S. Tanenbaum's book "Structured Computer Organization", I had come to this paragraph. The text is about how interpretation of a program works. The other technique is to write a program in L0 that takes programs in L1 as input data and carries them out by examining each instruction in turn and executin...
I was doing dynamic programming exercises and found the Floyd-Warshall algorithm. Apparently it finds all-pairs shortest paths for a graph which can have negative weight edges, but no negative cycles. So, I wonder what's the real world significance of negative weight edges? A plain English explanation would be helpful....
I was given the following code and was told to find the best and worst case running times in big theta notation. (Below is in python) def find(a, target): x = 0 y = len(a) while x < y: m = (x+y)/2 if a[m] < target: x = m+1 elif a[m] > target: y = m el...
Quantified Boolean formulae are the prime examples of problems that are hard for the polynomial hierarchy, i.e., for the $\Pi$ and $\Sigma$ versions of it. However, there is also the $\Delta$ version, defined as $\Delta_{i+1}^{\rm P} := {\rm P}^{\Sigma_i^{\rm P}}$. In particular, $\Delta_2^{\rm P} = {\rm P}^{\rm NP}$. ...
Suppose I have a connected graph with $n$ vertices and $n−1$ edges, that is in form of a tree. Now, I will add the number of vertices in the tree and uniformly randomly select a vertex. I break the graph at this selected vertex, deleting the vertex and the edges connected to it. Now, I again repeat the same thing at al...
Can anyone explain heavy light decomposition of trees or give a resource to read it from? I have already gone through http://ipsc.ksp.sk/2009/real/solutions/l.html which is the best i could find but still could not understand its working completely.
In Haskell, are datatypes converted to the "Church encoding" i.e. folding the data type. For example, given data N = Z | S N in Haskell, it can be converted to its church encoding by foldN Z z s = z foldN (S n) z s = s (foldN z s n) Where if we do foldN m, we get the church encoding: \z s . s ( .... s n ... ) In...
I have this algorithm where: $$ T(n) = \begin{cases} 1 & \text{if}\; n \le 1 \\ T(n/2) + 1 & \text{otherwise} \\ \end{cases} $$ So, evaluating for $T(0), T(1), T(2), T(3), \ldots, T(n)$, I'm getting values like: $$ 1, 1, 2, 2, 3, 3, \ldots, n, n $$ I assume this is twice the sum of $1$ to $n$, that would be the sam...
I am given a system with a segmented paging architecture. Both physical and virtual address spaces contain $2^{16}$ bytes each. The virtual address space is divided in $8$ equal size segments. The page table consist of $2$ byte page table entries. Question 1: What is the minimum page size in bytes so that page tabl...
Suppose you are given an input set $S$ of $n$ numbers, and a black box that if given any sequence of real numbers and an integer $k$ instantly and correctly answers whether there is a subset of input sequence whose sum is exactly $k$. I want to show how to use the black box $O(n)$ times to find a subset of S that adds ...
I've come across this problem in my studies, and I've abstracted it to the more general case here. Given a finite alphabet, what is a regular expression that matches all strings over the alphabet, except one particular finite substring? As an example: Given $\Sigma = \{a, b, c\}$ What is a regular expression that match...
One of my courses introduced the following question: Given the recurrence relation for mergesort: $T(n) = 2T(n/2) + n$ How would the following parameter passing strategies influence the relation and running time of the algorithm: A pointer to the array is passed to the sorting function, The entire array is copied to...
Can someone help me understand the steps in this argument? There is a decision problem that is in $\mathsf{co\text{-}NP}$ (under standard Karp reductions) and is $\mathsf{NP}$-hard with respect to Cook reductions. Does this imply that if it is in $\mathsf{NP}$ then $\mathsf{NP} = \mathsf{co\text{-}NP}$ and if so, why?
Does this property have a name? Given a collection of sets $\mathcal{P}$, for all pairs $A, B\in\mathcal{P}$, either $A\cap B=\emptyset$ or $A\subseteq B$ or $B\subseteq A$. This concept could equally apply to monoids, groups, partial orders or other mathematical structures, with some adjustments to the definitions...
Consider a regular language $L$. Let $D(L)$ be a minimal DFA for $L$ and $N(L)$ be a minimal NFA for $L$ (minimal in the sense of the smallest possible number of states for an automaton that recognizes the given language). Write $|A|$ for the size (number of states) of the automaton $A$. In general, $|N(L)|$ can be a l...
A DRAM that must be given a refresh cycle 64 times per ms.Each refresh requires 150ns,a memory cycle requires 250 ns. What is the approximate percentage of the memory's total operating time must be given to refreshes? Can someone explain how to find the solution?
I am a starting Ph.D. student in computer science, and I am trying to understand some classic game-theory papers, such as those by Nash, Kalai and Smorodinsky. But I find it hard to understand the mathematical parts. It seems that these papers were written by mathematicians, for mathematicians. Can you recommend a bo...
I'm having trouble finding materials on what 'finger search' is, in the context of a red black tree. Even Wikipedia has a very short page about that, could you refer me or explain what kind of search is that.
I want to know that whether which of the following algorithm can be parallelized? Bubble Sort, Insertion Sort, Selection Sort, Shell Sort, Quick Sort, Merge Sort, Radix Sort. Those which can't be, please explain me briefly that how? Or please try to tell me in simple words that what is parallelism in sorting algorithms...
I am playing around with MapReduce and wanted to ask why the map function takes two inputs (key, value)? Why not just pass along the value? Specifically, if you look at the word count example on Wikipedia page you will see that the map function is: function map(String name, String document): // name: document name // ...
In the last section of chapter 3 (page 54) in Probability and Computing: Randomized Algorithms and Probabilistic Analysis by Mitzenmacher and Upfal, a randomized algorithm is discussed for finding the median of a set $S$ of distinct elements in $O(n)$ time. As a substep the algorithm requires sorting a multiset $R$ of ...
I need help with finding out the time complexity of the following algorithm: procedure VeryOdd(integer n): for i from 1 to n do if i is odd then for j from i to n do x = x + 1 for j from 1 to i do y = y + 1 This is my attempt: $$ Loop1 = \Theta(n)$$ $$ Loop2 = \Theta(n)$$ $$ Loop2 = O(n)$$ And we...
I am new to Advanced Algorithms and I have studied various samples on Google and StackExchange. What I understand is: We use $O(\log n)$ complexity when there is division of any $n$ number on each recursion (especially in divide and conquer). I know that for binary search, we have time complexity $O(n \log n)$, I und...
Here is a question that I encountered in one of my exams: Find one context-free grammar that recognizes the language: $\qquad L = \{a^n(b^mc^m)^pd^n \mid m, n, p \geq 0\} $ Can you find such a grammar? I even doubt its existence, but I have not been able to prove that.
I am new to C++ and just learned that "The declaration of a static data member in the member list of a class is not a definition. You must define the static member outside of the class declaration, in namespace scope." I am curious about why this is. Are there particular design advantages to making the rules of the la...
I am working on string searching algorithms that support multiple pattern search. I found two algorithms that seem like the strongest candidates in terms of running time, namely Aho-Corasick and Rabin-Karp. However, I could not find any comprehensive comparison between the two algorithms. Which algorithm is more effi...
Note: I moved this question from stackoverflow.com I have an algorithmic problem where I would like to see if it can be solved in better than $O(n)$: I have given a table $T$ of $n$ elements where each element is a tuple $(s_i, e_i)$ with $s_i, e_i \in \mathbb{N}$ and $s_i < e_i$, i.e. each tuple is some kind of an int...
I have been studying about activity-selection-problem and the solution of greedy choice I came across is to select the activity that finishes in the earliest among the present activities. But surely there are other greedy choices to solve the problem. The one I have been able to figure out is to select the activity tha...
Let $\Sigma = \{0,1\}$. For every word $w \in \Sigma^*$, let $|w|_0$ and $|w|_1$ denote the count of 0's and 1's, respectively, in $w$. Let $L$ be the language $$L = \{ w \in \Sigma^* \mid |w|_0 \gt |w|_1 + 2 \text{ or } |w|_1 \gt |w|_0 + 2\}$$ Prove or disprove whether $L$ is regular.
So I'm reading Introductions to Algorithms and sometimes I wish it would be a little bit more friendly with how it explains topics. One of these topics is proving big-theta. I understand that the definition of $\Theta$ is as follows: $\Theta(g(n)) = f(n)$ if there exists positive constants $c_1$, $c_2$, and $n_0$ su...
Given languages X, Y and Z, each with alphabet, define X/Y/Z as: X/Y/Z = { w ∈ Σ* | ∃u ∈ Y and ∃v ∈ Z; such that wuv ∈ X }. Prove that if X is context-free, and Y and Z are regular, then X/Y/Z is context-free.
I am trying to solve the Problem CTRICK on SPOJ. I have an $O(n^2)$ solution that is giving “Time Limit Exceeded”. After browsing for some hints, I found that it can be solved using Interval Trees. But I have no idea, how to think it that way. Here is the problem: The magician shuffles a small pack of cards, holds it f...
Given languages A,B and C, each with alphabet Σ, define A/B/C as A/B/C = { w∈Σ* | ∃u ∈ B and ∃v ∈ C; such that wuv ∈ A }. Prove that if A is context-free, and B and C are regular, then A/B/C is context-free.
For example if $$ f(x)= \Theta (g(x)) $$ from the definition of the theta notation, there exist c1 and c2 constants such that $$c_1 g(x) \le f(x) \le c_2 g(x)$$ then if only we took the constants $1/c_1$ and $1/c_2$ we could say from the definition that $$ g(x)= \Theta (f(x)) $$ Right?
Suppose an algorithm has a runtime recurrence relation: $ T(n) = \left\{ \begin{array}{lr} g(n)+T(n-1) + T(\lfloor\delta n\rfloor ) & : n \ge n_0\\ f(n) & : n < n_0 \end{array} \right. $ for some constant $0 < \delta < 1$. Assume that $g$ is polynomial in $n$, perhaps quadratic. Most like...
This is not homework. I have the solution but it's not what I'm getting. I know there are multiple solutions to the problem but I want to make sure that I'm not missing anything. The question is as follows: Prove that 2$n^2$ - 4n + 7 = Θ ($n^2$). give the values of the constants and show your work. Here is how I ...
I already have a solution for this problem but it's just not making sense to me. Here is the problem (It's from Introduction to Algorithms by CLRS found in CH.4): Show $T(n) = 2T(\lfloor n/2 \rfloor +17)+n$ is $O(n \log n)$ This is what I have so far: So Assume $T(k) \leq cn\lg n$, for $k<n$. $\qquad \begin{align...
Question from Artificial Intelligenge: A Modern Approach by Russell and Norvig (Exercise 2.1). Suppose that the performance measure is concerned with just the first $T$ time steps of the environment and ignores everything thereafter. Show that a rational agent's action may depend not just on the state of the env...
I am trying to modify the Floyd-Warshall algorithm to find all-pairs minimax paths in a graph. (That is, the shortest length paths such that the maximum edge weight along a path is minimized.) Floyd-Warshall algorithm contains the following loop to enhance the distance (ds) and the next vertex (ns) matrices at each ite...
I'm looking for an algorithm that provides a canonical string for a given colored graph. Ie. an algorithm that returns a string for a graph, such that two graphs get the same string if and only if they are isomorphic. In particular, I'm looking for a simple algorithm that is easy to implement with a reasonable perform...
Given a program consisting of variables and instructions which modify these variables, and a synchronization primitive (a monitor, mutex, java's synchronized or C#'s lock), is it possible to prove that such a program is thread safe? Is there even a formal model for describing things like thread safety or racing condit...
I am looking for some graph theory concepts and definitions around embedding a DAG into another DAG. I could only find a few lines on Wikipedia around this so I wonder if someone can help me find good references for the important concepts and definitions. For example, assume I have a DAG $G=(E,V)$ where there are two ...
It seems that factoring a number known to be composite is in its own interesting little complexity class, e.g. polynomial time using quantum computing even though no one has proved $\mathsf{P} = \mathsf{NP}$ for quantum computing. Are there interesting, non-obvious examples of problems with polynomial-time verifiabili...
I am writing a compiler for my programming language (both almost complete), but they are stuck in the, I would call, "String vs List-of-Char dilemma". Maybe some more experienced compiler programmer could help. It is a functional, strongly typed (with inference) and almost pure (immutable vars) language. As I could per...
We started learning recurrences and I am having trouble with some of the problems. Our professor is having us substitute in $n=2^m$ and $S(m)=T(2^m)$ then writing down equations and summing them all up. I understand the substitution part, but not how to simplify the end result. One of the problems I am stuck on is $T(n...
I read about post-selection and didn't understand the meaning behind this thing. I didn't understand the Wikipedia article well, so what is a simple but understandable explanation of post-selection and how to use it in complexity?
I'm currently taking a numerical analysis class in college and we're covering floating point systems. For the most part, I have a good grasp on it. However, something I can't seem to visualize, and haven't seen any totally lucid explanations about after searching extensively, is spacing between floating point numbers. ...
I've seen two different lambda expressions for the logical NOT function. One of them just applies its parameter to constants true and false internally in a reverse order: $NOT \;\;=\;\; \lambda x.\; x \; \mbox{false}\; \mbox{true} \;\;=\;\; \lambda x. \; x \; (\lambda t.\lambda f.f) \; (\lambda t. \lambda f. t ) $ and ...