Data Structure Lect5 - Week2
Data Structure Lect5 - Week2
Lecture 5
Topics
Algorithms
Properties of algorithm
Searching Algorithms
Linear Search
Binary Search
Algorithm
An algorithm is a finite sequence of precise instructions for performing a
computation or for solving a problem.
The list is then split into two smaller sublists of the same size, or where one
of these smaller lists has one fewer term than the other.
Sorting Algorithm
Bubble Sort
Insertion Sort
To carry out the bubble sort, we perform the basic operation, that is,
interchanging a larger element with a smaller one following it, starting at the
beginning of the list, for a full pass.
Big O Notation
Halting Problem
Big O Notation
Let f and g be functions from the set of integers or the set of real numbers to the
set of real numbers. We say that f(x) is O(g(x))if there are constants C and k such
that
We observe that we can readily estimate the size of f(x)when x>1 because x<x 2 and
1<x 2 when x>1.
It follows that
0 ≤ x2 +2x +1 ≤ x2 +2x2 +x2 = 4x2
Graph Of Function
Halting Problem
We will show that there is a problem that cannot be solved using any
procedure.
That is, we will show there are unsolvable problems. The problem we will
study is the halting problem
Example of Halting Problem