{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lec0309-traversals - Todays announcements MP4 available EC...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
MP4 available, EC due 3/4, due 3/11, 11:59p. Today: Trees -------------------------- Complete tree: http://xlinux.nist.gov/dads//HTML/completeBinaryTree.html Today’s announcements:
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Rooted, directed, ordered, binary trees Tree ADT: insert remove traverse template <class T> class tree{ public: private: struct treeNode{ T data; treeNode * left; treeNode * right; }; treeNode * root };
Image of page 2
Theorem: if there are n data items in a binary tree, then there are ______ null pointers.
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Traversal – scheme for visiting every node. • At each node, two choices for direction (left, right) • After both subtrees of a node are complete, move back up tree • Each node is “visited” 3 times in a traversal. • Each of those visit times corresponds to a particular kind of traversal. http://nova.umuc.edu/~jarc/idsv/lesson1.html
Image of page 4
Traversals: template<class T> void binaryTree<T>::_______Order(treeNode * croot){ if (croot != null){ ________Order(croot->left); ________Order(croot->right); } }
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Traversals: template<class T> void binaryTree<T>::_______Order(treeNode * croot){ if (croot != null){ ________Order(croot->left); ________Order(croot->right); } }
Image of page 6
Traversals:
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern