instruction
stringlengths
35
29.1k
Question: Are there any introductory texts in formal language or programming language theory which discuss how to apply it to the study of optimal notation? In particular, I am interested to learn what stack-languages, parse trees, and indices are, and how to predict when a certain type of notation will lead to exponen...
Currently I read up on unifiers, however have some problem understanding its concept. Thus far I found an example of an equation: add(suc(x); y) $\stackrel{.}{=}$ add(y; suc(z)) and unifiers to it: $\omicron$ = [suc(x)/y; x/z], $\omicron'$ = [suc(suc(z))/y; suc(z)/z; suc(z)/x] and $\omicron'$ = $\omicron$[suc(z)=x] H...
If one was given a tree in the form of a list of $A,B$ (not implying which one is the parent) pairs implying that node $A$ and $B$ were connected by an edge, how could a root node be determined and each node be assigned children and a parent such that by recursing up through its parent, its parents parent and so on the...
On the begining: It is a programming contest problem, but not from on-going one. Unfortunatelly, I can't provide any link to this task, because it is not publically available. It was from one of the Polish local programming contest in 2011 organised by Warsaw School of Computer Science. I have a graph with $V$ $(1 \le ...
This question refers to steps Q2, Q4 and Q6 of Algorithm Q, described in the paper "A Block-sorting Lossless Data Compression Algorithm", by M. Burrows and D.J. Wheeler, SRC Research Report, 1994. My question is: how can in step Q6, the sorting work, if we only compare the values in the array W, which are just the firs...
I have a database that consists of PHOG and LPQ features for each image. Now, I wish to train an SVM on these features for emotion recognition i.e SVM classifies the images on basis of emotion in the image. Please provide a detailed procedure on how to use these features to train SVM.
Given an undirected connected graph with N nodes and N-1 edges. Out of N nodes, 1...k nodes are selected, out of which 2 nodes are selected randomly (uniformly). How do I calculate the expected distance between those 2 points? By the way, I tried using sum of distance between all pairs of k nodes and divided it by k t...
Access to registers claimed to be faster then cache. Why is it? Is it because cache has less wires or spatially further from functional units?
Is it required that a NP-hard problem must be computable? I don't think so, but I am not sure.
I'm trying to understand a problem that's more mathematical in nature that I'm accustomed to. Below I'll try to present the problem and what I have so far understood of it. The problem We have $X_1,..,X_n$ i.i.d. binary outcomes distributed according to Bernoulli distribution. The probability that $X_i = 1$ is given by...
NOTE: This question is NOT the same as this other nearly-identically worded question with some amazing answers. I learned a lot from it regarding the mathematical importance of the empty string, but my question is specifically regarding its usage and purpose in a context-free grammar. Update: After @Raphael's comments,...
I am dealing with the following statement: the run time for Dijkstra's on a connected undirected graph with positive edge weights using a binary heap is $\Theta$ of the run time for Kruskal's using union-find. However, this is false and I fail to see why this is so. Dijkstra's algorithm when using binary heap is $O(|...
I'm not too sure about how to calculate hashing probabilities, and can't find much documents online to help me with it. Am looking to solve this question "If we hash N items into M buckets using a simple uniform hash, what is the expected number of buckets that have exactly 1 item? What is the expected number of bucket...
can anyone describes the more simplified mathematical formulation of learning rate, lr, and momentum constant, mc in Neural Networks while training the data?
I know the definition of a Turing machine but I am trying to find a practical way to characterize a Turing-complete language. For example, an imperative language is Turing complete if it has conditional branching (e.g., "if" and "goto" statements, or a "branch if zero" instruction) and the ability to change an arbitrar...
Consider the following situation: given a triangle $ABC$ inscribed in a circle, define $f$ as the product $$f(P) = d(P, A) \; d(P,B) \; d(P,C)$$ where $P$ is a point on the circle and $d$ are distances between points. Now, every point $D$ in the interior of the circle can be written as a convex combination of points $D...
Consider a graph $G=(V,E)$ and two vertices $s,t$. What is the complexity of finding the length of the shortest simple $s-t$ path that has even length? Does the problem become harder if the graph is edge weighted? Note that the requirement that the path is simple makes it harder than to simply to use two copies of t...
If we have the function $f : \mathbb{N}_0 \rightarrow \mathbb{N}$ with $f(n) = n^2$ and we look at the following representations of the sets $\mathcal{o}(f),\mathcal{O}(f),\Theta(f),\Omega(f),\omega(f) $: Now I have to list all necessary statements which are proving that the illustration is correct. The necessary st...
We suppose we have a polynomial algorithm which receives a graph $G$ (any graph) and returns a stable set of $G, SA(G)$ with the following property: $\alpha(G) − |SA(G)| \leq k$ , for every natural $k$ ($k$ is a constant) $\alpha(G)$ is the stability number I need to show that this algorithm can be used to find(in poly...
It's the continuation of the exercise: https://cs.stackexchange.com/questions/65384/tree-elements-influence-on-another-elements-searching-for-specific-elements I need to say how many elements do I have in specific subtrees. Input: n - how many elements are in the tree, k - around how many elements should be in the subt...
I have an NP-hard 0-1 integer program that I need to solve. The issue with this problem is that even finding a feasible solution (ignoring the objective function) is NP-hard. Let us look at two examples to illustrate my problem. On the one hand, the knapsack problem is an NP-hard problem which is defined as follows: $$...
I am looking for a $O(|V| + |E|)$ algorithm for finding transitive reduction of a rectangle containment hierarchy DAG, i.e. a directed edge exists from one rectangle to another if the first rectangle contains the second. That is, remove as many edges as possible so that if you could reach v from u, for arbitrary v and ...
I have a question regarding the solution provided by Karolis Juodelė. Given in this question; Colour a binary tree to be a red-black tree Black = black nodes, white = red nodes So for this tree when I try to manually work out the code, it seems to fail on the node 17. E.G. I have a black quota of 3 so I color the root...
I stumbled on the Hungarian algorithm during my personal research when I was assigned interesting problem as homework: Given a list of objects $L$ and a pairing function $\delta : L \times L \rightarrow \left[0, 1\right]$, pair each object $\alpha$ in $L$ with exactly one $\beta$ in $L$ such that: $\sum_{i = 1}^n \del...
Objective: We want to generate a unique and reproducible identifier for a given slice of bytes and avoid collisions. High-level idea: Compute $$fK := hash(k_1)\; and\; sK := hash(k_1^{-1})\; where\; k_i^{-1}\; is\; the\; reversed\; bitstring\; k_i$$ We then proceed to set, our identifier to be: $$<value\_of\_fK>\_<valu...
I'm new to DNS and I'm trying to understand the DNS packet format. From what I understand, the authority section of a DNS packet gives information about servers that are authoritative for the domain name in question. From playing around with dig on UNIX (and from intuition), it seems as though records in the authority ...
I know there might be some situations where we want transitions to be only taken when the stack is empty, and transitions to be taken only when the input stream is empty. We can create an additional start state, and push a special key like "#" on the stack to start. We can also append the input stream with a "$" so we ...
At least in Java, if I write this code: float a = 1000.0F; float b = 0.00004F; float c = a + b + b; float d = b + b + a; boolean e = c == d; the value of $e$ would be $false$. I believe this is caused by the fact that floats are very limited in the way of accurately representing numbers. But I don't understand why jus...
I'd like to prove by reduction that given a Turing machine $M$, there exists no Turing machine that decides whether $M$ ends in polynomial time on any input. Any idea as to what problem to reduce, as a first hint?
I have an NP-complete decision problem. Given an instance of the problem, I would like to design an algorithm that outputs YES, if the problem is feasible, and, NO, otherwise. (Of course, if the algorithm is not optimal, it will make errors.) I cannot find any approximation algorithms for such problems. I was looking s...
I have the following multiple dimensional scaling (MDS) minimization problem in vectors $v_1, v_2, \dots, v_n \in \mathbb R^2$ $$\min_{v_1, v_2, \dots, v_n} \sum_{i,j} \left( \|v_i - v_j\| - d_{i,j} \right)^2$$ which I wish to solve numerically using gradient descent. I know all the values of $d_{i,j}$. I am confused ...
I am trying some methods to solve the graph coloring problem with large data sets. I decided to start off with the total space search but to eliminate certain combinations that are same due to symmetry. So for instance, if we code the color by a natural number, graph coloring 1-2-1-1 is the same as the coloring 2-1-2-2...
I am going through the book of Parallel Programming and a parallel algorithm is often classified as Efficient, Optimal or Suboptimal. I googled these terms but I didn't found a clear definition for them. Define $T(n)$ as the running time of the sequential algorithm, $t(n)$ as the running time of the parallel one, $p(n)...
Suppose one wants to reason about properties of code beyond things like totality and functional purity - one also cares about the memory consumption, or algorithmic complexity of a function. Can this be done through dependent typing and effects systems?
I am currently a high school 12th grader and am very interested in computer theory and pure mathematics. I also have a strong interest in astronomy and a desire to study quantum information. However, physics and I really don't have a nice relationship. I am having trouble figuring out what major holds the topics I am ...
In my understanding, if a unification solves equations of terms that are not higher-order terms, then it is a first-order unification. If a unification solves equations of terms that are higher-order terms, then it is a higher-order unification. Therefore a unification solves equations of $\lambda$-terms should be a hi...
I have been debating with someone about the big O complexity of the following algorithm. We have a different understanding of the theory. Basically one of us thinks that this algo is automatically O(N^2) since there is a loop over N elements and another potential other loop over N elements inside the loop. The other on...
I have been given a tree with n nodes and n-1 edges with it's weight. There are two people A and B. I have been given a list of nodes of size k. A will pick a random node x from this list and B will independently pick a random node y from this list. I have to find expected distance between these two nodes. My way of so...
I am building a 64 bit CPU in Minecraft and I'm stuck on adding division into the ALU. I was told I should ask this here. Does anyone know how to divide in binary using only logic circuits? I can't use any counters or registers, just logic gates.
Given following question: Let $G$ be a context-free grammar, $G=(V, \Sigma, R, S)$, that has start variable $S$, set of variables $V = \{S\}$, set of terminals $\Sigma = \{0, 1\}$, and set of rules $R = \{S \rightarrow \epsilon , S \rightarrow 0 , S \rightarrow 1 , S → 0S0 , S \rightarrow 1S1\}$. Describe $L(G)$, the l...
Given the following function: function split(G) if (all vertices of G have even degree) then return (V (G), ∅) else Let a ∈ V be a vertex of odd degree; S ← NG(a); G ← G − a; for ((∀)u, v ∈ S, u != v) do if (uv ∈ E(G)) then E(G) ← E(G) − uv...
I am working on a compiler optimisation routine for GPUs that optimises nested loops which has unpredictable number of iterations. To test my routine I need some real-life algorithms that include this kind of loop construct. For example, there is a queue A with an arbitrary number of elements of type a each of which co...
I'm working on the following exercise and can't get the calculations right: Assume an OS uses: 33 bits for physical address 34 bits for logical address 2KB frame size Calculate: How many bits are used for the offset How many bits are used to identify a frame How many bits are used to identify a page And then: Assu...
I'm talking about first-order existential types, as summarized here, with pack as the introduction form that bundles up a type with an expression of that type, and open as the elimination form that unpacks the type and its representative expression. This seems just as fundamental as parametric polymorphism (universal t...
In chapter 3 book how to triangulate a polygon is explained, however it doesn't seems to me that how to handle the faces are explained. My guess would to add two new face and erase the old one every time a diagonal is inserted (both while decomposing the polygon in monotone pieces, and during the actual triangulation)....
Is the MinMax/optimization/search variant of a decision problem always easier/equal in complexity because we can always reduce them to their decision variant? From Wikipedia: If the longest path problem could be solved in polynomial time, it could be used to solve this decision problem, by finding a longest path and t...
In a directed acyclic graph (DAG), what is the name for a vertex with only one predecessor and one successor?
Im having a hard time trying to figure out how to find an upper bound to the following recurrence: $T(N)=T(N-1)+\mathcal{O}(n)$ where i know initially $N=\lfloor\tfrac{n}{logn}\rfloor$ I believe it can be solved as a linear recurrence, but i don't know how to put $n$ in terms of $N$.
I have a homework problem: Calculate the overall speedup of a system that spends 40% of its time in calculations with a processor upgrade that provides for 100% greater throughput. Which is a pretty straightforward calculation with Amdahl's Law $S = \frac{1}{(1-f)+(\frac{f}{k})} $ $f$ = fraction of work performed by c...
There are $n$ stairs and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs every time. What is the total number of ways they can reach the top? There are many ways to do this by using code. But when I first read this problem was to use a combinatorics approach. This...
Problem You've periodically helped the medical consulting firm Doctors Without Weekends on various hospital scheduling issues, and they've just come to you with a new problem. For each of the next n days, the hospital has determined the number of doctors they want on hand; thus, on day i, they have a requirement that e...
Wikipedia has several languages listed as declarative languages. One of these languages listed is XSLT, which is a language for applying transformations to XML. https://en.wikipedia.org/wiki/XSLT As I understand it though, imperative languages say HOW to do something, while declarative languages only say WHAT to do an...
When compressing multiple files, is it more efficient to (1) first compress each individual file separately and then concatenate/merge the results, or (2) first concatenate/merge the files into a single archive and then compress that archive? Which one will be faster, in terms of running time? From what I understand b...
I found this problem on codeforces in an ACM archive. Given a number $n$, find the number possible of ways of expressing that number as a sum of consecutive primes. Example : Given $n = 41$: $41 = 41 = 2 +5+3 +7 + 11 + 13 = 11 + 13 + 17$ As we can see, there are three ways of writing $41$ as a sum of consecutive prim...
I am working on the graph coloring problem. I came up with the following. Let $S^L$ be the set of all colorings with $N$ colors for a graph with $L$ nodes. This is shorthand notation for $\{1, 2, 3, ..., N\}^L$ - a string of $L$ characters each belonging to a set $S = \{1, 2, ..., N\}$. I noticed that we can prune the ...
I have been trying to prove the following algorithm, without success. Here is the C-Style pseudocode: //j,k >= 0 int get_lcm(int j, int k){ int c = j; int d = k; while(c != d){ if(c < d){ c += j; } else { d += k; } } return c; } I tried to find the l...
In the below link , it is mentioned that in case of Harvard Architecture it is impossible for the program memory to modify its contents so how can it happen since instructions are fetched from the Program Memory only , and there will be instructions to modify contents pertaining to that data only so how can it happen...
Consider an $m$ output, $n$ state Mealy machine. How many states does the equivalent Moore machine contain? The answer is $mn$ but my argument is that the total number of output produced while reading a string of length $n$ ($n$ states) Mealy will produce $m$ outputs ($m$ transitions) but a Moore machine produces a out...
I was looking for a service (with API) where I can ask it a general question (aka, when was Einstein born?) and retrieve an answer from the Web. Is there any available service to do that? Have tried Watson services but didn't work as expected. Thanks,
In the context of a MILP, I have variables $x_{t} \in \mathbb{R}$ which have a lower bound $x^{min}$ and an upper bound $x^{max}$. Let $I_{1} = [x^{min},a_{1}], I_{2} = ]a_{1}, a_{2}], ..., I_{n} = ]a_{n-1}, x^{max}]$ form a partition of $[x^{min}, x^{max}]$. The behaviour of the system I want to model depends on which...
I need to find intersection of N line segments (given by coordinates of start and end points) which are either vertical or horizontal.So I read that Sweep Line Algorithm is a good way to solve this. But I can't seem to find it's implementation in C++ anywhere on Internet. Can someone provide me it's code in C++ ?
During my work I've encountered this problem: $G = \{(x_i,y_i,z_i)\}_{i=1}^{n}$ is a group of points in space ($\forall i \;\; x_i,y_i,z_i \in \Bbb R$) and $ d \in \Bbb R^+$ is a constant. Divide $G$ to $m$ groups (as few as possible) that follow this rule: for each pair of points in the same group, the distance betwe...
Model driven software development is driven by UML models and OCL expressions, ontology driven software development is driven by ontologies but is it possible (are there research trends) to introduce knowledge based software development? E.g. there are quite expressive and extensive logic based knowledge representation...
This is the original grammar: S -> ABe A -> ab | a | ϵ B -> b I did try left factoring and this is what I got: S -> ABe A -> aX | ϵ X -> b | ϵ B -> b But it still is not LL(1).
In the grammar for S production two bodies have same starting symbol $ S \to Aa \mid b A c \mid Bc \mid bBa $ So i removed the left factoring from those two productions $ S \to bC$ $ C \to Ac Bc$ Then I calculated first and follow for all of them. Then i constructed parse table, but for the entry on state S when in...
I'm studying advanced database and I can not understand some concepts related to the join. I hope I'm in the right place to post my doubts, otherwise I'm sorry. I realized that to make the equijoin there are several families. In particular, the family that is based on the Cartesian product includes three main methods:...
All papers with the subject of total functional programming make use of some kind of static type checking to ensure totality. This make sense considering hoy easily is to make a language Turing-complete. The question is: Is there any untyped/dynamically-typed formalism that ensures total functions? Edit In other words,...
If CFL are not closed under complementation, it means that if a language '$L$' is CFL then its compliment $L^C$ is not CFL. Then how can we discuss about $L^C$ being recursive? My doubt arose because I think if a language cannot be decided CFL or not then how can it be declared Recursive ?
Can the idea of concatenative programming languages be extended to call-by-need evaluation strategy? I see some problems that I will explain with few examples. I will use a prefix instead of a postfix notation, so evaluation takes place from left to right. Duplicate an argument seems trivial: drop A B -> B However, ...
I'm trying to figure out how to create grammars which are LL(k) and not SLL(i). Is this grammar LL(2) and not SLL(2)? $S \to aaab \mid aab$ Where S is a starting symbol. I think it is not SLL: FIRST$_2$(aaab) is FIRST(aab) And I think that it's LL(2) and LL(1) too because there are no non-terminal symbols which could ...
This is a continuation of the problem described in this topic: Optimized algorithm to match entities together based on heuristics. I've come a little closer as to what might be the best solution. I've got a general graph of nodes that contains edges which relate nodes to each other. These edges have a cost, which is ca...
I am investigating heuristics for optimising the packing a fixed number of knapsacks with a set of items of defined weights, however the knapsacks do not have a defined capacity limit. The objective of the optimisation is instead to find a configuration which minimises the difference in weights between the loaded knaps...
I'm a rank amateur in the area of pseudo-random number generation. I've recently found out that certain generators are better than others (e.g. mt19337 vs rand in C++) and learned what modulo bias is. My Request I'm looking for an introductory book on pseudo-random number generation. Does one exist? My Requirements Th...
I'm working on a program which must use inference in first-order logic, and everything is working great except for 1 thing which I don't understand. The book I'm using, "Artificial Intelligence A Modern Approach" by Russell and Norvig, shows a proof on page 349 which has me confused. They combine the two following sent...
Definitions An image filter is a matrix $m \in \mathbb{R}^{k_1 \times k_2 \times k_3}$ which gets applied to an image $I \in \mathbb{R}^{l_1 \times l_2 \times l_3}$ as a discrete convolution $$I'(n_1, n_2, n_3) = \sum_{i=0}^{k_1} \sum_{j=0}^{k_2} \sum_{k=0}^{k_3} I[n_1-i - \lfloor \frac{k_1}{2} \rfloor, n_2 - j - \lfl...
The increasing order of following functions in terms of asymptotic complexity is: (A) f1(n) < f4(n) < f2(n) < f3(n) (B) f1(n) < f2(n) < f3(n) < f4(n) (C) f2(n) < f1(n) < f4(n) < f3(n) (D) f1(n) < f2(n) < f4(n) < f3(n) I saw this question on GeeksQuiz but I am unable to understand its answer. The correct answer is D. I...
I understand the concept of induced subgraph, but could not understan what induced matching is. As appears in this paper, it is defined as A matching in a graph is an induced matching if it occurs as an induced subgraph of the graph. However, in this paper, there is a slightly different definition: A matching in a...
In unification, there is a "occur-check". Such as $X = a \, X$ fails to find a substitution for $X$ since it appears on right hand side too. The first-order unification, higher-order unification all have occur-check. the paper nominal unification described a kind of unification based on nominal concepts. But I did not...
I am a self taught programmer, with no formal degree in CS. I have read couple of papers which were recommended on some or other blog and found them interesting. Where can I read papers on computer science ? Are these papers available for free? If not papers are there any essays on any popular blog posts?
I want to find the shortest path (least number of edges) between two nodes in an unweighted graph. How do I implement this by using a BFSiterator(v) which returns vertices in BFS order, starting from node v? The graph interface only allows the function neighbours(v) (to get the neighbour vertices of v) to be used. Thi...
Say that there are two sorted lists: A and B. The number of entries in A and B can vary. (They can be very small/huge. They can be similar to each other/significantly different). What is the known to be the fastest algorithm for this functionality? Can any one give me an idea or reference?
I am trying to learn to program and I don't just want to learn syntax, but rather learn and practice breaking up and solving problems. Now, I want to know where can I go to get hold of material that ranges in programming problems from beginner to intermediate and hopefully even further so that I can train my problem-so...
Let S be the set of all possible shortest paths in a directed graph. A path s in S is said to be maximal if it is not a subpath of another path in S i.e. it cannot be extended to another shortest path. Let M be the set of all maximal paths in S.   Does anyone know how to efficiently sample paths from  M. Ideally, I wou...
A well known algorithm in computational geometry is the sweep plane algorithm. I've been trying to find if there's a general version of the sweep plane algorithm in $\mathbb{R}^n$, I don't need to implement it but I need to study how the general version would work. If there's nothing you known in literature, how diffi...
I describe an approach to graph isomorphism which probably has false positives, and I am curious whether there is literature indicating that it does not work. Given two adjacency matrices $G, H$, an admittedly naive method of checking for isomorphism is to check whether for each row $u$ of $G$, there is a row $v$ of $G...
Suppose that there are $n$ nodes, and that edge $e$ of weight $w_e$ cuts the tree into parts of size $k_e,n-k_e$. Then the average distance is $$ \sum_e w_e k_e (n-k_e). $$ For example : n=6,k=6 list=[1,2,3,4,5,6] Node--------> 1 \(1)<-----------Weight ...
If we wanted to see if any disjointed subset of a set $X = [w_1, ..., w_n]$ exists such as the sum of its elements equal exactly a given value $M$ (0-1 Knapsack problem) we could employ a DP solution or a simple greedy algorithm. A simple implementation of which could be the following. Sort the set $X$ in non-decreasin...
Assuming someone tries to approximate a function which decides if a turing machine halts or not. It uses only a finite amount of time. The function returns $0$ (=the turing machine halts), $1$ (=the turing machine never halts) or $2$ (=the algorithm could not decide if the turing machine ever halts). If it returns $0$ ...
I'm writing a paper for a programming languages workshop in which I have to describe the semantics of a new optimization for Java using Operational Semantics, small step style. I have never used Operational Semantics before so I'm doubtful as whether to include in the paper some rules I'm using that are rather... let's...
In their answer, Janoma proves that $\{a^ib^jc^k:i\neq j,j\neq k,i\neq k\}$ is not context-free using Ogden's lemma, but I haven't learned about Ogden's lemma yet. I wanted to know whether Ogden's lemma can be dispensed with. This could be interpretted as $\{a^ib^jc^k: i,j,k\text{ are not all equal}\}$ correct? Can som...
I have problems in writing algorithms before writing code for a particular program. An algorithm is just like a recipe. But when it comes to programming complex structures (like nested conditional statements and loops) in my code, I am not able to write one, and often get confused easily. How can I get over this thing?...
Consider a 512-KByte cache with 64-word cachelines (a cacheline is also known as a cache block, each word is 4-Bytes). This cache uses write-back scheme, and the address is 32 bits wide. Answer the next questions for Direct Mapped cache, Fully Associative and Way Set Associative What is the size in bits of the cachelin...
I know how a Turing machine works, how it accepts a language but in some. In some scenarios we would like to use counters. For example, I want to develop a machine that accepts $\{0^{2n} : n \geq 0\}$. How can I count the number of zeroes? If some one of you could solve the following problem for me it would help my und...
I am considering a network with the max flow problem in a particular situation. I have a set of flows which should pass a certain node A and and another set of flows which should avoid A and pass through another node B. The flows can cross each other at any other arbitrary node. Under what category of network flow pro...
One of my CS course assignment problems was finding whether $L = \{a^n b^{2n} \mid n \ge 0 \}$ was regular or not. Now, I'm struggling quite a bit getting my head around this as it just seems like an overly complicated pigeonhole problem. Regardless, I have written my solution and would like to know if it makes sense o...
Suppose that we have an undirected graph, and that for any two nodes there is a path from one to another. In such a graph, there might be some nodes that, if removed from the graph individually, leave behind the starting graph as two or more subgraphs - that is, removing one of the said nodes no longer makes possible t...
The below problem is from my Formal Languages class. The professor suggested drawing derivation trees for the language until we reach epsilon in all the leaves, and that it should begin to look like a geometric series. But I'm still having trouble getting started. The way it was explained: if a context free grammar G c...
I'm trying to understand the bandwidth problem on graphs. Consider the following tree given as an adjacency list: 1 => 4 2 => 6 3 => 5, 6 4 => 7 5 => 3 6 => 2, 3, 7 7 => 4, 6 It is claimed an optimal ordering of the vertices is 1 4 5 7 3 6 2, but I don't see how. When I draw the graph, 5 is 4 edges away from 4, and 3 ...
I was just wondering, if an algorithm $A$ has a time complexity O$(2^n)$, since $2^n$ can be represented using a Taylor series, which is a polynomial, does this mean that $A$ has polynomial time complexity? Generalising even further, does this mean that any algorithm which has a time complexity O($f(n)$) where $f(n)$ h...
I have attached the problem below Consider a 512-KByte cache with 64-word cachelines (a cacheline is also known as a cache block, each word is 4-Bytes). This cache uses write-back scheme, and the address is 32 bits wide. Let's try to start doing the first row. To find the Cachline index, I would have to know the numbe...