[Pdx-pm] Newbie question about data structures and stacks and recursion

Thomas J Keller kellert at ohsu.edu
Wed Nov 30 13:38:27 PST 2005


By chance I was looking at Mastering Algorithms with Perl by Orwant  
et al and he has a section on Heaps: "an interesting variation on a  
binary tree. They're good for (1) finding and removing the smallest  
item in a collection amd (2) adding additional elements to the  
collection"
The relevant section is in ch3. The book is available on line via  
O'Reilly's Safari site.

Tom K

On Nov 30, 2005, at 1:11 PM, Keith Lofstrom wrote:

>
> I am not looking for a solution on the list, just a pointer to the
> right documentation with examples.
>
> I realize that if I copy references in an array or hash, I get a
> reference to data, not a separate copy of the data.
>
> I want to build a recursive subroutine for exploring a branching
> decision tree, and I would like to glom together a bunch of scalars,
> arrays, and hashes into a data structure of some kind and push them
> onto a stack at the beginning of a routine, and pop them off after.
> I can probably cobble up something cheesy, but I would prefer to
> pull the right thing off CPAN or use the proper 5 line technique.
> The data are about 600 elements, the stack might go 10 deep, and I
> won't be doing it very often, if that helps scale the problem.
>
> Keith
>
> -- 
> Keith Lofstrom          keithl at keithl.com         Voice (503)-520-1993
> KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in  
> Silicon"
> Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs
> _______________________________________________
> Pdx-pm-list mailing list
> Pdx-pm-list at pm.org
> http://mail.pm.org/mailman/listinfo/pdx-pm-list
>




More information about the Pdx-pm-list mailing list