Examples & questions bank
Recursion
Algorithm Analysis
Consider , to show that :
As this expression cannot hold true for all for a specific value, we can conclude that .
(Example: if the equation does not hold when let's say )
To show that :
As this express can hold true for any with sufficiently large , we can conclude that .
(Example: if the equation holds with )
Consider , to show that :
We know that for easily.
Consider the lower bound:
Therefore we can simply take and to satisfy the definition of big Theta.
Example 1:
Example 2: ( order of growth. This is one of the many satisfying . The useful would be: )
Example 3: ()
Data Structures
Example implementation of reversing a linked list. Reference section
Example implementation of finding the middle node of a linked list. Reference section
Example implementation of BFS. Reference section
Example of finding the average number of slots inspected for unsuccessful search of built hash table with resolution method double hashing. Reference section
with double hashing .
Therefore the average is
Sorting
Example of implementation of selection sort. Sort Summary
Example of implementation of bubble sort. Sort Summary
Example of implementation of insertion sort. Sort Summary
Example of implementation of heap sort. Sort Summary
Example of implementation of merge sort. Sort Summary
Example of implementation of quick sort. Sort Summary
Example of implementation of count sort. Sort Summary
Example of implementation of radix sort. Sort Summary