{"revision": {"id": "f3a64a57-2f95-11f1-b8ab-e86a64d24d78", "node_id": "f3a5a031-2f95-11f1-8053-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "Find the largest number in a list or array of numbers.\r\n========================================================\r\n\r\n.. code-block:: python\r\n\r\n numbers = [5,6,2,7,6,2,0,4]\r\n\r\n max = a[0]\r\n\r\n for number in numbers:\r\n\r\n    if number > max:\r\n        max = number\r\n\r\n**The Big-0 of this program is n  O(n)**\r\n\r\n\r\nSearch for a number in an array or list\r\n=============================================\r\n\r\nTry to search and see if the number 0 is in the list or array\r\n\r\n.. code-block:: python \r\n\r\n numbers = [5,6,2,7,6,2,0,4]\r\n\r\n for number in numbers:\r\n     if number == 0:\r\n         return True\r\n\r\n**The Big-0 of this program is n  O(n)**\r\n\r\n\r\nSearch for a number in a Sorted array or list\r\n===================================================\r\n\r\nTry to search to see if the number 7 is in the list or array.\r\n\r\nnumbers = [-1,0,2,2,4,5,6,6,7,8,9]\r\n\r\n* Worst case in  8 item list is 3 compares.\r\n* Worst case in 16 item list is 4 compares.\r\n* Worst case in 32 item list is 5 compares.\r\n\r\n**The Big-0 of this program is n O(logn) - base 2**\r\n\r\n", "source_format": "rst", "revision_number": 5, "created": 1315855002000}}