Data structure and algorithm in Python - Array-Based Sequences

Give difference between an array and a list in Python. Answer: ... write a method in Python to search for a value with the help of Binary search method. The method should return position of the value and should return -1 if the value not present in the list. Answer: def binarysrch (nums, x): high=len (nums) low=0 while low < high: mid=(low+high)/2 midval=nums [mid] if midval > x: low = mid + 1 ... ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download