Professional Documents
Culture Documents
Section-A
The University of Lahore
Assignment-2
Announced: Wednesday 03-10-2018
Deadline: Tuesday 09-10-2018, till 12 at night,
email to: Yasir.niaz@cs.uol.edu.pk
Late Submission: 10% marks deduction per hour.
Problem Statement:
Implement the following functions in C++:
Linear Search
Binary Search
Bubble Sort
Insertion Sort
Selection Sort
In each of these functions, make a counter that counts how many times the
statements inside the loop(s) run. Then divide this number by “size” and
tell whether this function takes time O(n), O(log n) or O(n 2)?
main()
{
float array[1000];
LinearSearch(array, 5.3);
BubbleSort(array);
BinarySearch(array, 8.2);
InsertionSort(array);
SelectionSort(array);
}