Like the Big O notation \"O(1)\" can describe following code:
O(1): for (int i = 0; i < 10; i++) { // do stuff a[i] = INT; } O
For O(logn), please have a look at any code that involves divide and conquer strategy Example: Merge sort & quick sort(expected running time is O(nlogn) in these cases)