TIME COMPLEXITY

Best case

Average case

Worst case

SPACE COMPLEXITY

Worst case: