Write a function to reverse a string without using built-in reverse functions, and discuss its time complexity.