I'm really having a hard time understanding this stuff and all the examples I find online just aren't starting from a place that makes sense to me. I missed my lab last week and the prof suggested those of us who missed it should go through the lab anyway because this stuff is going to keep coming up. Unfortunately the answers to the lab haven't been posted so I can't even reverse back the answer. So here's a question from the lab that I'd really appreciate some help with.
3) Consider the the algorithm given below and determine its time complexity. (You can give an asymptotic
upper bound to the complexity of your algorithm but this upper bound should be tight; i.e., it has to
be as close as possible to its actual time complexity.)
input(n, listOfSymbols), where n is a nonnegative integer and listOfSymbols is an array of n symbols counter = 0 for i = 1, i ≤ n, i ++, if listOfSymbols ⩵ ' X ' then counter = counter + 1 endFor Print(counter) end
What would be amazing is if someone could walk me through how to find the time complexity and upper bound in plain english, just the step by step thinking process to arrive at an answer. Because every example I'm finding is going over my head and I can't figure it out. Thanks so much.