Average search cost is 2 2 3 download files

Info icon This preview shows pages 2–3. Sign up to view the full content.

Average search cost is 2 2
Image of page 2

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

3. Download files containing integer data from the course website. (a) The files 1p.dat , 2p.dat , ..., 12p.dat contain 2 1 1, 2 2 1,..., and 2 12 1 integers respectively. The integers make 12 perfect binary trees where all leaves are at the same depth. Calculate and record the average search cost for each perfect binary tree. (b) The files 1r.dat , 2r.dat , ..., 12r.dat contain same number of integers as above. The integers are randomly ordered and make 12 random binary trees . Calculate and record the average search cost for each tree. (c) The files 1l.dat , 2l.dat , ..., 12l.dat contain same number of integers as above. The integers are in increasing order and make 12 linear binary trees . Calculate and record the average search cost for each tree. (d) Make a plot showing the average search cost (y-axis) versus the number of tree nodes (x-axis) of all perfect binary trees, random binary trees and linear binary trees. (e) Provide the output in the text format. The nodes will be printed according to their depth level. Missing nodes will be represented by the symbol X . A possible solution is to fill the missing nodes with fake nodes in the data structure when printing the tree. Example: 5 3 9 X X 7 X 4. Extra credit. (a) (10 points) Use the in-order traversal and any graphic programming library like FLTK for binary tree drawing. See the textbook, page 301 for the algorithm. (b) (10 points) Implement a balanced binary search tree using one of the balancing technique like AVL, Red-Black or 2-4 tree.
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '09
  • search cost, average search cost

{[ 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