Contents    Page-10    Prev    Next    Page+10    Index   

Tracing Flattening Binary Tree


>(flattenbt '(cat (bat ape
                       bee)
                  (eel dog
                       fox)))

  1> (FLATTENBT (CAT (BAT APE BEE) (EEL DOG FOX)))
    2> (FLATTENBTB (CAT (BAT APE BEE) (EEL DOG FOX)) NIL)
      3> (FLATTENBTB (EEL DOG FOX) NIL)
        4> (FLATTENBTB FOX NIL)
        <4 (FLATTENBTB (FOX))
        4> (FLATTENBTB DOG (EEL FOX))
        <4 (FLATTENBTB (DOG EEL FOX))
      <3 (FLATTENBTB (DOG EEL FOX))
      3> (FLATTENBTB (BAT APE BEE) (CAT DOG EEL FOX))
        4> (FLATTENBTB BEE (CAT DOG EEL FOX))
        <4 (FLATTENBTB (BEE CAT DOG EEL FOX))
        4> (FLATTENBTB APE (BAT BEE CAT DOG EEL FOX))
        <4 (FLATTENBTB (APE BAT BEE CAT DOG EEL FOX))
      <3 (FLATTENBTB (APE BAT BEE CAT DOG EEL FOX))
    <2 (FLATTENBTB (APE BAT BEE CAT DOG EEL FOX))
  <1 (FLATTENBT (APE BAT BEE CAT DOG EEL FOX))
(APE BAT BEE CAT DOG EEL FOX)