Consider a two-dimensional list, i.e., a list of lists. Each of the lists in the list of list contains numbers, and these numbers are sorted. Moreover, all the numbers in the first list on the list of lists are lower than all the numbers in the second list. And the numbers in the second list are all lower than those in the third list. Etcetera. You may assume that each of the lists on the list of lists contains at least one number. An example you see in the code block below.

Write an efficient search function that determines whether a number occurs anywhere in this list of lists and returns True if the number is present and False if the number is not present. Also determine the time complexity of this function.

Note: Copy ‘listoflists’ about your solution, like done below:

listoflists = [ [0, 3, 4, 7, 12, 16, 17, 19],
  [25, 39, 40, 41, 42],
  [50, 51, 56, 57, 58, 72, 81, 82],
  [83, 84, 106, 203, 213, 233, 243, 253, 263, 273, 283],
  [512, 1024, 2048, 4096],
  [4097],
  [5000, 50000, 500000, 678345, 765432, 765433, 800000, 810000, 811000, 811100, 811110, 888888]]

  def search(num):
    return None