Final A20 English Version
Final A20 English Version
Guidelines:
- Write legibly!
<lastname>_<givenname>.pdf
For all of the exam questions you will use a string that contains the letters of your
first and last name. To obtain this character string, merge the letters of your last
name and your first name by converting them to lowercase characters, without
repeating the same letter 2 times and up to a maximum of 20 characters. If the
result is shorter than 20 characters, complete with the unused letters of the alphabet
in alphabetical order (from 'a' to 'z') and so that there is not twice the same
character.
Enter the resulting character string with your last and first names in the table
below. This character string will be referred to by the name variable in the exam
questions. Also note the index of the last letter of the characters of your last and
first names. This index will be referred by the last variable in the exam
questions.
example) first name : “Francois”, last name : “Major”
name = ‘majorfncisbdeghklpqt’
m a j o r f n c i s b d e g h k l p q t
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
last = 9
name =
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
last =
2
IFT2015 - Structures de données A20
a. (6) Complete the table indicating the returned value and the status of the
queue after each operation:
len( Q )
Q.removeMin()
Q.min()
Q.removeMin()
Q.isEmpty()
len( Q )
Q.removeMin()
3
IFT2015 - Structures de données A20
4
IFT2015 - Structures de données A20
5
IFT2015 - Structures de données A20
a. (6) Complete the table indicating the returned value and the status of the
queue after each operation:
len( Q )
Q.removeMin()
Q.min()
Q.removeMin()
Q.isEmpty()
len( Q )
Q.removeMin()
6
IFT2015 - Structures de données A20
7
IFT2015 - Structures de données A20
8
IFT2015 - Structures de données A20
a. (14) Complete the table indicating the returned value and the status of the
queue after each operation:
len( Q )
Q.removeMin()
Q.min()
Q.removeMin()
Q.isEmpty()
len( Q )
Q.removeMin()
9
IFT2015 - Structures de données A20
10
IFT2015 - Structures de données A20
11
IFT2015 - Structures de données A20
Head Head Tail Tail Head Tail Head Tail Tail Head Head Head Tail Head Tail Head
(2)0 Considérez
1 2 trier
3 à l’aide
4 5d’une6file d’attente
7 8 avec
9 priorités.
10 11 Quels
12 énoncés
13 14 sont
15
that is Head the value (index 0) returned by the first call to flip()
Head the value (index 1) returned by the second call to flip()
Tail the value (index 2) returned by the third call to flip()
… and so on
If you need more values use this array as a circular sequence, i.e. value (index 0) of
17th call to flip() is Head, value (index 1) of 18th call to flip() is Head,
19th call Tail, and so on.
Reminder: The height of a column/tower for an insertion in a skipList
increases as coin.flip() results in Head.
For question 5, use the hash function
h(x) = ord( x ) mod (last + 9)
where
ord( ‘a’ ) = 97
ord( ‘b’ ) = 98
…
ord( ‘z’ ) = 122
12
IFT2015 - Structures de données A20
13
IFT2015 - Structures de données A20
14
IFT2015 - Structures de données A20
15
IFT2015 - Structures de données A20
16
IFT2015 - Structures de données A20
a. (2) What is the size of your ProbeHashMap hash table after initialization?
b. (18) Using the hash function given on page 12, draw the state of your
ProbeHashMap hash table after each iteration:
17
IFT2015 - Structures de données A20
18
IFT2015 - Structures de données A20
19
IFT2015 - Structures de données A20
20
IFT2015 - Structures de données A20
b. (27) Draw the AVL trees of your AVLTreeMap after each iteration of the
loop and after the deletion.
21
IFT2015 - Structures de données A20
22
IFT2015 - Structures de données A20
23