instruction
stringlengths
35
29.1k
Write down the algorithm for bidirectional search, in pseudo-code. Assume that each search will be a breadth-first search, and that the forward and backward searches takes turns expanding a node at a time . Be careful to avoid checking each node in the forward search against each node in the backward direction. Artifi...
I would like to confirm below understanding, A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. Insertion: In binary trees, a new node before insert has to specify 1) whose child it is going to be 2) mention whether new nod...
What is the difference between "connected", "strongly connected", and "reachable" in a graph?
What are the major causes that makes "Proving Programs correct", not a widely attractive subject? though from it's name, and from what we know from other disciplines (like mathematics) it looks like it should be on the top of the "must know list". And by the way I'm talking about "the real world", in practice.
I was solving a problem, where one part of it was the following: "Given a m-sided dice ([1,m] values) that will be rolled n times, calculate the possibility that the total sum of rolls will be higher than b" Initially, I implemented a naive exponential solution, discovering the whole state space (DFS-like). Then, I rea...
Basically, and as a simple method, we can access cache with Physical Address which is from the TLB. But, as another method, we can access cache with Virtual Address. But, in this case, if the cache is not fully flushed between context switch(other process's datas can be exist in cache), there is an aliasing problem. Sa...
A key difference between the edge-triggered and level-triggered interrupts is interrupt sharing. Level-triggered interrupts can be shared. Edge-triggered interrupts cannot be shared. I read the line above in an IBM document. Need help to understand why is it so.
Here is one discussion that says, "every DCFL has an LR(1), an LALR(1) and even an SLR(1) grammar." And wiki says, "a language can be generated by an LR(k) grammar if and only if it is deterministic [and context-free], if and only if it can be generated by an LR(1) grammar" Is the first statement in that discussion for...
Let's say I have an algorithm, MyAlgo(n) as follows: for i: = 1 to n do (something) Where in the i-th iteration, (something) executes i^2 steps. How can I determine an asymptotic tight bound (Big-Theta) on the running time of this algorithm? I know I have to determine Big O and Big Omega, but since the actual algori...
There is Lagrange's four-square theorem, which statea that Given an integer $N$, we can write $N$ as a sum of four squares $A^2+B^2+C^2+D^2=N$. How can I find a valid solution with time complexity of $O(1)$ or $O(\sqrt N)$? I only have to find one solution. Here is my $O(1)$ algorithm: while(count!=4){ solutio...
Recursion theorem (paraphrasing Sipser, Introduction to the Theory of Computation): Let T be a program that computes a function t: N x N --> N. There is a program R that computes a function r: N --> N, where for every w, t(<R>, w) = r(w) The proof is by construction. The program R thus constructed computes the...
I came across following TM state diagram accepting language $\{a^nb^nc^n | n\geq 0\}$ After trying out some valid and invalid strings of various lengths, I was surprised how it is designed to accept language exactly as specified. Now I have started wondering how I can come up with such TM design given any language spe...
Given a list of list of integers how to find pair of lists which have overlapping i.e. 1 or more elements are common. Is it possible to solve without having cartesian product of initial list with itself
I am looking for an algorithm to summarize a dataset in text form. If you consider below example, which shows sales figures for specific items in years 2001, 2002,and 2003: This has to summarized like below For year 2001 ERF had more sales, for year 2002 ADO had more sales and for year 2003 also ADO had more sales....
The heaviest-first algorithm is a greedy approximation algorithm that finds an independent set $S$ of nodes in a graph $G=(V,E)$, so that the sum of the weights of the nodes in $S$ is as large as possible. My question is that I want to find the time complexity of the following algorithm (when applied on $N \times N$ gr...
In my line of work, I have encountered the following variant of discrete knapsack and I was wondering if it has already been studied. E.g. We are given a set of 3 items (A,B,C). The goal is to maximize the value carried for a given weight constraint. The variant has the following additional constraints: Step 1: The fi...
Can anyone here give an example of DFA or NFA real time application? And, can I know what are complexity and decidability problems in real time application? Does every real time application have complexity and decidability problems?
Question Suppose there is a balanced binary search tree with n nodes, where at each node, in addition to the key, we store the number of elements in the sub tree rooted at that node. Now, given two elements a and b, such that a$<$b, we want to find the number of elements x in the tree that lie between a and b, that is,...
Let $G(V, E)$ be an undirected weighted (positive) graph. Given a path $s-t$ find the path that minimizes the maximum weight of any of its edges. This is the minimax path problem. It is know that a minimum spanning tree $T$ of $G$ gives a minimax path between every pair of nodes. After calculating the MST I want to be ...
I'm talking about Type-0 (Chomsky hierarchy) unrestricted grammar, where production rules of grammar are of the form $\alpha\rightarrow\beta$, where $\alpha,\beta\in N\cup\Sigma$. I can not find any example of real unrestricted grammar which produces a non-context-sensitive language (of words). While there are examples...
L = {M | M is a TM and there exists an input that the TM M accepts in less than 50 steps} I need to find a minimal class it belongs to between R/ RE/ co-RE/ not in RE∪co-RE. I managed to show that it is in RE with a TM. I think its not in co-RE, because it has to check every input to know wheter a TM M belongs to L. a...
I have a simple priority queue algorithm that I implemented, and I doubt it's new but I haven't been able to classify it. Wondering if I could get some help with classifying it! Once I classify it I can read more about how to implement it properly, etc. Assuming the implementation is sound, I am also trying to figure o...
How do you convert the following algorithm from the iterative paradigm to the recursive paradigm? Input: array $A[1],\ldots,A[n]$ Output: last index $i$ such that $A[i] = i$, or $-1$ if none Algorithm: $index \gets -1$ For $i \gets 1,\ldots,n$: $\quad$ If $A[i] = i$: $index \gets i$ Return $index$
Suppose you are given a 3-D sphere of known radius. Input of n points is provided, which have been selected randomly on the surface of the sphere. Each input field consists of a polar angle theta (Θ) and azimuthal angle phi, Φ (in spherical coordinate system). Now I need to find a new point (n+1) such that this point h...
let's say L is a regular language. And there in an NFA automata with epsilon moves A,in which for every accepting state δ(q,σ)=Ø. How can I prove that there must be an automata A as defined for L?
I need to generate/enumerate isomorphism classes of vertex-rooted graphs with the following properties. Let $\Delta$ be the maximal degree (say 3 for subcubic graphs) and $r$ the maximal distance of a vertex from the root (something like radius, even though the formal definition of radius of a graph is different). Note...
We are given positive integers $n$, $m$ and a set $S$ of subsets of the set $\{1,2,...,n\}$ with $|S| = m$. For example: $n = 5,\,\, m = 4,\,\, S = \{\, \{1,2\}, \{1,3\}, \{4,5\}, \{2,3\} \,\}.$ What is the fastest way to find the minimal subset $S'$ of $S$ such that the union of sets in $S'$ is equal to $\{1,2,...,n\...
My lecturer for information theory says that "Huffman coding produces efficient codes but is unsuitable for text files where the letters are represented by a fixed length ASCII code". I do not understand this statement. I understand that as you change the text file, you'll have to update the probabilities and thus the ...
How can I formally define * for a dfa with multiple initial states? I know that the δ formal definition for NFA is δ: Q × ∑ → 2^Q and for DFA it's δ : Q × Σ → Q but what should I do if there is multiple initial states?How can I take into consideration all the options for the initial state?It seem like it should combine...
Suppose i want to trace an algorithm (think of it as a flowchart) to understand how it works, i need an input(s) for this algorithm, the question is: how can i determine the right input(s) that goes through all the cases ? Is there any "scientific" method to determine this input?
I am a student and I was reading Numerical Analysis by Burden. In one of the exercises, I have to calculate $e^{-5}$ in two ways. The first is using the Taylor's series for $x=-5$, $( e^{-5} = 1 - 5/1! + 5^2/2!-...)$ and second way is calculating $e^5$ and then $e^{-5}=1/e^5$, again using Taylor's series but this tim...
I can't comment on this question, so I ask it here as a new question: Ricky Demer states there in a comment to the first answer "[...] since FPSPACE can give exponentially long outputs [...]" How can this be? How can an algorithm in FSPACE give an exponentially long output? Does this mean, that we do not count the outp...
So given an undirected graph stored in form adjacency list using vector<int> adj[], I have to print the Euler Cicuit. Every edge is given as follows a bmeaning an edge from a to b. But the problem is I have to follow the given order of input of vertices connected by an edge and change the order whenever it is compulsor...
I know of two translators LTL -> deterministic Rabin automaton: Rabinizer3 ltl2dstar They produce deterministic automata, which can be much larger than their possible non-deterministic variants. Is there a translator LTL -> non deterministic Rabin? (my synthesis tool could handle small non-det Rabin automata but not ...
I came across following intuitive rules to convert basic/minimal regular expressions directly to regular grammar (RLG for Right Linear Grammars, LLG for Left Linear Grammars): Then I came across many examples that claimed to use these rules to prepare regular grammars from given regex. However I was not able to unders...
For chaining two points A and B A(x1,y1) at index i in array B(x2,y2) at index j in array //condition if ( i<j and x1<=x2 and y1<=y2 and !(x1==x2 and y1==y2)) then A and B are in a increasing sequence (chain) For example: A = { (0,0), (1,0), (1,1), (2,1), (2,0)} longest sequence (cahin) is = {(0,0), (1,0), (1,1),...
First question in the computer science section. I am currently working on a solution that optimizes decision tree redundancy. the following is an example of optimization: | D1 | D2 | Outcome | | true | false | Yes | | false | false | No | | true | true | Yes | | false | true | No | wh...
Here is my situation. I have a grid-type graph with obstacles. Every move (horizontally, vertically or diagonally with a range of 1) has a cost of exactly 1 (the graph is not weighted) provided that neither the source or the destination is an obstacle. I need to, provided a starting node (a square), find any path that ...
Please consider the following probability density function of two variables. \begin{eqnarray*} f(x_1,x_2) &=& \begin{cases} 2(x_1+x_2) & \text{for} \,\, 0 \le x_1 \le x_2 \le 1\\ 0 &\text{ otherwise } \\ \end{cases} \end{eqnarray*} I would like to generate two random values $X_1$ and $X_2$ such that there d...
I have come across a proof where a certain function ("compute a straight skeleton") is shown to take $\Omega(n \log n)$ time by reducing the problem of sorting to it. The overhead for the reduction itself is linear, thus negligible. Now my question is: is this a valid argument? The original proof appears in: Huber - C...
I read some examples online on this subject, but none of them really gave an explanation. When I visualize the number line all I can see is evenly spaced numbers, I'm not grasping the notation of "uneven spacing" when It comes to plotting the floating point values from a machine's perspective. Perhaps I am thinking abo...
I'm just reading a textbook in mathematical logic, as following: What is the precedence to consider the equality and satisfiability operators in the equation pinpointed in red?! In other words, which of following cases right: (A \sat x) = y[s] or A \sat (x = y[s])
I want to ask how to solve this problem.. in this graph we have vertex and edge with two value the quality and distance.. there are 3 path in this graph 1->2->6 distance is 10.. 1->4->6 distance is 9.. 1->3->5->-6 distance is 18.. my concern here is the quality of road,, 1 is the best road quality 2 is for ave...
I am trying to understand how pure Monte Carlo tree search (https://en.wikipedia.org/wiki/Monte_Carlo_tree_search) handles games where random playout will likely result in a loss easily avoided by other types of agents. For example, imagine a hypothetical game with a single player. At game start, the player can choose ...
I'm learning about asymptotics and time complexity. The algorithm I'm analyzing has a for loop that starts at $i = 1$ and ends at $\left \lfloor \sqrt n \right \rfloor$. The body is said to run in $n-i$ steps. I'm trying to do a summation from $i=1$ to $\left \lfloor \sqrt n \right \rfloor$ to come up with a Big Theta,...
I have recently started working on the Object detection using deep learning. I have understood the basic steps of object detection are: Input Image -> Object proposals -> Feature Extraction -> Training. I have successfully implemented my own code up to the Object Proposal extraction. Now I want to use deep learning her...
There is a sequence of $n$ sets, each set contains a constant number of constant-size vectors, e.g: $\{M_{1,1},M_{1,2},M_{1,3},M_{1,4}\}$ $\{M_{2,1},M_{2,2},M_{2,3},M_{2,4}\}$ ... $\{M_{n,1},M_{n,2},M_{n,3},M_{n,4}\}$ The task is to pick, from each set, a single vector, such that the sum of vectors and all the partia...
In this example: Assume a system’s memory has 128M words. Blocks are 64 words in length and the cache consists of 32K blocks. Show the format for a main memory address assuming a 2-way set associative cache mapping scheme. Be sure to include the fields as well as their sizes. The following is supposed to be the solut...
i have problem with resolution in first order logic i have : C1 : ¬ Loves(x,F(x) ) or Loves ( G(x) , x ) and C2 : ¬ Animal ( X) or Loves ( jack , x ) can some one help me why the answer ( after Resolve C1,C2 ) is : ¬ Animal(F(jack) ) or Loves ( G(jack) , jack ) because my answer is : x/ jack then i will hav...
There is a theorem which says that: Given a finite state automaton having $n$ states, if there exists a string $w$ whose length satisfies $n \leq |w| \leq 2n-1$ then the language accepted by the automaton is infinite. I understand the constraint $|w| \geq n$, but I don't understand why the constraint $|w| \leq 2n-1$ ...
I would like to train a RNN with LSTM cells in Tensorflow to predict the next word of a sequence. Words are N-length vectors of 0s and 1s. By looking at different tutorials, I saw that the input tensor has a shape like this seq_input = tf.placeholder(tf.float32, [n_steps, batch_size, seq_width]) However, it is not cle...
Given a finite alphabet $\Sigma$ with more than one symbol, is $L = \{u u^R u : u \in \Sigma^*\}$ context-free? ($u^R$ is the reverse word of $u$) I tried to show it wasn't context-free by using the pumping lemma but I'm out of ideas.
I am currently working on a project that involves taking a single color frame, performing image segmentation and then visualization of the scene. I am currently at the stage of performing alignment between two objects - one in my database and one segmented from picture. Picture data is processed: for each pixel in the...
Is it possible to derive a grammar with iself? Or more precisely, is it possible to conceive a grammar which language contains that grammar? For example, the Wikipedia article about BNF claims to represent the BNF syntax with BNF. But if we tried to derive BNF with it, we'd obtain the same BNF, but with each character ...
I am taking a computer theory class and one of the exercises is to prove that the property "doesn't halt for some input" is not semidecidable. This property is the negation of the property "halts for all inputs". I know that the halting problem is undecidable, but i need some kind of contradition to prove that the neg...
I'm trying to learn about declarative programming, and while reading the wiki it said the following: In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow....
I am looking for some help with understanding the extended Euclidean Algorithm, specifically, this implementation (in Haskell): eGCD :: Integer -> Integer -> (Integer,Integer,Integer) eGCD 0 b = (b, 0, 1) eGCD a b = let (g, s, t) = eGCD (b `mod` a) a in (g, t - (b `div` a) * s, s) I understand the Wikipedia...
In languages like C, the programmer is expected to insert calls to free. Why doesn't the compiler do this automatically? Humans do it in a reasonable amount of time(ignoring bugs), so it is not impossible. EDIT: For future reference, here is another discussion that has an interesting example.
I'm using the following definition of $NP$: $$A \in NP \Longleftrightarrow A(x) = \exists w: B(x,w) $$ where $B \in P$ and $|w| = poly(|x|)$. Now instead of the problem whether the program $\Pi$ halts on input $x$, I'll use the close cousin that asks whether $\Pi$ halts on $0$. Then I can write: $$HaltsOnZero(\Pi) = ...
This is a homework problem and I'm not sure if I am doing it correctly. Show that $\log(n^2+1)\in \Theta(\log n)$. I got: $$ \log (n^2) \leq \log(n^2+1) \leq \log (n^2+n^2) $$ $$ 2\log n \leq \log(n^2+1) \leq \log(2\cdot n^2) $$ $$ 2\log n \leq \log (n^2+1) \leq \log 2 + \log(n^2)$$ $$ 2\log n \leq \log(n^2+1) \leq 1...
A question on SO about complexity of sorting vectors of vectors got me thinking about the complexity of comparing 2 vectors. Let's consider vectors of average size 1) N. The first formula we get for the comparison of 2 vectors is O(N), but my intuition says it could be lower. Worst case scenario is N comparisons (vecto...
This question is a kinda spin off from Why do we not combine random number generators? If for example we had N identical type random number generators, with N different seeds, what would the period be if their outputs were xored together? Would it be period, N x period or period (power N)? So a numerical example would...
Consider the TSP problem. Let $F_n=\{\text{all cyclic permutations $\pi$ on $n$ objects} \}$. Define the neighborhood 2-change of TSP as $$N_2^n(f)=\{g: g\in F_n \text{ and $g$ can be obtained from $f$ as follows:}\\ \quad\quad\quad\quad\quad\quad\quad\;\;\;\; \text{remove two edges from the tour; then}\\ \quad­\quad\...
let's say L is a regular language,what term does L should uphold so that there is an NFA without epsilon moves,in which for every accepting state δ(q,σ)=Ø?I can think of some terms like that the last letters can't hold a power,but I was wandering if there is a formal definition?
If P1<=P2 means P1 is reducible to p2,then which is true? 1 If P1 is RE But Not REC,P2 is also RE but not REC? 2.If P2 is RE But Not REC,P1 is also RE but not REC? As per my knowledge,if P1 is undecidable then P2 is also undecidable,so if I consider this property,then as RE BUT NOT REC is also undecidable,then answer w...
I am having some confusion in understanding RICE's theorem. It says every non trivial property of RE in undecidable. I need to understand when to apply RICE's theorem and when to not. Questions like:- Turing machine makes at least five moves,It accepts a string input of length atleast five ,TM halts for every input on...
Is there any difference between word size and size of internal register of CPU ,since "Word size" refers to the number of bits processed by a computer's CPU in one go ,so does this imply that word size is architecture dependent and ALU register's size is same as word size ?
The hosts are assigned IP address by the router using dhcp. So, the router has a list (mac addresses) of all the hosts that are directly connected to it as well their ip addresses. Now if a packet comes from outside, the router must be able to find the destination mac address from its logs. Then what is the need to use...
I am trying to understand cascade classifiers for computer vision. I use OpenCV Traincascade for now and successfully trained some cascades. However I am trying to grasp the whole process. One thing I do not understand about the cascade training is how the features are selected on each stage. How does an image classifi...
Pervasive Sensing focuses on sensors and Pervasive Computing talks about using sensors for example. Are they both the same thing but different names?
I'm one year through both an undergraduate CS and undergraduate math degree, currently studying Big-O analysis, and am trying to develop a "mental checklist" as it were, or a kind of procedural algorithm, for performing Big-O analysis of mathematical functions. In this post, I'm merely asking some kind soul to point ou...
i have trouble with understand this type of questions , i know how i can determine if the sentences is valid or unsatisfiable in Propositional logic , but in FOL i can't for example , i have the following sentences in FOL : 1 = 2 the professor said this is neither valid nor unsatisfiable but , i think it is alway...
According to my understanding, the Bellman–Ford algorithm can handle cyclic graphs with negative weights. but it cannot have negative cycles. But can it handle zero weight cycles?
Our task is to compute the minimum hamming distance for the following 16-bit words: 0000000000000000 0011001100110011 0101010101010101 0000111111110000 0011111111000000 1100110000000000 1111111111111111 This minimum distance is defined as the minimum of all distances between every combination of two of these bitst...
I don't understand some things in Store and Forward equation: D -> Number of channels and switches pairs. tr -> Routing time. tw -> Transfer time in a channel. What is the L/W? And normally exercises provide me tw (time transfer in a link), but now I am doing an exercise in which tw is not provided. I think I shou...
From page 26 of Lambda-Calculus and Combinators: Definition 2.18 (Abstraction) For every CL-term $M$ and every variable $x$, a CL-term called $[x].M$ is defined by induction on $M$, thus: (a) $[x].M \equiv \mathbf{K}M$ if $x \notin FV(M)$; (b) $[x].x \equiv \mathbf{I}$; (c) $[x]Ux \equiv U$ if $x \notin FV(U)$ (f) $...
Unsupervised feature discovery of text that started with its bit string representation would need to discover octets were the first-order parse of such a bit string. This raises a question: What is the technique called that can discover that a binary string, for example: 01001001111100101010101010111110110010001110001...
Consider the example where $n = 4$, bit 0 is fixed at 1, and bit 2 is fixed at 0. I would like to generate all $n$-bit numbers with those bits fixed. Essentially, everything I generate would have the form: $$1*0*$$ where $*$ represents a bit that can vary. The fixed bits can be in arbitrary positions, and there can be ...
an access sequence of cache block address of length N and contaons n unique addresses. The no. of unique block address between 2 consecutive accesses to the same block address is bound above by k. What is miss ratio if access sequence is passed through a cache of associativity A >= k exercising LRU replacement policy? ...
I understand how the instructions are kept in relocatable format in RAM. It is done so by keeping a base register and a limit register. Physical address = base register value + logical address. And logical address = the logical distance from the starting location of process's address space, just like an array. But what...
The are cuisenaire rods with N differnt lengthes $x_1,x_2,...,x_n$ (each length is a natural number), the number of the Cuisenaire rods is unlimited. Given a natural number B. you should tell if you can pick a bunch of Cuisenaire rods with exactly the length of B. for example: if the cuisenaire rods are $3,11,19$ and ...
I've read so many about the Coin Change problem, debates about wheather it is solvable using Greedy, Dynamic Programming and so on. Nevertheless I cannot find an application of this problem. What are applications of Coin Change problem?
I asked this question here on stackoverflow, but maybe because of off-topic over there, it didn't received proper response. Does user level threads take advantage of multiprocessing ? I read one such answer here. But, it's not clear though. https://stackoverflow.com/questions/25582876/what-does-it-mean-by-user-threads...
In machine learning literature, when handling words or text inputs, the strings are often mapped onto a vector space using techniques such as word2vec. The terminology in this is that the individual word vectors are 'embeddings' and the embeddings together are a distributed representation of the input words (see refere...
So I know the Next Fit Bin Packing algorithm is bounded by two times the optimal solution for the problem, but I can not think of an order of arriving elements that actually takes twice the number of bins necessary. Something like: 50 -> 25 -> 50 -> 25 -> 50 -> 25 -> 50 -> 25 would result in: |25| |25| |25| |25| |50| ...
I am using the technique of this paper: https://arxiv.org/pdf/1604.07953.pdf to localize food objects. The difference is that I am using the next generation of google-net, inception-v3 network. For the localization problem, in the paper they modify the network cutting the last 2 inception modules to receive 14x14 grid ...
I want to prove that the language $L = \{ a^{n}(ab)^{{n}^{2}}b^{n} \mid n \geq 0 \}$ is not context-free by using Parikh's theorem. My first assumption is that the $(ab)^{{n}^{2}}$ part cannot be written as a subset of linear vectors. From this it follows that $\psi(L)$ is not semi-linear. My problem is to show that b...
From page 15 of Lambda Calculus and Combinators an Introduction: Note 1.34 If $M \equiv aM_1 \ldots M_n$ where $a$ is an atom, and $M \triangleright_\beta N$, then $N$ must have form $$ N \equiv a N_1 \ldots N_n $$ where $M_i \triangleright_\beta N_i$ for $i = 1, \ldots, n$. To see this, note that $M$ is really $$ (...
$M$ is some Turing machine, $\left<M\right>$ is the code of the Turing machine. $L =\{\left<T\right> | L(T) \ne \emptyset\}$ How to see intuitively that $L$ is partially decidable? We can try running a given $M$ on all strings and accept if $M$ accepts. However, what if the simulated $M$ gets into an infinite loop?
So I am working on solving a problem on whether following language is decideable: $L = \{n \in \mathbb{N} \mid M_n$ never freezes (for any input)$\}$, where $n$ is the Gödel-number of a Turing machine. The model for Turing machines that we use operates on a one-side-unbounded tape, so "freezing" in this context means...
In both the lambda calculus ($\lambda$-calculus) and Combinatory Logic (CL), we have the notion of function application. For example: \begin{array} & \left( \lambda x . x \right) y = y & \text{(function application) } \\ ([ x ] . x) y = y & \text{(function application) } \\ \end{array} Fair enough. But, in each of the...
Does the size of an algorithm restrict how many bitstrings it can compress, and how much it can compress the bitstrings? Some definitions and an example to illustrate this is the case. An elite program is the shortest program that outputs a particular bitstring. Elite programs are generally incomputable (Kolmogorov co...
In general, the size of the DFA resulting from the union of two DFAs A and B is O(|A|.|B|) in the worst case (usually the product construction is used to compute the union). Let's consider the class of 'synchronized DFAs' as the class of DFAs having a synchronizing word : https://en.wikipedia.org/wiki/Synchronizing_wor...
I'm getting into algorithms and I came upon range trees. What confuses me is the leaves in a range tree, since for example: When you remove the leaves: It's just a regular BST. And, every implementation I see of a range tree/range searching, for example, doesn't put the points in the leaves like in the first image. ...
POINTS_TABLE = [3, 5, 7, 1] function score(answer) { result = 0 for i in 0..4 result += POINTS_TABLE[answer[i]] return result } answer = [1, 2, 1, 0] s = score(answer) The sum performed is 5 + 7 + 5 + 3 = 20. It uses the values from the input as the indexes to read from the POINTS_TABLE. This is the style...
I have been reading the paper of F. Cohen about viruses, here is the link: https://web.eecs.umich.edu/~aprakash/eecs588/handouts/cohen-viruses.html I quite not get the following part: Detection of Viruses In order to determine that a given program 'P' is a virus, it must be determined that P infects other progra...
I am to find the time complexity of my algorithm and I found one method here. However I am really not sure about it correctness thus I would like to check it. There is my algorithm (N is a set (len(N) is constant) and C is a number): def f(N, C, k = 0): if C < 0: return 0 if C == 0: return 1 ...
In The Algorithm Design Manual section 5.9.2, covering graphs and articulation vertices, Steven Skiena writes Let reachable_ancestor[v] denote the earliest reachable ancestor of vertex v, meaning the oldest ancestor of v that we can reach by a combination of tree edges and back edges. This phrasing is ambiguous. ...
It seems to me that one way computer science could be divided up, is into three domains: What is efficient for humans to represent and comprehend What is efficient for computers to represent and process An idealized form of how computation/problems are defined that is extremely succinct, specific, and not tied to hum...
I am studying pure type systems, particularly the calculus of constructions, and trying to use an encoding for recursive types on it, which, according to Philip Wadler, is possible. As an example, I'm using the Morte Haskell library to encode Scott numerals as given by Cardelli. A summary of the encoding is as such: gi...