LeoShi/algorithm_practice — pull request #1 by LeoShi (2014-11-29 07:41:58+00:00)
Title: Question 1) Given a string, write a routine that converts the string to

a long, without using the built in functions that would do this.
Describe what (if any) limitations the code has. For example:
long stringToLong(String s)
{
/* code goes here to convert a string to a long */
}
void test()
{
long i = stringToLong("123");
if (i == 123)
// success
else
// failure
}
Question 2) Implement insert and delete in a tri-nary tree. A tri-nary
tree is much like a binary tree but with three child nodes for each
parent instead of two -- with the left node being values less than the
parent, the right node values greater than the parent, and the middle
nodes values equal to the parent.
For example, suppose I added the following nodes to the tree in this
order: 5, 4, 9, 5, 7, 2, 2. The resulting tree would look like this:
5 /|\ 459
// 27
| 2