instruction
stringlengths
35
29.1k
The longest common substring (LCS) of two input strings $s,t$ is a common substring (in both of them) of maximum length. We can relax the constraints to generalize the problem: find a common substring of length $k$. We can then use binary search to find the maximum $k$. This takes time $\cal O(n \lg n)$ provided that s...
Here is an experiment I came up with (I don't have sufficient material to make it): Say that, you have a list of $n$ numbers $L = \{l_1, l_2, ..., l_n\}$. And you have bars representing those numbers like so: Say that, width of every bar is $w$. Imagine a line, thatis made up of $n$ line segments, each of them are $w$...
I don't consider myself very good at math, but nevertheless I enjoy solving optimization problems like the ones often asked in ACM ICPC (a college programming competition). I recently came across an issue while trying to solve one of such problems. I'd appreciate any help to find a linear algorithm (something better th...
I have, lets say, 8 bits mantissa and 4 bit exponent. Then, -1=1111 1111 there are no 0s so how can I normalise -1 in 2's complement form?
I wonder why people assume the domain of a computable function is $\mathbb N$? For example, in Wikipedia. Can its domain be any countable set rather than $\mathbb N$? Can its domain be an uncountably infinite set?
For a formal language, I wonder what differences and relations are between its syntax and its formal grammar. A formal grammar is a set of formation rules that describe how to generate the strings that belong to the formal language. Wikipedia says that syntax is "the study of the principles and processes by which s...
I am currently working with a very large Social Network and I want to recreate this graph with a smaller dimension, using the original Degree Distribution and Clustering Coefficient Distribution. The degree distribution is the relative frequency of vertexes in the original graph that have a certain degree. The cluster...
How can you specify the "inverse" of a word, so: let's say a word consists of a's and b's the language is: $ww^{-1}$ the second word is the same as the first but every a is replaced by b and every b by a
I have already asked a similar question here, but since I have not got an acceptable answer, I decided to ask a simpler version of the question here. Let $M|\mathbf w$, where $M$ is a matrix and $\mathbf w$ is a subset of the column indices, denote the matrix formed by selecting columns $\mathbf w$ from $M$. Problem:...
It can be shown that the logical preposition [ :- (~A->A)->A ] is a theorem (always true). I want to know if anybody knows a real life description for the preposition above? I mean an expression in computer, economics, mathematics, politics or anything that fits in that preposition.
When I first heard of these things I was very fascinated as I thought it sets really a limit to mathematics and science in general. But how practically relevant are these things? For the Halting Problem: Are there more than some artificially constructed cases, where one can't decide whether the algorithm will terminate...
The $G(n,p)$ random graph model creates graphs with $n$ vertices and each possible edge exists independently with probability $p\in (0,1)$. Much is known about the (expected) size of a largest clique in these graphs, and it has been shown that the expected number of maximal cliques of size $d$ is $${n\choose d} p^{d ...
If I store a directed graph $G$ in adjacency list format, one can find all the out-neighbors $j$ of a given vertex $i$ in $\mathcal O(d)$ time, where $d$ is the max degree of the graph. These are all the vertices $j$ such that $(i,j)$ is an edge of $G$. On the other hand, if I want to find all the in-neighbors of $i$, ...
I am working through the following paper "Data Structures for Storing Small Sets in the Bitprobe Model" by Radhakrishnan et al. and am confused regarding one of their arguments about a lower bound. In particular, they are trying to show that $s_A(2, m, 2) \in \Omega(m^{4/7})$. That is, the goal is to store a set $S$ of...
There are several online quantile estimation algorithms, but I haven't seen any that supports deletions (i.e. unobserve elements observed in the past). Are there any such known algorithms? To motivate my question: I'd like to maintain some quantile estimation data structure from the start of time (t0) and take a snapsh...
I'm studying for my Computer Architecture exam next week, and I'm having problems understanding how a set associative cache works and how to solve related problems like this one : "A set-associative cache memory uses a set of 8 words. A replacement procedure based on FIFO algorithm is implemented by means of 3-bit coun...
I read this paper: http://www.sciencedirect.com/science/article/pii/S0166218X04001131?np=y (you can check the PDF online for free), and I translated section 4's Fun-sort algorithm (correct me if I'm wrong): binary-search(A,x): A[0]=-∞ A[n+1]=∞ //|A|=n l=0 h=n+1 m=⌊(l+h)/2⌋ while (h != l+1) ...
I am self-learning about formal languages. I learned that the family of the regular languages can be defined inductively, in terms of the operations they are closed under (namely the smallest fix-point). This definition doesn't rely on regular grammars or finite state machines. I wonder which other families of formal l...
I'm trying to describe a TM through denotation of the transition function. Given is a TM that recognizes the language $$ L ={\{w\#w} \mid w \in {\{0,1}\}^*\} $$ over the input alphabet: $$ \displaystyle\sum = {\{}0,1,\#\} $$ My guess is first to place a word $$ w \in {\sum}^* $$ on the tape, and in every cell a symbo...
I want to find the worst-case running time of an algorithm, which follows the following recurrence equation: The worst-case running time is $\Theta(n^2) + T(n, 2, n)$, where $T(x, i, y) = \begin{cases} 1 & \textrm{if $(x=0)$ or $(y=0)$ or $(i > n)$} \\ x+y+ T(x-a,\quad i+1, \qquad b)\\ \ \qquad+ T(x-a,\quad i+...
I'm looking at the following problem: Given $n$-dimensional vectors of natural numbers $v_1, \ldots, v_m$ and some input vector $u$, is $u$ a linear combination of the $v_i$'s with natural number coefficients? i.e. are there some $t_1, \ldots, t_m \in \mathbb{N}$ where $u = t_1 v_1 + \dots + t_m v_m$? Obviously the rea...
I am looking for standard math courses (Calculus 1, Calculus 2, Linear Algebra, etc.) that were developed specifically for computer scientists, and use computer-science examples for motivation. For example, the pagerank algorithm can be used to motivate eigenvectors and eigenvalues.
I'm reading about Multiset Size Verification Problem and in the following paper - http://www.skynet.ie/~sos/mapviewer/docs/Voronoi_Diagram_Notes_2.pdf - I got stuck just on the first lemma. However, since my concrete problem is rather specific, I'll describe it as self-contained, so that no background in terms of what ...
I apologize if this question is already answered and appreciate any pointers to existing answers. I'm not familiar with statistical or data mining terms so my search was limited to basic words used in the title of this question. I did look at some algorithms but could not decide if they serve the purpose. I'm looking ...
In class, we saw the Miller-Tucker-Zemlin formulation of the Travelling Salesmen Problem (TSP). MTZ is a way of formulating the TSP as an integer linear programming instance. I understand how MTZ works, but I'm confused why MTZ is considered a better algorithm for checking for sub-cycles and rejecting them as answers ...
I am continuing with my self-study of formal languages. Given two alphabets $\Sigma$ and $\Delta$, a string substitution is a mapping from $\Sigma$ to $\mathcal P(\Delta^*)$, which induces a mapping from $\Sigma^*$ to $\mathcal P(\Delta^*)$. In case that a string substitution is a string homomorphism, it is a mapping...
Wikipedia says, the context-free languages are closed under the cyclic shift of $L$ (the language $\{vu : uv \in L \}$) So I am looking for the definition of the cyclic shift operation on formal languages. From the quote, what are required on $u$ and $v$? Are they in $L$, or in $alphabet(L)^*$? Thanks.
does a good known algorithm exists for this problem? On input I have two series of timestamps "when the event was observed". Theoretically the recorded timestamps should be very well aligned. Visualized ideal situation on two time lines "s" and "r" as recorded from the two devices: but more likely they will not be so ...
I noticed that the most convenient way to deal with quotient structures (like the rational numbers or other equivalence classes) within ZFC is to select a unique representant from each equivalence class, which is possible due to global choice. Then I noticed that this strategy also seems to work quite well in practice,...
Input: A max binomial heap $H$, and a pointer to a node $V$. Output: A max binomial heap, where all the children of $V$ are multiplied by 2. I have tried solving this by taking out the node $V$ together with it's sub-tree, multiplying all the children of V by $2$, rearranging the heap to close the hole, and adding V's ...
I want to search from a given set of elements. Along with that I also want to remove that searched element. The problem is that the number of these queries is $q=O(n)$, where $n$ is the number of total elements. Which data structure should I use. Also, I want to avoid hashing.
I have a tetrahedron $t$ and a polyhedron $p$. $t$ is constrained such that it always shares all its vertices with $p$. I want to determine whether $t$ lies inside $p$. I would like to add one detail to the problem in case it may contribute to the solution: $t$ is a Delaunay tetrahedron and faces of $p$ are triangular ...
From Wikipedia: The prefixes of a string is the set of all prefixes to a string, with respect to a given language: $$ \operatorname{Pref}_L(s) = \{t \mid s=tu \mbox { for } t,u\in \operatorname{Alph}(L)^*\} $$ here $s\in L$. So is it equivalent to $$ \operatorname{Pref}_L(s) = \{t \mid t \mbox { is the f...
Is there a software algorithm can generate a non-deterministic pattern or sequence? In Chaos theory, simple processes can create deterministic patterns, and psudo-random number generators can generate deterministic numbers with the same seed. Is there a software algorithm that can create completely non-deterministic pa...
Suppose I have an algorithm that works as follows when invoked: it calls itself recursively with probability $0 < p < 1$ and terminates with probability $1-p$. Does this algorithm terminate? On the one hand you can show that $\lim_{n \to \infty}p^n = 0$, so it must terminate at some point before infinity. On the other ...
I was watching the videos from Skiena's Computational Biology Lectures, which is also available at youtube. In those videos, the professor made a statement that, most of the problems posed to computer scientists by biologists were proved to be NP-Complete. My questions are the following ones: ( Please forgive me, if I ...
The Wikipedia summary of the Kosaraju-Sharir algorithm is as follows: Let G be a directed graph and S be an empty stack. While S does not contain all vertices. Choose an arbitrary vertex v not in S. Perform a depth-first search starting at v. Each time that depth-first search finishes expanding a vertex u, pu...
Let's say that we want to design a semi-definite programming approximation for an optimization problem such as MAX-CUT or MAX-SAT or what have you. So, we first write down an integer quadratic program that solves the problem exactly. For example, in the case of MAX-CUT we would write: $$ \max \sum_{\{u,v\} \in E}{\fra...
Consider the following problem: $$A=\left\{ (G(V,E),s,t)\mid\text{conditions 1, 2, 3 and 4 hold} \right\}$$ $G$ is a directed graph. $s,t\in V$. There is a simple path from $s$ to $t$ (a simple path is a path that visits every vertex not more than once). $\forall v\in V: \deg^+(v)\leq 2$ (in words: every vertex in ...
Input: 2 RB Trees A B, so that both values in a certain range, so that B's range is smaller than A in both sides. Ex. B's range can be [100...200] and A's range is [0...1000] Output: Unite A and B to one RB Tree AB. How can I unite these 2 trees in $O(log(n))$ time and with additional space $O(1)$? I have tried splitt...
From a paper An AND-compression is a deterministic polynomial-time algorithm that maps a set of SAT-instances $x_1,\dots,x_t$ to a single SAT-instance $y$ of size $poly(\max |x_i|)$ such that $y$ is satisfiable if and only if all $x_i$ are satisfiable. My question is: Is $t$ treated as constant? Another paper gives ...
I am unable to find a clear definition of term "size of the instance" when considering some algorithmic problem. I came accross a definition that said, that "Size of the instance corresponds to the size of the input array of numbers (in case the input is numeric) or size of the representation of the input." Is the size...
For a connected undirected graph $G$, given a particular vertex $v$, is there a known (efficient) algorithm to find all simple cycles in $G$ that contain $v$? In my case, I have weights for every edge. Ideally I'd like to be able to compute, for every $v \in V(G)$, the product of the edge weights over all cycles that ...
An imaginary processor has the following hardware specification: 8bit data bus 12bit address bus 32 × 8bit general purpose registers e.g. S0 – S1F Briefly describe what bit fields are required within an instruction to encode the following functionality: 56 different instructions Register addressing e.g. ADD...
Huffman encoding will perform best when the distribution of symbols of an alphabet that the string to be encoded uses is dyadic. Given an arbitrary bit string S, how can we find the best alphabet for encoding? Suppose S is an ASCII file. Then given the regularity of 1-byte characters that such files exhibit, we would e...
A producer wants to arrange couples of boys and girls for a dance. There are n boys arranged in a row [A1...An] in some certain order and n girls arranged in a different row [B1...Bn], also in some certain order. Only a couple in which there is a boy and a girl with exactly the same height can dance. The height of ever...
Input: A binary heap of size $n$. $n$ is even. Output: 2 binary heaps of size $n/2$ each. I found this question in a solved algorithms test and the solution said: "There is no better solution than to build 2 completely new heaps using BuildHeap() - $O(n)$ time." I have thought about taking out the root out of the origi...
I have a homework question which I would appreciate some help with: Let there be a DAG $G=(V,E)$ with positive weights. For every two different vertices $v_1, v_2$ we will define $D(v_1, v_2)$ to be the maximum length between $v_1$ and $v_2$ in the graph. For every two disjoint sub-sets of vertices $V_1, V_2 \subset V...
When we implement dynamic array via repeated doubling (if the current array is full) we simply create a new array that is double the current array size and copy the previous elements and then add the new one? Correct? So to compute the complexity we have 1 + 2 + 4 + 8 + .... number of steps? Correct? But 1 + 2^1 + 2^2...
If I have a sorted array of size $n$, can I build a Red Black tree out of it in $O(n)$ time in a different algorithm rather than splitting the tree in half every time or the straightforward way that was mentioned in one of the answers?
Suppose a person states the following: $n^2 = (n * n), \forall n > 0$. One can check such equality by saying, via proof by induction, that: for $n := 0:\ 0^2 = (0 * 0)$; for $n := 1:\ 1^2 = (1 * 1)$; and for $n := n + 1:$ $\ (n + 1)^2 = ((n + 1) * (n + 1))$ $n^2 + 2n + 1 = n^2 + 2n + 1$ As far as I understand, this s...
Wikipedia says, the regular languages are closed under arbitrary finite state transductions, like quotient K / L with a regular language. I wonder what kinds of operations "finite state transductions" are? Btw, It links to finite state transducer, an automaton. Thanks.
If one were to show that an NP-complete problem had $2^{n^{O(1)/\log{\log{n}}}}$ circuit complexity, what would the consequences of this be?
I have an algorithm similar to this: i=1 while(i < n) { //something in O(1) while(i < n && cond) { //something in O(1) i++ } i++ } Where "cond" is some condition which can be checked in $\mathcal O(1)$. It is clear that this algorithm is $\mathcal O(n^2)$. But is it also $\mathcal O(n)$? I'd say yes be...
Given: n variables in X, and m sets of variables where each set, Ci contains a subset of X. I am trying to generate the graph G = (X, E) by picking the edges in E given the following constraints. Variables in each set Ci must be connected by a spanning tree (no extra edges). The graph should prefer spanning tree confi...
If $B$ is a complexity class, then the class $P^B$ (for example) is defined as the set of problems that can be run in polynomial time, given an oracle to every problem in $B$. That's what they told me in my Theory of Computation class, anyways. Per this definition, it seems to me that $P^P$ captures every decidable la...
I have a project in which I need to compare different distances in a database with a distance in input in order to identify a person. For that I use this expression: DistanceDB - DistanceInput < epsilon, if this is true then the distance and information in the Database row are related to the person standing before the ...
Is it possible to calculate the average between n numbers in a static random access array of some size in less than $O(n)$ time? I know that the trivial approach is $O(n)$, but can I do it in less time using a data structure or a certain preparation? or both? I am asking for hints, not a solution. Note: The array is of...
Given a $n\times m$ matrix $A$ of integers, find a sub-matrix whose sum is maximal. If there is one row only or one column only, then this is equivalent to finding a maximum sub-array. The 1D version can be solved in linear time by dynamic programming. The 2D version can be solved in $\cal O(n^3)$ by looping over all p...
I have here a little problem with my homework, and would appreciate some direction. I am attempting for some time now to show that every planar graph is embeddable into a grid (As large as needs be). I tried to make this argument inductively in many ways, but I am afraid that I don't see any good way to do that so far....
The language recognized by an automaton is defined as the set of strings that are accepted by the automaton. I wonder if it is possible that the languages recognized by two automatons are the same? Note, if I am correct, the most general automatons are the Turing machines, and the languages recognized by an automaton a...
I understand that most problems are trivial if a halting oracle is available (or, I think equivalently, hyper-computation). However, applying the argument that shows the Halting Problem is impossible for a Turing machine also shows that it is impossible for a Turing+oracle to decide the Halting Problem for a Turing+ora...
Wikipedia says: A trio is a family of languages closed under e-free homomorphism, inverse homomorphism, and intersection with regular language. A full trio, also called a cone, is a trio closed under arbitrary homomorphism. A (full) semi-AFL is a (full) trio closed under union. A (full) AFL is a (full) semi-AFL cl...
I am referring to the algorithm from the Wikipedia page on the Floyd–Warshall algorithm. In case of undirected graphs should I change the assignment statement inside the if condition to dist[i][j] = dist[j][i] = dist[i][k] + dist[k][j] or they are equivalent?
From Wikipedia's definition of regular langauges The collection of regular languages over an alphabet $Σ$ is defined recursively as follows: The empty language $Ø$ is a regular language. For each $a ∈ Σ$, the language $\{a\}$ is a regular language. If $A$ and $B$ are regular languages, then $A \cup B$ (union), $A •...
I think I understand the RP complexity class (along with coRP, BPP, and ZPP). However, I can't seem to think of how an RP algorithm might be formulated. How can the random coin flip possibilities allow for a guaranteed response of NO when the correct answer is NO, yet return with a probabilistic chance YES or NO when t...
Got a simple construction seemingly contradicting a paper assuming plausible conjecture. Since it is unlikely the conjecture to be false, what is wrong with the argument? From a paper An AND-compression is a deterministic polynomial-time algorithm that maps a set of SAT-instances $x_1,\dots,x_t$ to a single SAT-inst...
I am trying to prove the NP-Hardness of the MAX-CUT problem. Other sources seem to reduce from the NAE-3SAT problem, however I have been trying to reduce from PARTITION because PARTITION and MAX-CUT are both in Karp's list of 21 NP-Complete problems and this is the reduction that he did [1]. PARTITION: Given ($c_1,c_2,...
Which cache strategies/algorithms (especially for L2 Cache) are used in practice and don't exist solely in research/theory? There is a list on Wikipedia which does not state which algorithms are really used. Bélády's Algorithm for example would be as far as i understand it the best solution but is impossible to be used...
I try to compute the asymptotic runtime for this algorithm and compare it with other algorithm $A = (C -(D * E ) ) mod p$ $ B = ((C * (D)^{-1} - (E * F ))$ mod p if we suppose each value A, B, C, D, E, F has O(log n) bit My attempts were as follows line one = $O(\log n)^2$ + log n line two = $O(\log n)^2$ + $O(\log n)^...
A nondeterministic automaton, after reading an input symbol at some state, may jump into any of a (finite?) number of states. Does the automaton uniformly randomly choose one out of the several states? So different runs on the same input will give different sequence of states? Does the automaton have to run in all t...
In the paper: Leslie Lamport: What It Means for a Concurrent Program to Satisfy a Specification: Why No One Has Specified Priority; ACM Symp Principles of Programming Languages, (POPL-12):78-83, 1985. Lamport shows that "...existing specifications that claim to describe prioirty are either vacuous or else too restric...
This is the edited question: Suppose I have $(x_1 \vee y_1 \vee y_2)$. x is existential and y is universal. Then it should be like this in the quantifier string: $\forall y_1 \forall y_2 \exists x_1$ (WHY?) Now suppose I introduce a new variable z and convert the above clause to: $(x_1 \vee \neg z \vee y_2 ) \land (...
I've just wondered if there is a difference between symbol recognition, classification and identification. What would you use when you have a hand-written symbol and you want to get the LaTeX code for it? Is that symbol classification, because you have about 1200 classes of LaTeX symbols? Or identification? Are some of...
Let's say I have a set $A$ of $n$ points represented by real vectors of length $l$. What type of algorithm would I use to find the subset $B$ of $m$ ($m$ is arbitrary, to be chosen) points that maximizes the volume of the polytope with vertices defined by $B$?
This is meant to be a fun question, and I hope it's not too off topic. Is there a defined mathematical object or data structure that has a name collision with a type of physical tree in the real world? In computer science we have red-black trees, B-trees, quadtrees, and so on. In the biological sense of the word tree,...
Though facing the fear that someone might not like my question but does somebody know a useful tool to either resolve left recursion or to simplify a context-free grammar automatically ? I need to resolve a rather long chain of left-recursion in my grammar. So far I've tried this algorithm and this tool. But both are...
Is there an algorithm to check whether an integer $n$ is a square? What about higher powers, e.g., testing whether $n$ is a $k$th power? I understand that the Jacobi symbol $\left(\frac{b}{n}\right)$ can be computed in $O(\log n)$ without needing to know the prime factorization of $n$ but then this seems to be useful ...
Can anybody give me a hint on how to get rid of the left recursion in the following grammar? $$A \rightarrow B \mid a$$ $$B \rightarrow b \mid C \mid D \mid E \mid F \mid G$$ $$C \rightarrow c \mid A d$$ $$D \rightarrow A e \mid f$$ $$E \rightarrow g \mid B h$$ $$F \rightarrow i \mid A j \mid k$$ $$G \rightarrow l \mid...
I've learned about tableau calculus which is a decision procedure solving the problem of satisfiability of a first order logic formula. Now I'm wondering why this technique can't be used to solve the satisfiability problem (SAT)?
Couldn't the type inference in Apple's new programming language Swift had been done more aggressive? For instance why can't the return type of a function be deduced? func sayHello(personName: String) -> String { let greeting = "Hello, " + personName + "!" return greeting }
I started reading the book "Data Structures and Network Algorithms" by Robert Tarjan, which is a classic (but a bit outdated - 1983) and I am a bit perplexed by the paragraph in the first chapter, Page 3, first paragraph. I have attached the paragraph below: An important caveat concerning random-access and pointer m...
For a single stream of elements as input every elements should be routed into a fixed number of $k$ output streams trying to keep them balanced. In the following example $k=3$ : Let's define as flow a sequence of element of the same type represented in the following diagrams using the same colour. Every flow must be r...
I have a list of millions of pairs of strings, and I want to join all of the pairs that have matching members into lists without duplicates. Example input: [["A", "B"], ["A", "D"], ["M", "Q"], ["A", "F"], ["D", "E"], ["Q", "Z"]] Example output: [["A", "B", "D", "E", "F"], ["M", Q", "Z"]] Does anyone know of an ...
Given a statement in natural language, what can be said about how many possible translations there are in first-order-logic? What happen if we take a more complex logic like second-order logic and what if we take a less complex one?
Do there exist two computable functions, a and b, which can construct every computable function by a finite serie of a's and b's which is function composed? Fx. let's take the serie, a,b,a,b,b,a,a,a , which function composed is the function, a∘b∘a∘b∘b∘a∘a∘a ( =a(b(a(b(b(a(a(a(x)))))))) ), this function is the function ...
I'm resolving this question of Hopcroft and et al Book. Figure 1 below is a marble rolling-toy. A marble is dropped at A or B. Levers $x_1,x_2$ and $x_3$ cause the marble to fall either to the left or to the right. Whenever a marble encounters a lever, it causes the lever to reverse after the marble passes, so the next...
I need to place N rects on a 2-dimensional grid with constraints. For the each rect height/width and placing limitations($x_{min}$-$x_{max}$) are known. The problem is to place all rects on a grid with no intersections that every rect's bottom left $x$ is in rect's $x_{min}$-$x_{max}$. I've implemented the naive solut...
The plots in http://blog.wolfram.com/2014/06/04/how-the-wolfram-language-measures-up/ seems to indicate that Pascal has a relatively high code density. What features of the language makes it so? Follow-up question: Does this explain why Pascal are often introduced in high schools as one of the first programming langua...
I'm looking for an algorithm that do the following thing. Given $n$ the number of rows and columns of a matrix of positive integers. Given $(x_1,y_1)$ the starting coordinates. Given $(x_2,y_2)$ the ending coordinates. and $k$ an integer. This are some rules of how you can travel through the matrix: When stepped in so...
Suppose we are given a list of $n$ events $E = \{E_1, E_2, \ldots, E_n\}$ where each $E_i$ is represented by $(s_i, h_i, v_i)$ or $(start, hours, value)$. So if you attend an entire event that lasts 5hrs and has a value of 10 then you will gain 10 points. If you only attend for 3 hours, you only get 3*(10/5) = 6 points...
some questions have been popping up recently on ambiguity in CFLs/CFGs which can have subtleties (eg languages vs grammars & ambiguity vs inherent ambiguity). wikipedia states: Many [context free?] languages admit both ambiguous and unambiguous grammars, while some languages admit only ambiguous grammars. the senten...
During an interview for a Java developer position, I was asked the following: Write a function that takes two params: a String representing a text document and an integer providing the number of items to return. Implement the function such that it returns a list of Strings ordered by word frequency, the most freq...
From Wikipedia Since there is a one-to-one correspondence between linear-bounded automata and such grammars, no more tape than that occupied by the original string is necessary for the string to be recognized by the automaton. Note: If I am correct, "such grammars" mean context-sensitive grammars. I wonder if t...
I have a 20-dimensional dataset, with a large amount of data points. I would like to have each dimension discretized into bins. Per bin, I would like to be able to access two neighbours per dimension (i.e. +1 and -1 per dimension). Basically I want to be able to easily access 2*d (where d is the dimensionality) neighbo...
how can i design XML Schema for logical and digital circuits? i cant find any help or manual for this work for example i have a digital circuits with AND OR NOR ,... gates now i want design xml and schema for that thanks for help soryy for bad english
I am confronted with task to find polynomial time complexity solution for weighted hitting set problem. I have found that usual hitting set problem is NP-complete and therefore the task seems to be contradictory. But there are several other reformulations of this problem. E.g. d-Hitting set problem can be solved in pol...
I was trying to prove the following: if x%(x/2) != 0 or x%(x/2) == 0 then x%(x/y) != 0 or x%(x/y) == 0 such that y = [2,4) So I am trying to figure out whether a number can have a factor in between its half and its fourth. I am trying to use it in a factoring algorithm.
A domino tiling is a tesselation of a region in the plane by 2 × 1 squares. What is a good data type for storing and manipulating such objects? In my current manipulation, use an array to store all the half-squares numbering them 1-2 for a horizontal domino, 3 4 for a vertical. It's not ideal but I can draw the tili...
How is Combinatory Logic relevant to software design? For example, can one transform programs into CL? If so, how? Does CL provide a canonical representation for programs?