Problem Detail: It’s possible to parse a document using a single pass from a state machine. What is the benefit of having two passes, ie. having a lexer to convert text to tokens, and having a parser to test production rules Read More …
Blog
[Solved]: Min-max selection sort
Problem Detail: Is there already modified version of selection sort that works like this pseudocode: a // the array, index starts at 1 (not zero-based) n = len(a) for x in 1 to n big = x small = x last Read More …
[Solved]: How to fool the plot inspection heuristic?
Problem Detail: Over here, Dave Clarke proposed that in order to compare asymptotic growth you should plot the functions at hand. As a theoretically inclined computer scientist, I call(ed) this vodoo as a plot is never proof. On second thought, I Read More …
[Solved]: Constructing Context Free Grammar
Problem Detail: I am stuck and having a hard time with this question. I want to construct a CFG for the language $$L = {{a^lb^mc^n | l,min N, n=|l-m|}}$$ I know that the language consists of strings where: 1. number of Read More …
[Solved]: Number of clique in random graphs
Problem Detail: There is a family of random graphs $G(n, p)$ with $n$ nodes (due to Gilbert). Each possible edge is independently inserted into $G(n, p)$ with probability $p$. Let $X_k$ be the number of cliques of size $k$ in $G(n, Read More …
[Solved]: Can we test whether two vertices are connected in time linear in the number of nodes?
Problem Detail: Consider the problem: Given an undirected graph and two of its vertices, is there a path between them? I often read that this problem can be solved in linear time in the number of vertices! I am not sure Read More …
[Solved]: How to decribe an action with STRIPS?
Problem Detail: The state space is decribed with 3 boolean variables $p,q$ and $r$ (so we have 8 states total). We have an action, let’s say $a$. Action $a$ can be executed when $p=text{False}$ and $q=text{True}$ and the result is $p=text{True}$, Read More …
[Solved]: Undirected graph with 12 edges and 6 vertices
Problem Detail: For school we have to make an assignment, and part of the assignment is this question: Describe an unidrected graph that has 12 edges and at least 6 vertices. 6 of the vertices have to have degree exactly 3, Read More …
[Solved]: Load balancing. Why not use priority queues?
Problem Detail: I have recently learned about various randomized algorithms for load balancing. The model is always that there are $m$ balls and $n$ bins and the balls arrive one at a time. The task is to minimize the maximum load Read More …
[Solved]: Reducing from a Turing machine that recognizes is regular to the halting problem
Problem Detail: I’m trying to understand reduction, this is from my textbook and is not a homework problem or even any exercise, just trying to understand an example they present. This is the reduction they give: PROOF We let R be Read More …