Course Hero Logo

assignment3.pdf - CSC130 Assignment 3 Fall 2017 1. (15...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 2 out of 4 pages.

CSC130Assignment 3Fall 20171. (15 Points) Sort the following array intonon-decreasingorder using heap sort with heaproot atindex 0.Provide the heap construction result and swap & sink results.Use sinkmethod for heap construction.Note the gray cells indicate numbers outside the heap.0123456789original11429971885886445080HeapConstructionswap & sinkswap & sinkswap & sinkswap & sinkswap & sinkswap & sinkswap & sinkswap & sinkswap & sink2. (20 Points) Given keys as {82, 41, 59, 28, 55, 11, 62, 30, 43, 7} and their associated valuesas {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} respectively.Show the contents of the hash table after insertingthose key values pairs into an initially empty hash table with size 13 using the followingconflict resolution methods:1)Separate chaining.When there is a search miss, insert new key into the first node of thelinked list.2)Linear probingwithout resizing3.(10 Points) The following shows the contents of separate chaining hash table with size5where a key value pair is shown as (key, value) and each key is a Character object.This isused to map key to array index:key.hashCode()%tableSize . Resize the table to size13using the given resize method andprovide the final contents of the new table..,;);++) {];;
1

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 4 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
Heap Construction

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture