I was studying for my finals when I ran into this problem.For 1a, I think its O (1) for amortized complexity, because it has x mod N, which is quite sparse, and linear sensing leads to its failure. However, I am not sure how to indicate or prove this correctly.
For 1b, it will put the hash in the same place, so it will linearly determine more every time it inserts, but I'm not sure how to get the execution time from it.
[, , ). 1a) h (x) = x mod N, n < N, 0, 1,..., n - 2, 0. , . . 0, . 1 , (n - 1). , (n - 1) (2n - 1). (2n - 1)/n .
1b) - . , n , (n + 1) * n/2 . (n + 1)/2 .
1a, , (N , N 0, , 1, ), 1 + 1 +... + 1 + n = (n-1 ) + n = 2n-1, (2n-1)/n, O ( 1) O.
1b, (i-1) i- , i- i. , 1 + 2 +... + n-2 + n-1 + n = (n + 1) * n/2, n , (n + 1)/2.