We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The calculated index is definied in the two bullet points:
xy: Insert y at the end of the ((x XOR lastans) mod N)th sequence
x y: Print the value of the (y mod size)th element of the ((x XOR lastans) mod N)th sequence. Here, size denotes the size of the related sequence. Then, assign this integer to lastans.
So given 2 squences (N=2), lastans=0 and 1 0 5 | {type = 1, x = 0, y = 5} you would apply operation #1 to 0 and 5: You would insert 5 at the end of the squence at the calculated index of ((0^0)%2)
Think of it like a hashmap with buckets: the sequences are buckets, and you are inserting a new collision at the end of the bucket's linked list.
Dynamic Array
You are viewing a single comment's thread. Return to all comments →
The calculated index is definied in the two bullet points:
x
y
: Inserty
at the end of the((x XOR lastans) mod N)
th sequencex y
: Print the value of the(y mod size)
th element of the((x XOR lastans) mod N)
th sequence. Here, size denotes the size of the related sequence. Then, assign this integer to lastans.So given 2 squences (
N=2
),lastans=0
and1 0 5 | {type = 1, x = 0, y = 5}
you would apply operation #1 to0
and5
: You would insert 5 at the end of the squence at the calculated index of((0^0)%2)
Think of it like a hashmap with buckets: the sequences are buckets, and you are inserting a new collision at the end of the bucket's linked list.