instruction
stringlengths
35
29.1k
T (n) = T(√n) + 1 The easy way to do this is with a change of variables. Let m = lg n and S(m) = T (2^m). T(2^m) = T (2^(m/2)) + 1 S(m) = S(m/2) + 1 Can any one explain why 1 and 2 are same and this works ??
Algorithms for the finding of an MST in a graph can be applied for both maximum and minimum spanning trees. It is well known, however, that the finding of a max-cut in a graph is an NP-hard problem while the min-cut problem can be easily solved in polynomial time. Why aren't the two equivalent? What is the restriction...
Context-free languages are not closed under complementation. In the lectures we have been given the same argument as here on Wikipedia: For $$A = \{\mathtt a^n \mathtt b^n \mathtt c^m;~m, n ∈ ℕ_0\}\quad\text{and}\quad B = \{\mathtt a^m \mathtt b^n \mathtt c^n;~m, n ∈ ℕ_0\},$$ both $A$ and $B$ are context-free, but thei...
The PARTITION problem is NP-complete: INSTANCE: finite set $A$ and a size $s(a) \in \mathbb{Z}^+$ for each $a \in A$ QUESTION: Is there a subset $A' \subseteq A$ such that $\sum_{a \in A'} s(a) = \sum_{a \in A \setminus A'} s(a)$ The problem remains NP-complete even if the elements are ordered as $a_1,a_2,...,a_{2n}$ ...
Consider an instance of TCP’s Additive Increase Multiplicative Decrease(AIMD) algorithm where the window size at the start of the slow start phase is 2 MSS and the threshold at the start of the first transmission is 8 MSS. Assume that a time out occurs during the fifth transmission. Find the congestion window size at t...
Given two sets A and B of sizes |A| = n and |B| = m, where m >= n. There are edges from set A to set B. I need to find the number of matchings where all of vertices in set A have been matched with one vertex in set B. Is it possible to caclulate this quantity ? (I have very little knowledge of Graph Thory and Bipartite...
I have got some equipment of standard lengths, say: equipment_lengths = {60, 48, 36, 29} that I have to place on a given length of, say 100. I have to place this equipment so as to minimize material waste while covering the given length. I am allowed to exceed the given length of 100 but keep the excess minimized. ...
Suppose we are given matrices $A_1, \ldots, A_k$ which are $n \times n$ matrices with rational entries and are asked to determine whether the polynomial ${\rm det}(\alpha_1 A_1 + \alpha_2 A_2 + \cdots + \alpha_k A_k)$ is identically zero. How can we do this deterministically in polynomial time in $n$ and $k$? I'm aware...
I am looking for a reference for the following theorem: Let $G$ be a bipartite graph with partitions $X$ and $Y$, each with the same number of vertices ($n$). There is a nonempty subset $Y_1 \subseteq Y$, and a partition of $X$ to disjoint subsets $X_1$ and $X_2$, such that: There is a complete matching between $X_1$ ...
As described in this paper, you can use an pre-computed automaton to speed up an Earley parse. I'm not interested in the rigorous proof of this, but just how the basic algorithm works so that I can implement it. Understanding this paper on my own would take a long long time, and I don't think it's justified for this ...
This question was asked in the onsite regionals for ACM ICPC 2013 at Amritapuri. In short, the question asked to find the number of ways to fill a $ 2\times N$ grid with $M$ colors such that no two cells with the same row or same column have the same color. The limits given are $1 \leq N$, and $M \leq 1000$ with 1000 t...
I know that standard Bloom Filters only have operations like inserting elements and checking if an element belongs to filter, but are also some modification of Bloom filters which enable a delete operation--for example: counting Bloom filters. I heard also about another method, which uses a second filter. If I want to ...
In a database system, say there are $N$ transactions each having $m_1,m_2,\dots,m_N$ operations. How many concurrent schedules are possible? $(m_1+m_2+....+m_n)!$ is the number of possible interleavings. Is this number equal to number of concurrent schedules? Serial schedules have to be discarded from the total number...
In various discussions of the merits of functional programming, the phrase referential transparency or equational reasoning is often listed. My question is - are these roughly the same thing? (One being the concept, and the second being the process of applying the concept?
Given are a 2D plane and a array of points in this plane, with every point having an integer value assigned. Is there an algorithm which, when given a ratio a/b, divides the plane with a straight line, so that the values of the points are distributed as close as possible to the given ratio? Points may be on the dividi...
Does anyone know a good algorithm for quickly finding an approximate solution to the following problem? Given two square matrices $A$ and $B$, minimize $\| P A P^\top - B \|$ over all permutation matrices $P$. I have heard that there are several types of algorithms for these kinds of problems, like iterative improvemen...
Is there any example that anybody could come up with that shows Prim's algorithm does not always give the correct result when it comes knowing the minimal spanning tree.
I'm both asking for me & future readers as to how pictures, sounds, textures, assets, and such are compiled and linked in to one binary/program, and how that process works. I have seen this in standalone programs I have downloaded on Windows, and I'm fairly certain any OS can implement this. It appears that, instead of...
I am getting confused with the solution to this recurrence - $T(n) = T(n/2) + n^2$ Recursion tree - T(n) Height lg n + 1 | T(n/2) | T(n/4) So it turns out to be - $T(n) = n^2(1 + 1/4 + (1/4)^2) + \ldots (1/4)^{\log_2 n - 1})$ $T(n) = 4*n^2(1- (1/4)^{\log_2 n})/3 + n^2 $ $T(n) = 4*n^2(1 - 1^{\l...
Lets assume $P = NP$. Can we say if every language $L \in P$, then $L \in NPC$? I read $P \subseteq NP$, which means that $L\in NP$. So I know for example, that a language can be $NP \text{ hard}$, but it doesn't have to be in $NP$, e.g. $HALT$. But what about the case above. Is the language also $NPC$?
An exercise that was in a past session is the following: Prove that there exists an undecidable subset of $\{1\}^*$ This exercise looks very strange to me, because I think that all subsets are decidable. Is there a topic that I should read to find a possible answer?
Given integers $n,m$, I want to find a $m \times n$ binary matrix $X$ such that there does not exist any non-zero vector $y \in \{-1,0,1\}^n$ with $Xy=0$ (all operations performed over $\mathbb{Z}$). What algorithm could I use for this? In more detail: We are given parameters $n$ and $m$. The problem is to determine...
This is more of a conceptual question. I have learned about Neural Nets, and I have some clue as to how Support Vector Machines work. I read somewhere however that given the appropriate kernel (is that right?), the SVM is identical to the Neural Net. Could someone who understands this please enlighten me as to how that...
Background: In the book of Principles of Model Checking (Christel Baier and Joost-Peter Katoen, MIT Press, 2007), Section 9.2, page 701, the semantics of the until modality is defined over some time-divergent path $\pi \in s_0 \Rightarrow^{d_0} s_1 \Rightarrow^{d_1} \cdots \Rightarrow^{d_{i-1}} s_i \Rightarrow^{d_i} \c...
I have some algorithm and I wonder whether there is a way to optimize it beyond the naive approach. Basically I have time steps and the current time is $t_c$. At any given time step, a couple of "ranges" are active from now up to some given time $t_i$ (i.e. $\forall t\leq t_i: r_i\in R(t)$). now -time-> v r...
I'm having a hard time with the following question: Use a recursion tree to determine a good asymptotic upper bound on the recurrence $T(n) = 4T(n/2 + 2) + n$. Use the substitution method to verify your answer. This is not homework, I'm just practicing myself for an upcoming exam. The thing I'm having a hard time with ...
I'm studying support vector machines and came across this paper. The following equation doesn't make sense to me, especially the part with the 0 ∀i. Any help understanding the basics of SVMs? yi * (xi * w + b) - 1 >= 0 ∀i xi - one input yi - the classification (+1 or -1) w and b - variables to find in order to "trai...
As big-step operational semantics is about evaluating an expression to a final value, can we state that for defining a concurrent language one needs small-step semantics, as concurrent programs need not result in a value?
As there is an untyped lambda calculus, and a simply-typed lambda calculus (as described, for example, in Benjamin Pierce's book Types and Programming Languages), is there a simply-typed combinatory logic? For example, it would seem that natural types for the combinators S, K, and I would be S : (a -> b -> c) -> (a -> ...
I'm a newbie in computer science and would to understand how hardware interrupts work at the physical layer. I ask my question considering a specific example. When packet arrives at the network adapter, a hardware interrupt is raised. Wikipedia says that an interrupt is a signal to the processor emitted by hardware ...
As in, I have to design a determenistic (one-taped) turing machine that accepts that language (All strings made up of 0 and 1, where the j-th character from the end is a 0, and $j$ is a constant that we know what it is before running the machine) in less steps than the trivial steps. In the trivial solution, I would f...
I'm trying to understand decidable languages. In particular, I would like to show that $$B = \lbrace \langle D \rangle \mid \exists k \geq 0 \,.\,\text{DFA $D$ accepts $a^k b^k$}\rangle.$$ I don't quite understand the process of proving these. I know that $a^kb^k$ is not regular, so then no DFA accepts it. I also know ...
I just read about polynomial-size circuit families and I have a question as the title. I know P/poly is defined as the class PSIZE of languages that have polynomial-size circuits. But what about other languages in other classes that have polynomial circuits?
I am developing a simple backprop neural network with n inputs and 1 output. I am using a sigmoid activation function. [Aforge.Net] I have read that it is good to normalise the input and output data prior to training, which I have done using a simple linear relation (max/min mapping) to normalise between [0, 1]. My qu...
Here is a perhaps naive question that has been tingling me: Is there an $\Omega(\sqrt[3]{n})$ asymptotic lower bound for addressing arbitrarily large memory randomly? My cause of belief is that the shortest path to any memory stored physically must be through three-dimensional space, and the diagonal here must have som...
This question is inspired by Constructing inequivalent binary matrices. Define the equivalence relation $\sim$ as follows: If $M,N$ are two $8\times 8$ binary matrices (all elements are $0$ or $1$), say that $M \sim N$ if you can transform $M$ into $N$ by a sequence of moves, where each move picks some pair $(i,j)$ and...
At 15:30 in this talk (p13 of this presentation here) Rich Hickey mentions the formalisms available for reasoning about Communicating Sequential Processes. He then goes on to mention that these haven't yet been applied to Clojure's core.async. The only reference I know of for CSP is Hoare's book. I can see some examp...
I have a problem $A$ which was shown to be PSPACE-complete by reduction from planning. However, $A$ can also be transformed into reachability problem which is NL-complete. I know that $NL=NSPACE(log \ n)$ and $PSPACE=NSPACE$. Does this mean $A$ is also NL-complete? IF yes, does it make any difference in this contex...
I am reading a unpublished paper describing an algorithm. In one step of the algorithm, there is a bipartite graph $G(X,Y,E)$, where $X=\{1,...,n\}$. For every subset $X' \subseteq X$, they define $$f(X')=\bigcup_{i \in X'} \{j \in Y| (i,j)\in E\}.$$ In other words, $f(X')$ is the set of neighbors of vertices in $X'$. ...
Karp's 21 NP-complete problems show that 0-1 integer linear programming is NP-hard. That is, an integer linear program with binary variables. If we set the $c^T$ vector of the objective $\text {maximize } c^Tx$ to all one (unweighted, i.e., $c^T=(1,1,\dots,1)$) is the problem still NP-hard?
For example let's say that we know that the worst-case running time is o(n) and the best-case is o(1). how can i get the average-case running time using the given big Ohs?
I have several confusion like : Does virtual address space resides in virtual memory ? Does each process has its own virtual address space like each process has its own virtual memory and own page table ? Mapping to physical address takes place from virtual memory or virtual address space if they are different thing ...
I'm asking here for both the scientific, programmatic, and structural format of a device driver. What does that mean? Basically, I'm not asking how to write a driver in general ... I'm asking how to structure one to behave as software that can act as the "middleware" between higher-level code and the hardware itself. I...
I've got some questions about the temporal operators in computation tree logic: Does the Finally path-specific quantifier Fq mean that q has to hold in a subsequent state or is it also fulfilled when q holds in the current state? Please consider the following example: What exactly is specified here? Does it mean: If ...
We know that P=NP implies NP=coNP. Does the reverse implication hold? Does NP equal coNP imply that P equals NP? If not why not? I googled but didn't find the answer.
An adversary gives you a set of items whose total size is $x$ (he gets to choose how $x$ is distributed. e.g. there may be $k-1$ items of size $\frac{x}{k}$ and 2 items of size $\frac{x}{2k}$). The item are now randomly distributed into $2x$ bins (you may assume $2x\in \mathbb{N}$). What's the probability (i.e. what ca...
A problem is in NP if a correct answer to it can be verified to be so in polynomial time. A problem is in co-NP if an incorrect answer to it can be verified to be so in polynomial time. P is a subset of the intersection of the sets NP and co-NP. My question is: what is a specific problem that is in the intersection...
what is the reason for the correctness proof of Prim's Algorithm for the undirected case cannot carry over to the directed case? Is it because of after any number of steps, $S$ might not be in a sub tree of an MST since it depends upon the direction of the edge of the directed graph, unlike the undirected one?
It is well known that the maximization problem of Knapsack if NP-hard. How about just finding a feasible solution i.e. objective is set to zero? And also if we set the values to all one (not the weights) in the objective of the Knapsack problem is it still NP-hard i.e. $\max v^Tx$ where $v=(1,1,1..,1)$?
I have a list of webpages and I must download them frequently, each webpage got a different download frequency. Based on this frequency we group the webpages in 5 groups: Items in group 1 are downloaded once per 1 hour items in group 2 once per 2 hours items in group 3 once per 3 hours items in group 4 once per 12 hour...
After we prove that a certain optimization problem is NP-hard, the natural next step is to look for a polynomial algorithm that comes close to the optimal solution - preferrably with a constant approximation factor. After we prove that a certain decision problem is NP-complete, what is the natural next step? Obviously ...
I'm trying to come up with a good algorithm for the following decision problem: Let $G=(V,A)$ be a directed graph and let $s,t \in V$. Are there at-least 2 non-intersecting paths from $s$ to $t$? By non-intersecting I mean that if $P_1$ and $P_2$ are non-intersecting paths from $s$ to $t$ then $\forall e\in P_1\in A, e...
I am working on CFG grammars, LL grammars in particular and I encountered the following theorem in the slides of presentations written by my professor: A CFG grammar cannot be left-factored if all elements in the FIRST-set of one factorizable rule belong to the FIRST-set of the alternative rule. Mathematically speak...
If the clock shows 14:15:36.909302, why not just use the fractions of a second part (09302) as a kind of random number? What is wrong with this form of generating random numbers? I am aware that obtaining truly random numbers is a difficult task, so I am assuming that there is something wrong with this method.
Given two languages $L_1$ and $L_2$ that are in $\mathsf{P}$, can it be proven that there is a polynomial time reduction from $L_1$ to $L_2$ and vice versa? If so, how? I noticed that if $L_1$ is the empty language, and $L_2$ is the "full language" $\{ 0,1 \}^*$, there does not seem to be a reduction from $L_2$ to $L_1...
I'm reading about the Hindley-Milner typing algorithm while writing an implementation, and see that, as long as every variable is bound, you'll always get either atomic types or types where the arguments will determine the final type, such as t1 -> t1 or (t1 -> t2) -> (t1 -> t2) where t1 and t2 are type variables. I ca...
Many problems in computer science come in two flavors: Optimization problem: "Find an object with the largest size". Decision problem: "Given $n$, find an object with a size of at least $n$, or reply that such an object does not exist". Given a solver for the optimization problem, the decision problem can be solved s...
Hi I'm trying to prove the following proposition: Given a network $G,s,t,\omega$ where $\omega$ is the capacity, create a minimal cut cut ${S=\left\{ (s,v)\in E_{G_{r\_max}}\right\} }$ where $G_{r\_max}$ is graph representing the the residual network(meaning we take the group of all vertices that are reachable from ...
Given a digraph $D = (V, A)$ and $m \in \mathbb{N}$, the question is is there a subset $A' \subseteq A$, such that $\lvert A' \rvert \geq m$ and $d_{D'}^+(u) \leq d_{D'}^-(v)$ holds for every arc $(u, v) \in A'$ in the subgraph $D' = (V, A')$, i.e. the out-degree of $u$ is not larger than the in-degree of $v$? Note tha...
I'm trying to apply Dijkstra's algorithm to the Problem 83 on projecteuler.net. The problem reads: In the 5 by 5 matrix below, the minimal path sum from the top left to the bottom right, by moving left, right, up, and down, is indicated in bold red and is equal to 2297. 131 673 234 103 18 201 96 342 ...
Suppose I have a queue where I pull from left and push to the right, and suppose I have the contents in the queue as $a b c @ d e$ (from left to right, left is head, right is tail). Is there a simple algorithm that doesn't require extra structures that makes $e$ at the head? meaning to get us to the queue $eabc@d$? P.S...
How do I see if the following ciphertext eaeairtntrnaeemtve is a transposition cipher, using letter frequency? This article suggest how to detect by using letter frequency detection and cryptanalysis but I am unsure of how to do this. Any suggestions?
a^2n b^(2n+1) is a regular language. I am not able to decompose it in xyz so that I can pump any power of y as per pumping lemma. Please help me out.
In the theory of NP-completeness, researchers refer to the concept of combinatorial explosion. Some researchers use it as justification for intractability or NP-completeness. Others use it to refer to the exponential growth of possible solutions of an intractable problem while others use to refer to the apparent expon...
Given a fully deterministic single player resource management game with a pre-known finite number of turns and reasonably simple rules (eg, Farmville, if it were single player, deterministic, and ended after a certain number of turns), is it usually possible to write a computer program that can optimize the game in...
I have two questions. After compilation of any C program result is assembly language code which should depend on processor. So my question is: how do different computers with different processor types, for example Intel i3,i5,i7 etc., are able to run the same software, for example, media-player, browser, etc.? (I gu...
If we suppose that we are given two numbers $a$ and $b$ to add, what circuit depth do we require to add them? I'm wondering if $a$ and $b$ are $O(n)$, and thus the amount of bits required to store $a$ and $b$ are $O(\log_2(n))$, how much time and/or space we must require to add them. I'm interested in the general cas...
I'm trying to organise a large reunion though facebook. Over the years we've all drifted apart, and so there isn't anyone who is still facebook friends with everyone. You need to be facebook friends to invite someone to the facebook event and I have invited all the people that I can. I also know that each of the uninvi...
i=n; while(i>0) { k=1; for(j=1;j<=n:j+=k) k++; i=i/2; } The while loop has the complexity of $\lg(n)$ the j value of inner loop runs 1,3,6,10,15... increase like 2,3,4,5,... But how to find the overall complexity ?
As I have studied, deciding regularity of context-free languages is undecidable. However, we can test for regularity using the Myhill–Nerode theorem which provides a necessary and sufficient condition. So the problem should be decidable. Where is my mistake?
I have a problem whose solution can be written as a binary string with a given length $N$, where $N$ is a given parameter. Standard GA works well on this problem. From runs of small values $N$, I found that optimal solutions are binary strings that contain only 01 or 011. For example, the optimal solution for $N=16$ is...
The classic example of a context-free grammar is $a^nb^n$. That is, $n$ occurrences of $a$ followed by an equal number of occurrences of $b$. Do such forms occur in the real world? Can you provide an example of a real-world case where there must be $n$ occurrences of something followed an equal number of occurrences of...
In the last 2 paragraphs of the paper about Hopcroft–Karp algorithm to find the maximum cardinality matching in bipartite graph: https://dl.dropboxusercontent.com/u/64823035/04569670.pdf The execution time of a phase is O(m+n), where m is the number of edges in G, and n is the number of vertices. Hence the execution...
I want know if compiler interacts with operating system during compilation process.And if yes then which part of compiler interacts with which part of operating system
The following array occupies 10000 slots in memory: a = [0,1,2,3,4,5,6,7,8,9,10,...,10000] But one could easily represent the same array as: a = {len:10000, get: λ idx -> idx} Which is much more compact. Similarly, there are several arrays that can be represented compactly: a = {a:1000, get: λ idx -> idx * 2} Is a de...
I have a set of elements U = {1, 2, .... , n} and a set S of k sets whose union form the whole universe. Each of these sets is associated with a cost. I have a fixed number of colors, C = {1 , 2, ... , m}. Some of the sets mentioned above interfere with each other. I cannot assign same color to both those sets together...
How do I iterate over all the $k$-element subsets of $\{1,2,\dots, n\}$ by switching one element at a time? 123 134 234 124 145 245 345 135 235 125 This comes from Ch2 of Combinatorial Algorithms by Nienhuis and Wilf. Equivalently I am asking for a Hamiltonian circuit on the Johnson graph of $k$ element subsets of a ...
In the sense of a string distinct from a null reference string, what is the importance of an empty string in CS (and specially in formal languages)? Why do you need a separate concept, that of 'empty string', which even has it's own Greek letter (ε)? Couldn't just an EOL character replace it?
When we look at the Actor Model and Communicating Sequential Processes we see that they are both trying to do concurrency based on message passing, yet they are distinct. (We see implementations of the CSP Model in go-lang's goroutines (and Clojure's core.async) and the Actor Model in Scala's Akka toolkit) I'm trying ...
I'm trying to understand this lecture, section 2.7. Why would the normal order sequencing print out "hello" "world" and not "world" "hello"? I may be misinterpreting the order in which the arguments are applied. It looks like the expression $$ ((Seq (display "hello"))\; (display "world")) $$ would evaluate to $$ \lamb...
I need a data structure which can include millions of elements, minimum and maximum must be accesable in constant time and inserting and erasing element time complexity must be better than linear.
I just read the Wiki article for Simon's Problem but I don't fully understand it because I don't follow the symbolic notation used to describe functions (I am not a computer scientist). Can someone just briefly explain it in simple language, like is it just XOR'ing two binary strings and trying to isolate each string?...
I have read about the hash function MD5. I found an online calculator which counts the value of MD5 for different data. But the MD5 function returns as result strings like 735b90b4568125ed6c3f678819b6e058, so I can't apply any numerical operation to this value, e.g. mod. How can I transform values like these into numbe...
Foldl and folr are 2 very important functions for FP and Haskell, but I have never heard much about the unsided fold: fold f [a,b,c,d] = (f (f a b) (f c d)) That is, a fold that operates on binary associative functions (so the order of application doesn't matter). If I recall correctly, this is very common in database...
I would like to be able to represent circles in x-y coordinates. Each circle contains an x and y coordinates and radius in double data type. My goal is to compare circles with each other whether they are partially or completely overlapping. I am looking for efficient ideas. Honestly the only idea that comes to my mind ...
I believe this question should be extremely easy but I am having a (embarrassing) hard time figuring out why its true if there exist OWF (computable in polynomial time) then there exits a OWF that is computed in $O(n^2)$. This is what I have/tried. Let $ \ f(x)$ be a OWF that can be computed in $k^c$. Then we can const...
Every nontrivial property of the recursively enumerable languages is undecidable. What exactly is nontrivial property?
In this paper (page 3 Theorem 1) the authors want to prove that their problem is NP-complete. Their method is as follows. Let their problem be known as $P$. They show that their problem can be written as a $0\text{-}1$ integer program. Then they claim that $0\text{-}1$ integer programs are NP-complete and therefore the...
Short version: I want to know where the $-2$ comes from in the formula on p. 221 of CLRS 3rd edition. Long version: CLRS (3rd ed.) give an algorithm for $O(n)$ worst case arbitrary order statistic of $n$ distinct numbers. The algorithm is roughly: Input: an array of $n$ elements and $i$, the number of the order stati...
Assuming P!=NP, there is a result that there are decision problems intermediate between P and NP-complete. That is, the class NP cannot be a union of two disjoint subsets: P and NP-complete. I could never quite understand the proof of the above result. The proof I saw in a textbook was starting with the assumption that...
I would like to refute my hypothesis that all safety-critical software (that is, software where errors can have catastrophical consequences, either in terms of human lives or high material costs) is a real-time software (where tasks have timing constraints) by finding interesting counterexamples: systems without timing...
I was asked this question in examination. A square matrix $M$ of size $10 \times 10$ is stored in memory with each element requiring 4 bytes of storage. If the base address at $M[0][0]$ is $1840$, determine the address at $M[4][8]$ when the matrix $M$ is stored row majorwise. I seriously don't understand this question ...
Given a turing machine $T$ that receives an encoding of another turing machine and a word $<M><w>$, can $T$ 'run' through the encoding and 'mark' specific transitions/states? For example, if I want to show that the language $L = \{<M><w>\}$ such that when we run $w$ in $M$ we will visit at least two unique states diffe...
I am curious how to do a line by line analysis of this piece of code using the "Big O" notation. i = 0; j = 0; while ( ( i < n ) && ( j < m ) ) { //do something i++; j++; } How I should represent number of iterations for the loop? Is good if I will do some assumptions or I should write min(n, m)? Sm...
Forgive this seemingly "troll-ish" question, but I must lack the ability to understand how one byte (two nibbles, eight bits, however you wish to describe it) can hold 256 different states, possibilities, values or such. First of all, one bit would look like this: Any way of being able to input two states (in the poor...
I have the following problem: In a 2D space with polygonal obstacles, find the shortest path between two given point. Without additional constraints, we can reduce it to a graph problem by constructing a visibility graph and then solve it by searching. If the following constraints are added, how can we solve it? Let'...
Sipser theorem 4.4* $E_{DFA} = \{ \langle A \rangle \mid \text{A is a DFA and } L(A)=\emptyset\}$ is decidable. I could not quite understand the solution, I'll quote it: On input $\langle A \rangle$ where $A$ is a DFA: Mark the start state of A Repeat until no new states get marked: Mark any state that has a tran...
I know that Idris has dependent types but isn't turing complete. What can it not do by giving up Turing completeness, and is this related to having dependent types? I guess this is quite a specific question, but I don't know a huge amount about dependent types and related type systems.
Pancake graph have least diameter & degree (log n/ log log n) pancake Graph with order-2 will be one single line with two nodes, labeled with permutation of node {12, 21}. pancake Graph with order-3 will be one single line with one hexagonal, labeled with permutation of node {123, 132, 213, 231, 312, 321}. Similarly fo...
Here is how deletion in B-trees is described: If the key k is in node x and x is a leaf, delete the key k from x. If the key k is in node x and x is an internal node, do the following. a) If the child y that precedes k in node x has at least t keys, then find the predecessor k0 of k in the sub-tree rooted at y. Recur...