Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. How are the following two expressions different? (This question if for typeca

ID: 3755867 • Letter: 1

Question

1. How are the following two expressions different? (This question if for typecasting review in C language)

(int*)&p + 1
(char*)&p + 1

2. Which of the following is true for a hash table with separate chaining and no duplicates are allowed? Select all that apply.

you can select multiple options, from none to all:

a)There is an upper bound to the number of elements that we can insert into the hash table because of space constraints in the array.
b)There is no upper bound to the number of elements that we can insert but inserting too many elements can affect the running time of insert
c)There is no upper bound to the number of elements that we can insert but inserting too many elements can affect the running time of find
d)There is no upper bound to the number of elements that we can insert and no performance impact either since we can always append to the list

3. Given the input {4371, 1323, 6173, 4199, 4344, 9679, 1989}, a fixed table size of 10 with separate chaining, and a hash function h(x) = x mod 10. Assume that we start with an empty hash table. How many non-empty chains are there in the hash table after we add all x from the input sequence into the table?

4. Given the input {4371, 1323, 6173, 4199, 4344, 9679, 1989}, a fixed table size of 10 with linear probing, and a hash function H(X) = X mod 10. Which option below is NOT a table entry after we add all X from the input sequence, in order (no deletion). Select all that apply. Assume that we start with an empty hash table. Every entry is represented as entry_index: item.

you can select multiple options, from none to all:
a) 0: 9679
b) 4: 4344
c) 6: null
d) 9: 1989
e) All are valid entries

5. Given a hash table fixed size of 10 with linear probing, and a hash function H(X) = X mod 10. If we start from the hash table below and perform the given sequence of operations. At the end of the sequence, what should be the status of entry index 1?

0: 49
1: 58
2: 9
3: null
4: null
5: null
6: 76
7: null
8: 18
9: 89

Operations: add(106); remove(58); remove(9); add(20);


select one:
a) 58
b) null
c) inactive
d)20

Explanation / Answer

Please Note: As the post contain more than One Question, according to the Chegg Answering Guidelines, I have answered the first question here. For receiving the answers to the rest of the Questions, please Re-post for the other Questions

1. How are the following two expressions different? (This question if for typecasting review in C language)

(int*)&p + 1

(char*)&p + 1

Answer)

The above is an example of a cast in C, where -

(int*)&p means that, for example, p is a float and when you take that address of the float it is a float*. Now casting this to an int* gives you a pointer referencing the same location but pretends that it is an int* and not a float*.

Same is with the other one as -

(char*)&p means that we are casting p which is a float value from float* to char*.

Thus, these 2 are different.