practice-Trees

# practice-Trees - root A internal nodes ABD leaves EFCGH I...

This preview shows pages 1–2. Sign up to view the full content.

Empty trees are designated here with / root A internal nodes A B D leaves E F C G H I height 3 level of root 0 level of node with F 2 nodes at level 1 3 parent of G, H and I D descendants of B E F CSE205- Fall 2008 Trees _Chapter 16 Last Name ________________ First _____________ Date_____ Arrays and Linked List are Linear Data structures. Every element has one unique predecessor and one unique successor (except the first and last elements). Arrays, lists, stacks, and queues all have this distinctive linear characteristic. The Tree structure presented is an exception to this linear category. Trees can help solve a variety of problems. Some tree processing algorithms will have recursive solutions because many tree operations include some steps that will process one or more subtrees. Trees A tree is often used to store large collections of data. For example, the file systems on most computers are implemented in a tree structure. Files are organized in folders, where a single folder may have multiple folders under it that contain files and possibly other folders. The collection of files and folders can be viewed as a tree. A tree is a collection of nodes with one node designated as the root . Each node references some object and has edges connecting it to other nodes, which are also trees. These other nodes are called children . A tree can be empty have no nodes. Each node in a tree has exactly one parent except for the distinctive node known as the root of the tree. The root is the top-most node in a tree. Whereas the root of a real tree is usually located in the ground and the leaves are above the root, computer scientists draw trees upside down.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern