instruction
stringlengths
35
29.1k
I'm asked to prove that, if P=NP, that 0*1* is NP-complete, but I'm having trouble going about doing it. I know it's fairly easy to prove it's NP by creating a TM to verify an input (which can be done in O(n) time, and that's polynomial). But then I now have to reduce an NP-complete problem to 0*1* in order to prove t...
The question (Prove L is NP-hard) was about proving that the following language is NP-hard: $$ L = \{ \langle D_1, D_2, ... ,D_K \rangle : k \in {N}\text{, the } D_i \text{ are DFAs and } {\bigcap}_{i=1}^k L(D_i) = \emptyset \} $$ That got me thinking about the related problem: $$ L' = \{ \langle D_1, D_2, ... ,D_K \ra...
I read a claim that there are formulas for which any equivalent CNF has exponential length. Can you show me an example for such a boolean formula? I have been trying to build it myself and failed.
I've converted this NFA to a DFA and I get a similar soultion automata but I'm not sure if I really understand everything. Please correct me if I'm explaining it wrong, I would love some feedback. From the state 0 we only have the set {0} since there doesn't exist any ε-transition. After that we have to input "a" to m...
I have a genetic algorithm in Java and I'm testing new types of selections. For my tests I'm using the De Jong Half Sphere, my fitness function is $x^2 + y^2$. The selection method used is Sigma scaling : fscaled = S + (fraw −fmean)/2σ Example using S=1 - a) Fitness = 5.927822124 | After Scaling = 0.900756351532265...
For clarity, I attach below a concise implementation of the algorithm in Python. I understand that it checks all possible element swaps, but I don't see how that necessarily means that all possible orderings of the elements will be reached, and/or that no ordering will be duplicated. For example, what if the elements a...
Does there exist a Turing machine that halts on all inputs but that property is not provable for some reason? I am wondering if this question has been studied. Note, "unprovable" could mean a "limited" proof system (which in the weak sense think the answer must be yes). I am of course interested in the strongest poss...
I would like some hints on how to approach this problem, I know for instance that $TQBF$ is $PSPACE$-$Complete$, so it can solved in poly space and any other $PSPACE$-$Complete$ problems can be log spaced reduced to $TQBF$. I believe that I need to employ the space hierarchy theorem in some way but I am not sure how, t...
I got an amount of numbers, they are shuffled and represent the individuals. For example (3,1,3,2,5,22,5) is one individual or (22,3,1,3,5,5,2). Mutation is done quite easy by permutation within an individual. The problem is to find a crossover method between 2 individuals, in which the quantity of the values stay the ...
What is the range of “the” CRC-32, the one used by Unix, Ethernet, zip, and many other industrial standards? Mathematically, a CRC is defined as follows: let $G$ be the CRC polynomial in $\mathbb{F}_2[X]$, and $M$ be a representation of the input bitstring in $\mathbb{F}_2[X]$. Let $Q$ be the quotient of $M \cdot X^{\d...
I'm searching for computer vision or machine learning algorithms/methods that are used to classify or differentiate two outdoor environments. Given an image with vehicles, I need to be able to detect whether the vehicles are in a natural open landscape (desert, in particular), or whether they're in the city. I've sear...
Is it common to try to improve an algorithm by decomposing its action on a topological piece of data (e.g. graphs, geometric data) into a series of steps, each of which only makes a local change/perturbation in a confined neighborhood of the data while fixing the rest? One benefit of this "breakdown" is improved concep...
I'm looking for a way to position nodes on a 2-dimensional plane in such a way that the distances between the nodes, which are entered exogenously, are represented visually in a way that as good as possible communicates the logical distance between those nodes. Basically, I have a set of nodes A, B, C etc. and between ...
I wish to estimate the compression ratio of a stream of bytes. Specifically, I'm interested in DEFLATE compression. I'm looking for some algorithm/heuristic that can estimate roughly the compressibility (more quickly than just deflating the stream). My main interest is not on the absolute value of the compression (tho...
Is it possible to build DFA that support \d, \w, .(any symbol)? I understand that we can add each symbol from [0-9] as a separate edge for some of the symbols, but what about the others? for example .(any symbol)? or \S (not white space)? In other words, can we build equivalent DFA for this NFA (1) ---a----> (2) | |...
When can an algorithm be said to have $O(1)$ complexity? My doubt is if $n$ is specified to be a large number but constant and we cannot implement it in reality without a loop even then can we call it to have $O(1)$ time complexity? Consider the following examples. Algorithm to add first 1000 natural numbers (that is ...
Let's say we want to draw the transition graph of a Turing Machine that accepts that language L and then write the sequence of moves done by the TM when the input sequence is $w = abbcbba$ so I had some thoughts on how this could be built. $q0 - q1: a,a,R$ $q1-q2: b,b,R$ $q2 (loop): b,b,R$ $q2-q3: c,c,R$ $q3-q4: b,b,R...
It is NP-hard to approximate maximum 3D matching problem even if each element occurs exactly in two triples. I'm interested in the following decision version of 3D matching. Informally, Given a set of triples $F$ of elements such that each element occurs exactly in two triples, Is there a subset of $F$ such that each ...
Suppose we are given an array of numbers representing lengths of line segments. Find which three of these segments can be assembled into a triangle with maximum area. I can compute the areas of all $O(n^3)$ possible triangles in $O(n^3)$ time using Heron's formula, and then return the largest. Can this be improved to ...
I have this nondeterministic pda: $$\Sigma= \{a,b,c\}$$ and $$ L=\{\omega\ \epsilon\ \Sigma^*\ |\ \omega\ = \alpha\beta\beta^R\gamma\ and\ \alpha,\beta,\gamma\ \epsilon\ \Sigma^*\ and\ |\beta|\ >3 \} $$ So once i have create the NPDA, i have to calculate the probability of accepting a correct word, i know it depends...
I always see that people in the fields consider confusing vectors with positions as a severe error in one and n dimensions. Recently I have also encoutered a timedelta type in Python. By increadably inadequate reaction and severe punishment, I realize that people in the fields taboo answering why is the difference. Mig...
Presume I have the following case: int value a int value b, for which a < b int value i, for which a <= i < b I need an int value x, for which a <= x < b, randomly chosen, according to a non-uniform distribution: the distribution should follow a bell curve which is centered around i. In Java, I have the following met...
So I've been given the following language on an assignment. It is the only question I have left of 10, and I've been racking my brains out trying to solve it for hours. $$L=\{w:w\in(a+b+c)^*, n_a(w) > n_b(w)>n_c(w)\}$$ where $n_x(w)$ represents the number of character $x$ found in $w$. The problem statement is: pro...
I am a CS student. When I first came to school, I thought that programming was to make a software. Now I found I was wrong. Now I want to know what the difference is, and what is the difference between a programmer and a software engineer. I hope people can give me some advice. (forgive my broken English)
Given non-repeated list of integers $a_1\dots a_n$, is there $ATLEAST\mbox{ }ONE$ subset of them that sum to $0$. This problem is NP complete. Given non-repeated list of integers $a_1\dots a_n$, are there $ATLEAST\mbox{ }TWO$ subsets of them of sizes $n_1$ and $n_2$ such that $n_1+n_2=n$ each of which sums to $0$. Is...
How would you approach the knapsack problem in a dynamic programming situation if you now have to limit the number of item in the knapsack by a constant $p$ ? This is the same problem (max weight of $W$, every item have a value $v$ and weight $w$) but you can only add $p$ item(s) to the knapsack and obviously need to o...
Background. I am writing some code for semi-automated grading, using peer grading as part of the grading process. Students are given pairs of essays at a time, and the students have a slider to choose which is better and how much better it is. e.g., the slider might look something like this: A---X-B Based on the resul...
What bad things can occur when the lengths of the time slices in a multitasking system are too small? What can happen when they are too big? How should the length of the time slice be chosen?
I have an ensemble of points in 3D space, represented by their coordinates $\mathbf{c_i}\equiv(x_i,y_i,z_i)^\top$ . I need to calculate the distance between all these points: $\quad\forall i,j\quad d_{ij} \equiv |\mathbf{d_{ij}}|\equiv |\mathbf{c_j}-\mathbf{c_i}|$ the scalar product between all distances that share a ...
My doubt is based on the relation between regular grammar and regular languges $S \to Sa\ |\ a$ produces the regular language $a^+$ but this grammar is not type-3 grammar of Chomsky classification. So am I correct in stating that this is not a regular grammar even when it produces regular language?
Given is the following graph which is logically divided into layers (with Dijkstra's shortest paths algorithm): Vertices Layer Root 0 / \ A B 1 / \ | C D E 2 \ | / \ | / F 3 Now I'm looking for an algorithm which groups vertices when they have a (single) common ...
Is the language $L_{universal} = \{ \left \langle M \right \rangle | M \textrm{is a universal turing machine} \}$ decidable? I'm guessing it is decidable according to the definition of a UTM, that a UTM must be able to calculate every recursive function. Since the set of recursive languages and the set of all input wo...
Given the following multiplication table how could one construct an NFA such that it accepts all strings that have a certain product (say a) ? The string "abcb" would be evaluated as (a(b(cb))) = a \begin{array}{c|ccc} \times & a & b & c \\ \hline a & a & a & c \\ b & c & a & b \\ c & b & c &a ...
I'm studying for my CS final and I can't seem to get the anywhere with one of the questions. This is the question: Prove that if a node in a BST has a successor, but has no right child, then its successor must be an ancestor. (We will consider only BSTs with distinct elements.) I know that a successor is the node that ...
I need to modify the Dijkstra's algorithm to get the shortest path in a directed graph and get the one with the least amount of edges if there are equal paths. I am thinking to add another data field to count the number of edges from start and compare them in same way as weights. Would that work?
I have a question to find out that L = {a^(2k)|k>=1} is regular. I know that it is regular set but I was looking to find out if pumping lemma is satisfying or not. So I tried it as - Let # of states in the FA be n & I select the string w = a^2n Now let xyz = w xy = a^n y = a^m | m is odd number now x(y^2)z = a^(n-m)(a^...
I need to compute the bottleneck shortest paths from s to all vertices of a graph by modifying the Dijkstra’s algorithm. I found this explanation on Wikipedia(Link to Wikipedia) but I would appreciate if you can elaborate it a bit for me. If the edges are sorted by their weights, then a modified version of Dijkstra'...
There are many techniques to prove that a language is not context-free, but how do I prove that a language is context-free? What techniques are there to prove this? Obviously, one way is to exhibit a context-free grammar for the language. Are there any systematic techniques to find a context-free grammar for a given ...
This question is inspired by this SPOJ problem. That problem asks median of the final array, that can be done in $O(k+n)$, where k is the number of update queries and n is the size of the array. The variant : Given an array of length N (of the order $10^5$), initially all elements are 0. There are K (of the order $10^5...
I am a physicist, with little formal training in computer science - please don't assume I know even obvious things about computer science! Within the context of data analysis, I was interested in identifying clusters within a $d$-dimensional list of $n$ data-points, for which the dimensionality $d$ could be $\sim100$,...
I can see from this question that a $K_{r + 1}$-free graph with $n$ vertices and $e$ edges contains an independent set of order at least $$\frac{n}{2e/n + 1} \tag{1} $$ Since for a $C_{n}$/$P_{n}$ we know how many edges it contains it is easy to determine (1). However, are there any particularities of cycle graphs and ...
I have come across many sorting algorithms during my high school studies. However, I never know which is the fastest (for a random array of integers). So my questions are: Which is the fastest currently known sorting algorithm? Theoretically, is it possible that there are even faster ones? So, what's the least complex...
I need to describing a Turing machine that computes $\lceil\log_{2}(n)\rceil$ I know that: n = 1, 2, 3, 4, 5, 6, 7, 8, ... f(n) = 0, 1, 2, 2, 3, 3, 3, 3, ... So I'm thinking of putting $n$ on the tape. Then keeping a count of how many times I multiply 2*2 until it is greater than than $n$. For example for n=5, 2*2*2=8...
Let $n$ be an integer, and let $\mathbb{Z}$ denote the set of all integers. Let $[a,b]$ denote the interval of integers $\{a,a+1,a+2,\dots,b\}$. I am looking for a data structure to represent a map $f:[1,n] \to \mathbb{Z}$. I want the data structure to support the following operations: $\text{get}(i)$ should return ...
All the article I can find seems to talk about multitasking and context switch as its a two different thing. It seems that multitasking and context switch are the same thing.
How does one construct the residual network in such a case? The formula is for edge $(u, v)$ is $$rf(u,v) = (c_{\mathrm{upper}}(u,v) - f(u,v)) + (f(v,u) - c_{\mathrm{lower}}(v, u))\,,$$ where $rf(u, v)$ is the residual flow on the edge $(u, v)$, $c_{\mathrm{upper}}$ and $c_{\mathrm{lower}}$ are capacities on the edge...
I am looking for an efficient way to count the number of coprime vectors in a finite and bounded set of integer vectors. The vectors in my set are $N$-dimensional integer vectors whose components are bounded on the top and bottom by an arbitrary value $K$. Let $x = [x_1,x_2,\ldots,x_N]$ denote a vector from this set. T...
Please correct my statement. Assuming $L\in NP$, and algorithm A can determine L in poly-time in a nondeterministic machine, we have algorithm $A'$ and the complement of $L$ -- $L'$. $x$ is the input of $A'$ A'(x) { if(A(x) is true) return false else return true } In this code, it seems like $A'$ can...
I'm having trouble understanding some language notation, primarily what rules I can take away from it. The language is as follows: $\qquad L = \{a^n b^m b^p c^p b^{n-m} \mid n > 0, m < n, p > 2\}$ My goal is to create a context free grammar from this, but I can't get my ahead around the rules in place here. In plain En...
I read on a blog that there are mistakes in Karp's paper where he proved that 0-1 programming is NP-Complete, but I couldn't find it, can anyone explain? And I doubt that there are also mistakes where he proved Steiner Tree Problem is NP-Compelete but not sure. The blog post a little old and I thought asking the writer...
There is a 64 KB 1-word cache, and a word is 32 bits. From that I can derive that the length of the tag field is 16 bits, the length of index field is 14 bits, and, as my professor taught me, there is always 2 bits left behind for a byte offset. Why the offset field is 2 bits, other than it fills in the remaining 2 bi...
My friend asked this problem recently & am not sure which sorting to use for this kind of problem:- There are 20 stones of different heights. Each stone is so heavy, we need to sort the stones such that smallest stones are to left and highest to right. As stones are heavy make algorithm which moves stone least distance...
A YouTube video I was watching explained the differences between Imperative and Functional programming by demonstrating how the numbers from 1 to 10 are summed up in Java and in Haskell respectively. In Java, you must explicitly state each step and assign the result of each step to a variable - something like the foll...
All of the solutions for the zebra puzzle have a variable for each of the properties and a domain with the possible values. For instance A for Nationalities, B for pets, ... Ai with i = 1..5 and the domain for example {Dutch, Spanish, Italian, French, English} As I've seen in the n-queens puzzle, there can always be mu...
There seems to usually be a tight connection between decision problems and (corresponding) optimization problems in general. However, is this always the case? Are there examples where the typical "tight coupling" between a decision problem and the correponding optimization problem breaks down or behaves in an unusual...
when converting an NFA to DFA, we create sub-sets of states in the NFA. does it mean that every DFA-converted-from-NFA contain 2^Q states? or if some sub-sets are unreachable then they are not included in it?
On one hand, Horn-SAT is known to be tractable in linear time - where Horn-SAT is the problem of deciding whether a given set of propositional Horn clauses (with at most one positive literal) is satisfiable or not. On the other hand, Double-SAT is NP-complete (see this post : Proving Double-SAT is NP-complete) - where ...
I need some help in understanding the 'Tabu Search' Algorithm. (Wikipedia) I miss a simple explanation to Tabu Search. Anyway, I'm trying to refer to available resources and build an understanding. This is what I'm trying to 'digest': Tabu Search is an improvement over the Hill Climbing algorithm (Ref-1). The problem...
Upon reading Do source code optimizers exist? I knew that such programs existed but the ones I have worked with use a set of rules to drive a transformation algorithm. Ira Baxter provided a link to the tools running the algorithms with his answer but what I was more after from the question was the rules. In the commen...
When I was studying Comp Sci, we had Garey & Johnson as a course textbook, with a large collection of NP-Complete problems. But by that time you could also have a look at the Compendium of NP Optimization Problems, online. However, it seems the 'Compendium' site has not seen any updates in several years. Is that indeed...
What type of algorithm would you suggest me to use for this problem? I want to implement an algorithm that minimize the total distance in a graph (TSP) but for only X nodes. Also, we can go as many times we want on every vertices and/or edges. Let's say, on my graph, that I want the minimum distance for visiting every ...
I am working on my thesis which involves using ant based techniques for graph clustering. I am testing the algorithm currently and I was wondering if there is a way that I can visualize the clusters of a given graph. In this case, I have the graph as a file and another file corresponding to the clustering where each no...
I have a multi-label classification problem, in which each input sample has a set of zero or more output labels. I have a multi-class classifier which, for every input sample, returns a certain score for each of the output labels. One way to use this multi-class classifier for multi-label classification is to calculate...
I came across following question: There is a building with N floors. We have a balls of same property and have a breaking point of X floor. i.e, If ball dropped from X+1 floor then the ball will break. if ball is dropped from X or less than X then it wont break. Now design an algorithm to find X if N is given. My Solut...
Given any infinite regular language $L$, how can I prove that $L$ can be partitioned into 2 disjoint infinite regular languages $L_1, L_2$? That is: $L_1 \cup L_2 = L$, $L_1 \cap L_2 = \varnothing$, and $L_1$ and $L_2$ are both both infinite and regular. So far, I thought of: using the pumping lemma such that $$ \beg...
What is an $O(n \log n)$ algorithm to find how big the largest subset of $n$ axis-aligned rectangles (in the plane) that contain a common point is? Perhaps by reducing this to a problem with such runtime? An $O(n^{3})$ algorithm could be for each of the n rectangles for each of the 4 sides of the rectangle ...
Let $X = \{\langle M \rangle\ |\ M\text{ is a finite state machine and }L(M) = \emptyset\}$ where $\langle M \rangle$ is an encoding of the machine $M$. Is $X$ Turing decidable? Why or why not?
$$ (\neg A \wedge \neg C) \vee (\neg A \wedge D) \vee (\neg A \wedge B) \vee (\neg B \wedge \neg C) $$ can simplify down to  $$ (\neg A \wedge D) \vee (\neg A \wedge B) \vee (\neg B \wedge \neg C) $$ I've computed the truth tables for the two expressions, and they're the same. But I'm supposed to prove it without using...
So I recently had a problem where I had to create a regular language. After consulting my professor on my solution he told me it was close to correct but to check my definition of a regular language. I am somewhat lost on why my solution is not regular? From my understanding it meets the requirements of being a right ...
Consider the following grammar, where $ [ \ ] \ | \ , \ $ are terminal symbols $ \begin{eqnarray} L \rightarrow [ \ ] \qquad(1) \\ L \rightarrow [ \ H\ T\ ] \qquad(2) \\ H \rightarrow L \qquad (3) \\ H \rightarrow L\ ,\ H \qquad (4) \\ T \rightarrow |\ L \qquad(5) \\ T \rightarrow \epsilon \qquad (6) \end{eqnarray} ...
Imagine that we have an array like structure A with n elements all of which are initially 0. ($A[i]=0$) What is a data structure that supports the following operations: 1) Given an element A[i]=0 set A[i] to 1 in O(1) worst case 2) Given the index i return A[i] in O(1) worst case 3) Given the index i retrun the smalles...
Given the following: $$\{ w\#x \mid w^R \text{ is a substring of $x$, with $x$ and $w \in \Sigma^*$} \}$$ What does $w\#x$ denote?
I am interested in simulating any turing machine with a turing machine that is allowed only to move right. I guess that it should be pretty standard material and likely it is trivial (or known to be false). Does anyone have a pointer to a reference?
The intersection of a context free language L with a regular language M, is said to be always context free. I understood the cross product construction proof, but I still don't get why it is context free but not regular. The language generated by such an intersection has strings that are accepted both by a PDA and a D...
It is known that 3-SAT belong to - NP-Complete complexity problems, while 2-SAT belong to P as there is known polynomial solution to it. So you can state that there is no such reduction from 3-SAT to 2-SAT unless $P=NP$. I am looking for strong proof for this state, regardless NP belong to P or not.
Given $A,B$ regular languages with $A \prec B$. Prove the existence of $C\in L_{\text{regular}}$ so that: $A \prec C \prec B$. Here, $A\prec B$ stands for: $A\subset B $ and $B\setminus A $ is infinite. I tried to go for: $C=\overline{B} \cup A$ and some other options but it didn't work out.
I am trying to figure out if there exists a DFA $M$ with $k+2$ states (for every $k\in \mathbb{N}$ ) so that every automaton which accepts $L(M)^R$ has at least $2^k$ states. I am trying to find an example of such a DFA, any help?
I have a question: Every Decision problem has a method, turing machine or algorithm to solve it? If the answer is not, Could show me any example?
From wikipedia: "Typically, a cache-oblivious algorithm works by a recursive divide and conquer algorithm, where the problem is divided into smaller and smaller subproblems. Eventually, one reaches a subproblem size that fits into cache, regardless of the cache size." (Is this recursive subdivision manual, or automated...
I have been doing a little reading up on bubble sort and have read on wikipedia that it's complexity is measured as $\Theta(n^2)$ This bubble sort however is slightly more efficient. I thought this would be the best place to ask how I would work out this particular implementations complexity seeing that the number of i...
I'm learning about Logic; I've devised a few sentences to convert into logic to test myself and see if i've grasped the topic. It would be of great help if you could tell me if i'm doing it right! Every student who likes chocolate is smart: (Every student) (who likes chocolate) (is smart) ∀x ∈D, [Like (Student (x), c...
I am doing an assignment for my 1st year langauges and automata class. I have been having trouble with the last question which is this: Create a Turing machine that acccepts more a's than b's. I think I am supposed to pair the a's and b's together and then do some more but I can't wrap my head around it. Would help gre...
Can we solve an EXPTIME-complete problem in polynomial time given 2^N processors?(N is the size of input).
I am trying to reduce 3-sat to 2-sat. With my reduction, I can find one assignment that satisfies them both, but there are some assignments that satisfy only the 3-sat. Does it make my reduction invalid? Is 3-sat required to be equal-satisfiable to 2-sat to call it a reduction?
I'm reading a definition of PSPACE and say: are the decision problems solvable in polynomial space on a Deterministic Turing Machine. My question is: Why NP is in PSPACE?. I have a doubt beccause for example a SAT problem is solvable in Non-Deterministic Turing Machine and SAT $\in NP$ and not in $P$.
What books would you recommend for someone starting B.Sc in Computer Science? My Personal Info: I am currently looking at B.Sc in Computer Science (Games), which is computer science, accept for the last year which is tailored more towards game dev. I have a fair bit of programming experience with Unity and other thing...
I have written an algorithm for clustering data-points with their nearest neighbours with a Euclidean distance metric. I estimate its complexity to be $\mathcal{O}(n \times k)$ for $n$ data-points with $k$ genuine clusters. The dimension $d$ of the data results in $\mathcal{O}(e^d)$ complexity, though I believe this ca...
I was given a graph problem with 3 different questions and 1 set of answers. The problem is described below. The problem that I'm having is that it seems to me that the answer to all the questions is the same. I keep trying to find a caveat but I don't see one. What am I missing? Here is the problem Undirected graph $G...
I am trying to prove problem 1.59 in Sipser's book: Introduction to the theory of computation , 2nd Edition. Let $M=(Q,\Sigma,\delta,q_0,A)$ be a DFA and let $q'$ be a state of $M$ called its "home". A Synchronizing sequence for $M$ and $q'$ is a string $s\in \Sigma^*$ where $\delta (q,s)=q'$ for every $q\in Q$. (We a...
I'm quite stuck trying to answer this. The problem of finding the size of the maximum independent set in a tree using dynamic programming is well documented and many solutions are around. I've been trying to use a similar technique (ie. recursing through the childred and then the grandchildren of a node) to find the nu...
Is it possible to represent the algorithm proposed by Adleman to solve the Hamiltonian problem in a probabilistic Turing Machine? See also Computing with DNA
I was taught that when a reference is mapped to a cache block, X, for the first time, the word is stored in the cache block, bearing a tag and index that helps identify it for future reads. Then, when a later reference is deemed to have the same tag and index for cache block X, the value inside the cache block is retu...
Like the title says, we have the alphabet $\Sigma = \{a,b,c\}$ and the question is asking for the regular expression of the language $L$ that has the property that all strings in $L$ have at least two consecutive $a$'s but no consecutive $b$'s. By attempt at a solution was this, where $aaa^+$ stands for $aaa(aaa)^*$: ...
I do not understand the following options in windows. Could any one explain
I need to evaluate a polynomial of degree n at the n cube roots of unity. Simple evaluation would take $O(n^2)$ time. I know that polynomial evaluation can be done in $O(n\log n)$ time using FFT. But the problem that I am facing is this. FFT only works when $n$ is a power of 2. If I extend my polynomial by appending ze...
On this page describing the precursor to the Scala language - the pizza language - they refer to it having both case classes and pattern matching - and then imply that these taken together provide algebraic types. Is this the case? To provide algebraic types - do you combine case classes and pattern matching?
I can say that $x * y$ is a problem, but I can also say that $x * y$ is an algorithm for finding a rectangle area. I have been reading Wikipedia about an algorithm and a problem, but I am not sure about their definitions. Could you please explain it to me in more detail?
Suppose that a processor can address directly up to 4 Gigabyte main memory and can operate words with size 32 bit. Find how big should be the size of the "MAR" (memory address registers), "MDR" (memory data registers) and accumulator registers in this computer? My answer: MDR is 32 bit wide since it exchanges data not ...
Let $ G=(V,E) $ be a directed graph with a real weight function $w$ defined on the edges and $ a,b \in V$. Let $\alpha$ denote the minimal weight of all paths from $a$ to $b$ and $\beta$ denote the minimal weight of all paths from $b$ to $a$. How do you find two paths $l_1,l_2$ such that: $l_1=(a,v_1,..,v_n,b)$ $l_2=...
I was a little confused between these three terms Multitasking, Multithreading and Multiprogramming Although every one means executing different lines of codes, and for every one we need something like Task State Segment or context to store data for that particular thread/task. I am missing something, can anyone give ...