Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Dumping trees to a terminal in a compact, readable form is an invaluable aid to developing and debugging tree-based algorithms. The following demonstrates a mechanism for doing this for array-based binary trees:

A couple of examples:

C:\test>genBinTree -S=1 ___________ ___________/ \___ _______/ \_ _/ \ _____/ \_ _/ \_ _/ \_ z _/ \_ _/ \_ _/ \ / \ _/ \ / \ _/ \_ _/ \ _/ \ / \ _/ \ r s t / \ w x y _/ \ / \ / \ h / \ k m n / \ q u v / \ c d e f g i j o p a b C:\test>genBinTree -S=1 -N ___________ ___________/ \___ _______/ \_ _/ \ _____/ \_ _/ \_ _/ \_ z _/ \_ _/ \_ _/ \ / \ _/ \ / \ _/ \_ _/ \ _/ \ / \ _/ \ r s t / \ w x y _/ \ / \ / \ h / \ k m n / \ q u v / \ c d e f g i j o p a b a b c d e f g h i j k m n o p q r s t u v w x y z l r h e c o o o n u i i o s a u o i a n i h r a u p a a l h x l t d l l k v c p e m e n i c i a n l h v r t o t f e i i o e e a a b e r g f t s y k u a o l a r l g e m r e o r o o o k e i o o t b c a r r e e e t e m y r C:\test>genBinTree -S=1234567890123456789 _____________________ _______/ \_ _______/ \___________ _/ \___ _/ \ _____/ \ _/ \ / \_ / \___ f / \_________ q _/ \ v w _/ \ a / \_ g ___/ \ _/ \ u / \ z b _/ \ / \_____ p / \ t x y / \ e h _/ \_ r s c d / \_ _/ \ i / \ / \ o j k m n C:\test>genBinTree -S=123456789012345678 _______ ___/ \_ _/ \_ _/ \_______ / \_ / \_ / \ / \_________ a / \ d / \ g h i _/ \___________ b c e f _/ \ ___/ \_ _/ \ n _/ \ _____/ \ / \ m _/ \_ s ___/ \ z j k / \ / \ / \_ y o p q r t _/ \_ / \ / \ u v w x

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong


In reply to Dumping trees to a console. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    [stevieb]: ...optionally displaying the results to a connected LCD with the dist name, date, time and commit of the last run along with a FAIL/PASS. Obviously I can't get CI with Travis for a RPi, so I built my own :) It'll take a couple of blog posts I think...
    [stevieb]: ...to cover it all. Awesome thing is that you can dispatch ANY distribution to it (and include all revdeps if desired), and it works all the same as if I'm just testing the RPI code itself
    [stevieb]: I'm rather pleased with myself and everything I've leared along this arduous and sometimes frustrating path
    [stevieb]: Just need to implement an email plugin or something so I can get alerted remotely if the status of a build has changed from the last run
    [stevieb]: Because of the extreme complexity of the testing code itself, I implemented extensive logging so I can troubleshoot much easier by setting a high debug level.
    [stevieb]: if you're interested in the test/build backend, have a look at Test::BrewBuild.

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (3)
    As of 2017-04-28 21:47 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      I'm a fool:











      Results (529 votes). Check out past polls.