ADA Lab File
ADA Lab File
PROGRAM CODE:
Time complexity is the time taken by an algorithm as a function of input.
OUTPUT:
PROGRAM 2
PROGRAM CODE:
OUTPUT:
PROGRAM 7
THEORY: Binary search is the search technique that works efficiently on sorted lists.
Hence, to search an element into some list using the binary search technique, we must
ensure that the list is sorted.
Binary search follows the divide and conquer approach in which the list is divided into
two halves, and the item is compared with the middle element of the list. If the match is
found then, the location of the middle element is returned. Otherwise, we search into
either of the halves depending upon the result produced through the match.
PROGRAM CODE:
OUTPUT:
PROGRAM 9
PROGRAM CODE:
OUTPUT:
PROGRAM 10
PROGRAM CODE:
OUTPUT:
PROGRAM 13
2. The KMP Matcher: With string 'S,' pattern 'p' and prefix function 'Π' as inputs,
find the occurrence of 'p' in 'S' and returns the number of shifts of 'p' after which
occurrences are found.
PROGRAM CODE:
OUTPUT: