Question Detail: Is there any set of rules or methods to convert any context free grammar to a push down automata? I already found some slides online but I wasn’t able to understand them. In slide 10 he speaks about some Read More …
Author: ignougroup
Why is it best to use a prime number as a mod in a hashing function?
Question Detail: If I have a list of key values from 1 to 100 and I want to organize them in an array of 11 buckets, I’ve been taught to form a mod function $$ H = k bmod 11$$ Now Read More …
Why are some programming languages Turing complete but lack some abilities of other languages?
Question Detail: I came across an odd problem when writing an interpreter that (should) hooks to external programs/functions: Functions in ‘C’ and ‘C++’ can’t hook variadic functions, e.g. I can’t make a function that calls ‘printf’ with the exact same arguments Read More …
Hash tables versus binary trees
Question Detail: When implementing a dictionary (‘I want to look up customer data by their customer IDs’), the typical data structures used are hash tables and binary search trees. I know for instance that the C++ STL library implements dictionaries (they Read More …
Floyd’s Cycle detection algorithm | Determining the starting point of cycle
Question Detail: I am seeking help understanding Floyd’s cycle detection algorithm. I have gone through the explanation on wikipedia (http://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare) I can see how the algorithm detects cycle in O(n) time. However, I am unable to visualise the fact that once Read More …
Find the longest path from root to leaf in a tree
Question Detail: I have a tree (in the graph theory sense), such as the following example: This is a directed tree with one starting node (the root) and many ending nodes (the leaves). Each of the edge has a length assigned Read More …
How are statistics being applied in computer science to evaluate accuracy in research claims?
Question Detail: I have noticed in my short academic life that many published papers in our area sometimes do not have much rigor regarding statistics. This is not just an assumption; I have heard professors say the same. For example, in Read More …
How does one know which notation of time complexity analysis to use?
Question Detail: In most introductory algorithm classes, notations like $O$ (Big O) and $Theta$ are introduced, and a student would typically learn to use one of these to find the time complexity. However, there are other notations, such as $o$, $Omega$ Read More …
How do O and Ω relate to worst and best case?
Question Detail: Today we discussed in a lecture a very simple algorithm for finding an element in a sorted array using binary search. We were asked to determine its asymptotic compelxity for an array of $n$ elements. My idea was, that Read More …
Detecting cycles in undirected graph
Question Detail: I want to detect cycles in an undirected graph such that I get a list of all edges/vertices which form each cycle. For a graph G({a,b,c,d}, {a-b, b-c, c-d, d-a, b-d}) this would be {a, b, c, d}, {a, Read More …