Question Detail: This is a GRE practice question. If a node in the binary search tree above is to be located by binary tree search, what is the expected number of comparisons required to locate one of the items (nodes) in Read More …
Blog
Average number of comparisons to locate item in BST
Question Detail: This is a GRE practice question. If a node in the binary search tree above is to be located by binary tree search, what is the expected number of comparisons required to locate one of the items (nodes) in Read More …
Graph Has Two / Three Different Minimal Spanning Trees?
Question Detail: I’m trying to find an efficient method of detecting whether a given graph G has two different minimal spanning trees. I’m also trying to find a method to check whether it has 3 different minimal spanning trees. The naive Read More …
Why do we not combine random number generators?
Question Detail: There are many applications where a pseudo random number generator is used. So people implement one that they think is great only to find later that it’s flawed. Something like this happened with the Javascript random number generator recently. Read More …
Given the logical address, how to extract the page number?
Question Detail: I am studying Computer Systems. I have th following question and its answer: Given the logical address 0xAEF9 (in hexadecimal) with a page size of 256 bytes, what is the page number? Answer: 0xAE (I found this answer in Read More …
Constructing a binary tree with given traversals
Question Detail: I have given a post order & in order traversal a BST & I need to construct it. I want to know how to do this. for eg. Post Order : DCBGFEA In Order : BDCAFGE This is how Read More …
What algorithm would compute the maximum choices from two sets?
Question Detail: Given two vectors of integers of possibly unequal lengths, how can I determine the maximum result possible from accumulating choosing the maximum between corresponding pairs of numbers between the two vectors with extra zeros inserted into the shorter vector Read More …
What is complement of Context-free languages?
Question Detail: I need to know what class of CFL is closed under i.e. what set is complement of CFL. I know CFL is not closed under complement, and I know that P is closed under complement. Since CFL $subsetneq$ P Read More …
Relation and difference between associative array and hashing table?
Question Detail: I thought associative array (i.e. map, or dictionary) and hashing table were the same concept, until I saw in Wikipedia that For dictionaries with very small numbers of bindings, it may make sense to implement the dictionary using an Read More …
How can $ww = www$ hold for any word $w$?
Question Detail: Speaking in terms of automata and regular languages, how would it be possible for a string repeating some $w$ twice equal a string repeating that same $w$ thrice? That is, why is the language $qquad L = {w in Read More …