Problem: Consider the problem of given two sorted lists of distinct integers, A[1] < . < A[n] and B[1] < .. < B[n], return the number of elements that are in both lists.
Design an algorithm that solves the problem. Use a loop invariant to prove that your algorithms is correct.
Give a time analysis in O notation for your algorithm.
If the lists were given to you unsorted, what would be an efficient method to solve this problem and how long would it take?