Problem 1 Sample result table and line chart format Runtime
Problem 1
Sample result (table and line chart format): Runtime of Alg x (in Runtime of Alg Y (in Data size seconds) seconds) 14.05 0.01 50000 100000 0.02 56.9 0.03 85.35 150000 200000 229.44 0.05 0.0625 250000 286.8 513.34 300000 0.065 Runtime of Alg X and Y vs. Data size 600 400 2000 F 200 60000 120000 180000 240000 300000 Data size Runtime of Alg X (in seconds) Runtime of Alg Y (in seconds)Solution
worst case of the linear search: - in the linear search, if the item is either present in the last index of the array(data set) or it is not present at all in the whole data set.
Complexity: - O(n), where n is the size of data set
the worst case of the Binary Search: - in the Binary Search Algorithm if the item is not present in the whole data set then the item will not be found.
since data set should be in sorted order and the binary search algorithm determines middle point which compares the item in left and right part of data size. if the item is smaller then middle point then it would be available in left part otherwise in the right part. but if data is not there then it can\'t be found
Complexity: - O(log N), where N is the size of data set
