Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

III. Computer Science > 22. Trees and Game Trees

Chapter 22. Trees and Game Trees

Sean M. Burke

Perl’s facility with references, combined with its automatic management of memory allocation, makes it straightforward to write programs that store data in structures of arbitrary form and complexity.

But I’ve noticed that many programmers, especially those who started out with more restrictive languages, seem at home with complex but uniform data structures—multidimensional arrays, or more struct-like things like hashes-of-arrays (-of-hashes[-of-hashes]), and so on—but they’re often uneasy buliding more freeform, less tabular structures, like trees.

Trees are easy to build and manage in Perl, as I’ll demonstrate by showing how the HTML::Element class manages elements in an HTML document tree, and by walking you through a from-scratch implementation of game trees. First, I need to nail down what I mean by a “tree.”


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint