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

16. Ro all that an ArrayDeque stores nelements at locations a[j].aKj+1)%alength

ID: 3596348 • Letter: 1

Question

16. Ro all that an ArrayDeque stores nelements at locations a[j].aKj+1)%alength ,a[(j+n-1)%a.length] public class ArrayDequecT>extends AbstractListcT> TO a int j: int n; What is the amortized running time of the add(i,x) and remove(3) operations? (b) O1 +i-/2) 1 +mini,n-i) (e) O(1 + minfi n,n-) 17. If," 210 then the binary representations of ana--I are (a) 10000000000 and 09999999999, respectively 10000000000 and 01111111111, respectively (d) 10101010001 and 00101010111, respectively 18. Fro the previous question, if the binary representation of x is 000111000111000111000101010101010101 then the binary representation of is (a) 000111000111000111000101010101010101 (c) 000111000111000111000101000000000000 (d) 000000000000000000000111000111000111

Explanation / Answer

Here are the solutions tho the above questions, Do comment if you have any doubts :

16. For add and remove operation, a linear time complexity works from O(1+min{i,n-i});

Thus, option D, O(1+min{i,n-i}) is correct.

17. m = 2^10 can be written as 10000000000 , thus m-1 is 01111111111. Hence, option b is right.

18. For x % m, every digit of x beyond the value of m should be 0. x % m is always < m.

Thus, b) 0000...00101010101 is the right answer.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote