search-tree

Knight's Shortest Path Chess Question

I've been practicing for an upcoming programming competition and I have stumbled across a question that I am just completely bewildered at. However, I feel as though it's a concept I should learn now rather than cross my fingers that it never comes up. Basically, it deals with a knight piece on a chess board. You are given two inputs: s...

Ruby Search tree example confusion

I've been trying to take apart this app which creates a search tree based on keywords, but I'm afraid its a bit too complex for me. Would anyone mind explaining it? The format is off, so here's a pastebin (is pastie.org down?) version of it. Any help is appreciated. ...

How to functionally generate a tree breadth-first. (With Haskell)

Say I have the following Haskell tree type, where "State" is a simple wrapper: data Tree a = Branch (State a) [Tree a] | Leaf (State a) deriving (Eq, Show) I also have a function "expand :: Tree a -> Tree a" which takes a leaf node, and expands it into a branch, or takes a branch and returns it unaltered. Th...

What are the advantages of binary search trees with all elements stored in the leaf nodes ?

I'm reading Advanced Data Structures by Peter Brass, and in the begining of the chapter on search trees, he stated that there is two models of search trees; one where nodes contain the actual object (the value if the tree is used as a dictionnary), and an other where all objects are stored in leaves and internal nodes are only for compar...