instruction
stringlengths
35
29.1k
Question How do I write more intuitive proofs of the two following results in Coq? Theorem Course_of_values_ind: InductiveRel N less Theorem DivRem: (forall d n:N, (Sigma N (fun q => (Sigma N (fun s => and (I N n (add (mul (succ d) q) s)) (less s (succ d))))))). Background I recognize a...
So In a review section, our professor asked: Given integers $N$ and $M$ Is $O(N+M)$ exponential or polynomial. It's exponential, but I just don't see how that is. I would have thought it's linear.
I have little background with SAT sovers and theoretical computer science. How can I describe the complexity of calculating all models of a propositional formula versus just the usual SAT problem of finding just one model? I am writing a paper, in an area where finding a single of a model of a type of propositional for...
I did see a lot of nice and informative questions, articles on inter-net and on StackOverflow itself, of-course. But I found all the questions or articles following a specific rule or a pattern to explain the topic. I mean, when a question was asked on NFA, DFA or Regular Expression, a solution was presented to the que...
I am talking about a measurement plan for software metrics and I am looking for references. In emperical software engineering there are code level measurements ("software metrics" that measure, e.g., some property like a paprameter for the redundancy of the code and possibly also a parameter of coupling and cohesion of...
I have a queue of messages representing filesystem operations that need to be processed in order. A message may succeed or fail when it's sent. A change message, for example, is generated when a user creates or saves a file. Delete Foo.txt message sent Delete Bar.txt message sent Change Baz.txt message sent Change Foo...
While thinking about different calculi for predicate logic (like natural deduction and sequent calculus), I noticed that these calculi are (often) presented in a form suitable for "human computers". A "human computer" is limited to use write once read many (WORM) memory when processing large amounts of data. Pure funct...
So given a input of lets say 10 strings, what way can we input these so we get the best or worst case for these two given sorts? Heap sort: best case - nlogn worst case - nlogn Quick sort: best case - nlogn worst case - n^2 Where i get confused on these two is: heap- Since the best and worst case are the same does it...
I've got a problem where I need to check the validity (i.e to say whether it's true or false) of the following statement: Complement of a non-recursive language can NEVER be recognized by any turing machine. How I've thought of this is that, if a language $\mathcal{L}$ is non-recursive, there is no turing machine tha...
I have following problem: I have a sorted sequence of $N$ integers (assume they are monotonically increasing). I want to check whether there is any subsequence of length $\ge N/4$, such that consecutive elements of the subsequence all differ by the same value. For example, in the sequence [3,4,5,8,12] there are two su...
Suppose we want to arrange n numbers stored in an array such that all negative value occur before the positive ones. What will be the minimum number of exchanges in the worst case ?
I want to know if there is any good book or material that fully explains and fully covers all combinatorics.I even did not find even Kenneth H.Rousan for this.So can anyone tell me any Discrete Mathematics book or any material to fully explain Combinatorics even to advance level.that provide classification to combinat...
Given a non-deterministic push down automata (we define "accept" here using accept states), if we assume any operation popping from the stack and checking if the top of the stack contains some symbol can succeed (i.e. "getting rid" of the stack), we get a non-deterministic finite automata. If we convert two such PDAs, ...
I'm learning about undecidability, and found this question: Is this language decidable, make a proof: L = { M : machine M halts for every input of length not exceeding 100 } Update: This is translated from an exam paper some years ago, and I'm quite sure it means that machine M should halt for every input with len...
Functional programming has the very elegant Lambda Calculus and its variants as a backup theory. Is there such a thing for OOP? What is an abstraction for the object oriented model?
(This may be more fitting for CSTheory, I'm not sure.) I'm looking for an practical or theoretical work (that is, academic papers, online jots, pseudocode or code) regarding efficient algorithms for the following problem: Unknown-Number-of-Bins Histogram Inputs: An array of integers $a$, of length $n$. Outputs: An ...
$\mathrm{Halt} = \{ (f,x) | f(x)\downarrow \}$ is r.e. (semi-decidable) but undecidable. $\mathrm{Total} = \{ f | \forall x f(x)\downarrow \}$ is not r.e. (not even semi-decidable). I need some help in proving that $\mathrm{Total}$ is not recursive (decidable). I know the diagonalization proof for the halting problem,...
I'm currently reading this paper: Code injection attacks on Harvard-architecture devices (ACM) (pdf) I understand the basics of what the attack is trying to do, but one thing really bothers me. If Harvard Architecture is supposed to have a strict separation of code and data, how is the initial buffer overflow allowing...
Consider this tree: If I traverse it using post-order, I'd start at B (as it is the leftmost leaf) and that's where my misunderstanding begins. I know B is the first and A will be the last node in post order, as the rule is left-right-root. One of my university professors said the correct answer for the post-order tra...
Is the set $S$ = $\lbrace M \mid M \text{ is a Turing machine and }L(M)=\lbrace \langle M\rangle\rbrace\rbrace$ empty? In other words is there a Turing machine $M$ that only accepts its own encoding? What about a Turing machine that rejects only its own encoding?
I'm learning about asymptotic analysis, and have seen some exotic looking complexities living between other common ones. For instance "log log n" is strictly between 1 and log n. It makes me wonder if one can always find complexities between any other two. Specifically, for any functions f and g with O(f) ⊂ O(g) does t...
Consider the following variation (let us call it Q) on the Vertex Cover problem: Given a Graph G and a number K, we are asked if there is a k-cover of G so that it is the minimum cover. My question is: How may one prove that Q can be reduced to the general Vertex Cover problem? And, more generally, what is the approach...
The Institute for Advanced Study has had a year-long special program devoted to the Univalent Foundations Program. At the end of this they have produced a book and a code repository. At the end of this we see a blog entry in Scientific American claiming: ...it could provide a new, self-contained foundation for all of...
I am trying to find the plain text for the following cipher text using a frequency analysis vr pvst yqlp mq nvf But for the letters above this is really difficult, as if I use the alphabetic substitution technique, where I assume that v corresponds to e as this occurs most in the english alphabet. What about p, this a...
Is it possible to use a sorting algorithm with a non-transitive comparison, and if yes, why is transitivity listed as a requirement for sorting comparators? Background: A sorting algorithm generally sorts the elements of a list according to a comparator function C(x,y), with \begin{array}{ll} C(x,y) = \begin{cases} -1...
I heard here that the Hamiltonian cycle problem is polynomial on graphs of bounded treewidth. I am interested in examples/references to different problems which is essentially hard but having polynomial complexity on graphs of bounded treewidth.
I don't understand what is meant by: "m should not be a power of 2, since if m = 2^p, then h(k) is just the p lowest-order bits of k." (pg. 231 of CLRS) Terms defined: m: size of hash table h(k): hash function = k mod m k: key I don't understand what the p lowest-order bits of k means. Any clarification would be very ...
To find a Hamilton cycle is a NPC problem, but Euler is not. Considering one can always transform the vertex as edge or vice versa conceptually. Then the vertex can be used to describe the information which originally edge does. What properties make the Euler graph more easily to be resolved? For example, in genome a...
I am trying to understand how IDDFS works by reading a wikipedia article on it. (If someone has a better literature on the subject, don't hesitate to post). Pseudocode is as follows: IDDFS(root, goal) { depth = 0 for(i=1, i<10, i++) { DFS(limit=i) } } First of all, what is 10 here? Is it an arbitray number...
I want to derive a context free grammar for the following language on alphabet $\Sigma=\{a,b\}$: $\qquad\displaystyle \{ xax'yby'z \mid x,y,z\in\Sigma ^*, |x|=|x'|, |y|=|y'|, |z|=|x|+|y|\}$ I am convinced that this language is context-free because this is part of my proof to a theorem given in textbook, but haven't yet...
I am working on showing that 3-colorability is NP-complete. I read a few articles and walkthroughs on this but none are really clicking. I get to this part "Then for every variable xi that appears in the instance of Satisfiability, we connect a vertex xi to a vertex xi, and we connect both xi and xi to red. Thi...
I want to create a fast way to detect whether a file might or might not be the same. For almost 100% sureness I would use an existing hash algorithm, e.g. SHA256. However, the files are expected to be huge video files with several GB, so calculating the SHA256 hash could take some time, especially over the network. The...
So, I have a list of cities (A, B, C, etc) with weighted edges (two-way, undirected) between them with a list of cities that already have a store. My task is to place a one new store at either A, B, C, etc so that I minimize the travel distance from any city to a store. So my head is thinking Perform Dijkstra's on eve...
For my homework I have a problem that I can't solve and it makes me wonder about 2 different MST: Let $G=(V,E)$ be a graph that has a minimum spanning tree $T$. I want to find another minimum spanning tree $T'$ that has at least 1 different edge $e'$ such that the weight of $e'$ is differ from any weight of edges in $...
Given two NP NP-hard functional problems, A and B, one can find a reduction of A to B. Is it possible to find a reduction that would honour approximations? That is, if you have an approximation algorithm for B that yield approximate solutions within accuracy $\delta$, is it possible to reduce A to B in such a way that ...
I have a problem and I guess it NP-hard, but I cannot prove it. Here is a layer graph, where layer 0 is the hignest layer and layer L the lowest. there are some directed edge between layers, where an edge (A, B) indicates that node A can [cover] node B. And when A can cover B, every node on any path from A to B can cov...
In the introduction of the book by B.Jacobs, "Categorical Logic and Type Theory" (it's online here), he classifies type systems into three general flavours: Simply typed ones, depended typed (term depended types) and polymorphic types (type depended types). He says also there are also mix types. Now if you start out w...
I need help with showing that $$NeverHalt_{TM} = \{\langle M\rangle \mid \text{$M$ is a TM which runs forever on every input $w$}\}$$ is undecidable by giving an explicit mapping reduction. To show that a language reduces to any other language we must show that yes-instances are mapped to yes-instances and no-instance...
I thinkt this question fits better here than on english.stackexchange. When describing a figure in a computer science paper, is it safe to use "tick" meaning "tick mark"? Examples: ... (see the thick line right of tick "17") meaning tick mark "17" or ... increase at tick "1e+02" ... increase at tick mark "1e+02".
In the pre-history of dependent type theory, Per Martin Löf introduced a calculus that is in some sense the simplest dependent type theory and the most general form of impredicative polymorphism. It is often referred to as Type:Type because the kind Type is itself of type Type. Unfortunately, it is inconsistent as a l...
I am implementing a sample MESI simulator having two levels of cache (write back). I have added MESI status bits to both levels of cache. As it is a write back cache, the cache line is updated to L2 only when it is flushed. My doubts are what should be the behavior when a cache line with INVALID state is flushed from ...
Let $\phi$ be a the function computed by a universal Turing machine: $\phi_y(x)$ is the encoding of the output of the machine for the program whose Gödel encoding is $y$ with input encoding $x$. I am looking for an upper bound on the length of the shortest program that computes $\phi$.
The theory of NP-completeness was initially built on Cook (polynomial-time Turing) reductions. Later, Karp introduced polynomial-time many-to-one reductions. A Cook reduction is more powerful than a Karp reduction since there is no restriction on the number of calls to the oracle. So, I am interested in NP-complete gra...
Is the following language regular? $$L = \{x \in \{a, b\}^* \mid \text{in every prefix \(w\) of \(x\), } 0 \le |w|_a − |w|_b \le 2\}$$ If so, give a DFA for it with as few states as possible. If you claim that it is not regular give a pumping lemma proof that it is not regular. I'm doing exam prep and have tried pump...
I see how objects in a category stand for types, but where do I find the terms and more specifically the rules which tell me which of them are allowed? When I e.g. consider a Cartesian closed category as model of a type theory, how are term constructors represented? I guess this is the same as asking how do I know or ...
Would I use the third case of the Master Theorem for the recurrence equation $T(n) = 2T(n/2) + n^{2}\log n$? The condition given for the third case by Wikipedia is $f(n) = \Theta(n^c)$ when $c > \log_{b}a$.
Some researchers are trying to get a memory cell capable of having 3 states instead of 2. 1) How many memory cells, in principle and as a rough estimate, does a typical 1 megabyte memory chip has? is it 8*1024 cells? 2) If you have N memory cells, each has x logical levels, what is the number of possible representation...
Neural networks can have multiple inputs. But some times two or more of these inputs can often be related to a single entity. E.g : Height and weight of a person to predict the probability of disease or price and Volume of a stock to predict it's value. How can we make a neural network understand that two inputs are re...
Background: The Exact-3D-Matching problem is defined as follows (The definition is from Jeff's lecture note: Lecture 29: NP-Hard Problems. You can also refer to 3-dimensional matching): Exact-3D-Matching: Given a set $S$ and a collection of three-element subsets of $S$, called triples, is there a sub-collection of dis...
I have a question regarding recursion in Viterbi algorithm. Define $\pi(k; u; v)$ which is the maximum probability for any sequence of length $k$, ending in the tag bigram $(u; v)$. The base case if obvious $\pi(0,*,*)=1$ The general case. $\pi(k,u,v) = max_{w \in K_{k-2} } \pi(k-1,w,u) \cdot q(v|w,u) \cdot e(x_k|v)$ ...
I'm trying to understand why the sorting algorithm Selection Sort has asymptotic runtime in $O(n^2)$. Looking at the math, the runtime is $\qquad T(n) = (n-1) + (n-2) + \dots + 2 + 1$. And this is stated to be equal to $\qquad O(n^2)$. However I just don't understand the intuition. I have tried several practical experi...
I've created a data structure that is a hash of arrays with a special property: the hash keeps track of the combined order in which items are appended to its arrays. For example (pseudocode): h = HashOfArray() h["a"].append(1) // accessing an unset key returns an empty array h["b"].append(2) h["a"].append(3) h["b"].a...
I want to use “Fingerprint matching using multi-dimensional ANN” by Rajesh Kumar and B.R. Deva Vikram [content link] for fingerprint identification. But I have a serious problem understanding what is a Multidimensional Artificial Neural Network. I searched for keywords MDANN and Multidimensional ANN but I can't find an...
I have a question regarding optimal mistake bound for learning algorithm There is a famous fact that $VC(C) \leq Opt(C)$, where $C$ - set of learning concepts, VC(C) - VC dimension of C, $Opt(C)$ - the smallest mistake bound (of the best learning algorithm) on the hardest learning concept $c \in C$ . I don't understan...
Relevant Information: Sieve of Eratosthenes Sieve of Sundaram Suppose I want to generate all primes in [2,n], and I have both of these algorithms at my disposal to get the job done. Which is preferable under what conditions? I read that Sundaram runs in O(n log n) time, whereas Eratosthenes runs in O(n log log n) time,...
I understand that MESI is a subset of the MOESI cache coherency protocol. But what does the Owned state in the MOESI protocol represent? What are the differences in state transition due to the extra Owned state in MOESI as compared to MESI? For example consider same cache line in processor P1 is in OWNED state & proce...
You probably know this one (or at least a version of it). Let $P$ be a program code, and $w$ be an input string. Define $A_{TM}=\left\{(P,w)| P(w)=1\right\}$. Meaning: $A_{TM}$ is the set of all ordered pairs $(P,w)$ s.t. $P$ accepts $w$. $A_{TM}$ is undecidable. I just read the proof for it, that made me wonder about ...
I tried, but I could not design a turing machine for the following problem: Turing machine that takes as input a tape containing a series of n 1s, where n >= 0, terminated by an = sign. The Turing machine head is initially positioned on the leftmost 1. The end state should be a tape containing the input, followed by th...
I need to show that the language Anfa = {(A,w)| A is an nondeterministic finite automata that accepts w} can be decided in polynomial time. My problem is every solution that I think of requires exponential time. I would appreciate any help, Thanks in advance..
I'd like to have this feature in my application programming language (which these days, is Scala), but when I went to learn more about it on the internets, I realized I don't know the name of it. I'm talking about the ability to do this (in Scala-ish pseudocode): // Define some types that correspond to table rows in r...
Philip Wadler has written a brilliant paper called 'Theorems for Free'. The big idea is that you can use types to reason about your program, and even prove simple theorems about your program. We see these ideas about types applied in the Haskell language. At very roughly the same time period - we have an idea from Be...
I am curious whether the following problems has been studied before, but wasn't able to find any papers about it: Given a planar graph $G$, and two vertices $s$ and $t$, find an $s$-$t$ path $P$ which minimizes the number of distinct faces of $G$ containing vertices of $P$ on their boundaries. Does anybody know a...
I am trying to describe a TM that decides the language $A=\{0^{5^n} \mid n\ge0\}$. I know how to do this for $0^{2^n}$, marking off every other 0 in each pass. In my case would it work marking off every fifth 0 in each pass? It would reject if there are an even number of 0s. Every pass reduces the number of 0's by a fi...
From what I have learned asymptotically tight bound means that it is bound from above and below as in theta notation. But what does asymptotically tight upper bound mean for Big-O notation?
I'm using machine-learning algorithms to solve binary classification problem (i.e. classification can be 'good' or 'bad'). I'm using SVM based algorithms, LibLinear in particular. When I get a classification result, sometimes, the probability estimations over the result are pretty low. For example, I get a classificati...
Define the language $L$ as $L = \{a, b\}^* - \{ww\mid w \in \{a, b\}^*\}$. In other words, $L$ contains the words that cannot be expressed as some word repeated twice. Is $L$ context-free or not? I've tried to intersect $L$ with $a^*b^*a^*b^*$, but I still can't prove anything. I also looked at Parikh's theorem, but ...
While reading an article on logic, there is a sentence "No number is equal to zero" and we have to assign truth values to this sentence. I hope this is true and the article says it as false. Can someone explain me why it is false? Or the author of the article is wrong?
I found this problem in a book. It supposedly minimizes the number of Support vectors rather than maximizing the margin: $min_{\alpha,b} \frac{1}{2}\sum_{i=1}^{m}\alpha_{i}^{2}$ $s.t.\quad y_{i}(\sum_{j=1}^m\alpha_{j}y_{j}(x_{i}\cdot x_{j})+b)\ge1 \quad \forall i\in \{1,...m\}$ (for simplicity, I've omitted the slack v...
I want to use the pumping lemma to show that the following language is not context free: $$ L = \{w \in \{a,b\}^* \mid \exists d \in \{a,b\}^*, w=ddd \} $$ We suppose that $L$ is context-free. Then from the pumping lemma there is a pumping length $p$. Which word $s$ do I have to use, that belongs to $L$ and such that...
there are many classes of graphs proved GI complete & many questions related to GI on tcs.se eg [1] & many others. suppose a class both $X$ and not-$X$ of graphs are proven GI complete. what are the implications of that? [1] open problems related to GI
Is there an efficient way to cluster nodes in a graph using Jaccard similarity such that each cluster has at least k nodes? Jaccard similarity between nodes i and j: Let S be the set of neighbours of i and T be the set of neighbours of j. Then, the similarity between i and j is given by $\frac{|(S \cap T)|}{|(S \cup ...
I recently had a lengthy exchange with someone about the most efficient way to remove duplicates from a collection. The debate was mostly centered around the specific behavior of C# collections, such as HashSet(T) and HashTable(T). I think we agreed on the fundamentals, but where we couldn’t come to an agreement was w...
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 have some difficulties in understanding the intuition behind Naive Bayes Classification. In general, I do understand every argument of the definition, however I don't understand why it's correct and why any other argument is incorrect. Start from the beginning: Goal: $v_{MAP} = argmax_{v_i} p(v_i|a_1...a_n)$ the goal...
I cannot conceive of any problem that can be solved in exponential time, but cannot be checked in polynomial time.
I have the following CFG which I suspect cannot be rewritten to one which is LL(1): $S \rightarrow \epsilon\ |\ aSbS\ |\ bSaS\ |\ cSdS\ |\ dScS$ I've thought about it for a while, and can't seem to make any progress. I know that the simpler grammar here can be rewritten into LL(1), but it seems like there is something ...
Not sure if I should ask it here but I'll just go ahead. I was reading SICP (Structure and Interpretation of Computer Programs). And there was one quote from Alan Perlis in the preface to the second edition. Is it possible that software is not like anything else, that it is meant to be discarded: that the whole point ...
Given array $A = \{ a_{1},a_{2}, ..., a_{n}\}$ and integer $k; 0 \lt k \le n$, partition array $A$ into $k$ subarrays, such that $A'_{1} = \{a_{1}, ...,a_{x}\}$ $A'_{2} = \{a_{x+1},...,a_{y}\}$ $...$ $A'_{k} = \{a_{z+1},...,a_{n}\}$ where each subarray $A'_{1},A'_{2}, ...,A'_{k}$ has sum of its elements closest to $\si...
Say I have Simply typed lambda calculus, and add an assignment rule: <identifier> : <type> = <abstraction> Where <identifier> is the name of the function, <type> is the function type and <abstraction> is the abstraction to be assigned to the identifier. Then I add a typing rule that says that when you see an assignme...
Let's assume that I've implemented a method for the extraction of the principal lines of the palmprint. For instance, let's say that I'm able to do a transformation like the following one (image from Patprapa Tunkpien, Sasipa Panduwadeethorn and Suphakant Phimoltares): Now, I want to make an evaluation of the accuracy...
The conclusion follows from all the premises. It seems to me that this means that conclusion from the conjuntion of the premises. Right? Why does logic uses comma instead?
This question was originally posted here: https://stackoverflow.com/q/20735339/2305618 I am surely not the first to have implemented code to perform the following graph transformation. But try as I might, I can't find a previous reference to it. The transformation arises when creating a single graph that simultaneousl...
Iam a beginner in Lambda Calculus, I have a expression saying (λx.xy) Here y is a free variable and x is a bound variable. My question is what would be the value of the expression (which has free variables).
I got stuck in Ladner's Proof while reading "Computational Complexity: A Modern Approach" by Sanjeev Arora and Boaz Barak. Pardon me if I'm missing something really obvious here but the authors do the following: For every function $H\colon\mathbb{N}\to\mathbb{N}$ define $$SAT_H=\{\psi01^{n^{H(n)}}: \psi \in SAT \ and \...
I am working on a special case of the longest path problem. For a cyclic directed graph $G=(V, E)$, where the edge-weights are probability values (i.e., $P(\_) = w(s, q)$ with $s,q \in V$), my aim is to find the least 'probable' path between two vertices. My initial approach is to generate an graph $G'$ where the weig...
Is the complexity class $P$ closed under rotation, where rotation is defined as $\text{rot}(L) = \{ wv \mid vw \in L \}$? How would we prove it?
Given an undirected weighted graph $G(V,E)$, where the number of edges is $|V|+10$, how can I find the minimum spanning tree of $G$ in $O(|V|)$? Kruskal's algorithm is out of the question, since sorting alone is $O(|V|\log |V|)$, so I thought maybe using Prim's algorithm with minimum binary heap, but still - every iter...
I am looking for an algorithm to solve the following problem: INPUT: a set of $n$ points in the plane, $(x_1,y_1),...,(x_n,y_n)$. OUTPUT: a set of $n-1$ axis-parallel interior-disjoint squares, such that the boundary of each square contains at least two points. (*) Here is an example of input (left) and possible output...
A link to the transcript of the manuscript: http://www.cs.utexas.edu/users/EWD/transcriptions/EWD13xx/EWD1300.html My questions: What does Dijkstra mean by: "Do not introduce priority [precedence] rules that destroy symmetry. I remember how much more pleasant the predicate calculus became to work with after we ha...
As I understand, to show that a certain problem $P$ is NP-hard we can reduce a known NP-hard problem $Q$ to a problem in $P$. This reduction, say $f$, has to be polynomial time. Could someone please explain is it necessary that $f$ maps each instance of $q\in Q$ to $P$ or can we map a selected subset of $\tilde Q \s...
When we say a problem is NP-hard is that a property of a set of problems or is it a property of a instance of the set of problems?
Self-stabilizing algorithms are extremely useful in distributed systems, but can the algorithm be applied concurrently to each computational node? My instinct is to say yes, but I can't help but imagine a 'Game Of Life' scenario where the state of the graph toggles between two states. What keeps the question alive ...
The proofs that the halting problem is undecidable seem to make very few assumptions about the kind of program/machine under consideration: just that the programs take one input and either loop or produce an output. Not just Turing machines have these characteristics: for example, a linear-bounded automaton can also lo...
I have a image similar to below. In that I need to find all red circles and count them. So, I am thinking to use MATLAB R2011a with Image Processing Toolkit for it. How could I possibly extract them?
Suppose a parameter $\hat{k}$ is larger than another parameter $k$, assume that $k$ is bounded by a function $f$ of $\hat{k}$. How can we prove that if a problem is FPT with respect to $k$ implies it is FPT w.r.to $\hat{k}$.
I came accross the question regarding program overlays, Program1 is of 100kB and program2 is of 90kB and common code is 10kB and overlay driver is 20kB and error handling routine is 50kB, min memory required when there is no error? according to me it should be 100 + 20 + 10 = 130; as there is no error.. but ans is 1...
Given simple, udirected and connected graph with $n$ verticies. Every edge in this graph has some weight. I have to find (in polynomial time) a set of edges such that : 1.every simple cycle in graph contains at least one edge from this set 2.sum of weights of these edges is the least possible I have derived the fol...
Let G be a weighted undirected graph and e be an edge with maximum weight in G.Suppose there is a minimum weight spanning tree in G containing the edge e.Which of the following statements is always TRUE? 1.There exists a cut in g having all edges if maximum weight 2.There exists a cycle in G having all edges of maximum...
I am trying to construct all inequivalent $8\times 8$ matrices (or $n\times n$ if you wish) with elements 0 or 1. The operation that gives equivalent matrices is the simultaneous exchange of the i and j row AND the i and j column. eg. for $1\leftrightarrow2$ \begin{equation} \left( \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 1...
Suppose I want to run Dijkstra's algorithm on a graph whose edge weights are integers in the range 0, ..., W, where W is a relatively small number. How can I modify that algorithm so that it takes time just O((|V| + |E|) logW) and relatively easy implement that in C/C++?