Spushbackarri arrj review problem 5 show how to h

Info icon This preview shows pages 7–10. Sign up to view the full content.

View Full Document Right Arrow Icon
s.push_back(arr[i] * arr[j]);
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
Review Problem #5 Show how to h-sort the following array for an h value of 4, in ascending order.   In each row below, show the resulting array after a single pass through the h-sort  algorithm. You may not need to use all 5 rows. 15 -3 12 0 2 0 9 3 7 2 6 5
Image of page 8
Review Problem #6 Given the following unsorted array of integers, show it after it has been heapified using  the efficient heap-sort algorithm that performs heapification in-place. 6 16 3 19 13 72 13 12 99
Image of page 9

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

View Full Document Right Arrow Icon
Review Problem #7 You need to sort an array of integers which is already almost entirely sorted.   Should you use the insertion sort, the merge sort, or the heapsort?  You need to build a table to quickly look up student records by the students’  last names; the set of students will grow and shrink each year as new  students are enrolled and others graduate. Should you use a sorted array, a  closed hash table, or a binary search tree?  You will be inserting the items from an open hash table into a binary search  tree. In order to prevent the binary search tree from becoming pathologically  unbalanced, what’s the simplest binary search tree implementation you should  use? An AVL tree or an unbalanced binary search tree?
Image of page 10
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