Pg.216: Please show all necessary work and explain if possible. I\'m trying to l
ID: 3848526 • Letter: P
Question
Pg.216:
Please show all necessary work and explain if possible. I'm trying to learn for an upcoming midterm! Appreciate it.
(10 points) Basic. Let A 1 9 4, 3,7, 5. 9, 8, 6, 2,0). Illustrate the execution of Randomized Select (A, 1, 9, 4) with Randomized-Partition replaced with Partition: see pg 216. More pre- cisely, list all calls to Randomized-Select(A, p, r, i) with p, r, i specified. Also state A 1 just before each call to Randomized-Select. 15 points Basic. Consider a hash table with m 7 slots and using the hash function h (k) mod 7. Say we insert (element of keys k 8,1, 3, 4, 15 in this order. Show the final table in the following three cases. (a) When chaining is used to resolve collisions. Please insert the element at the beginning of the linked list. (b) When open addressing and linear probing are used to resolve collisions; that is, h (k,i) i mod 7. (c) When open addressing is used with h (k,ij k -t 2i mod 7.Explanation / Answer
#include <iostream>
#include <cstdlib>
#include <iomanip>
using namespace std;
int firstDayofNewYearAndMonth (int );
int numOfDaysInAMonth (int);
void printHeader (int);
void printMonth (int, int&);
void skipToDay (int);
int main ()
cout << endl;
system("PAUSE");
come back EXIT_SUCCESS;
}
/**************************************************************************/
/* This perform calculates the primary day of the New Year */
/**************************************************************************/
int firstDayofNewYearAndMonth(int year)
void printHeader (int m)
else if (m == 3)
else if (m == 4)
else if (m == 5)
else if (m == 6)
else if (m == 7)
else if (m == 8)
else if (m == 9)
else if (m == 10)
else if (m == 11)
else if (m == 12)
cout << " S M T W T F S" <<endl;
cout << "_____________________" << endl;
}
/**************************************************************************/
/* Helps with the skipToDay perform rhetoric rhetoric rhetoric */
/**************************************************************************/
void skip (int i) {
whereas (i > 0)