Can i use a build-in function .index() inside the loop or is its big-O-notation o(n) so it changes the big-O-notation of whole algorithm to o(n^2) ?
Date: 26 Nov 2014 21:01
Number of posts: 8
RSS: New posts
Even if it's O(n), in this case it is counted as O(1) because the string is of constant and independent length, which is the 26.
so if i use a function like lst.count ( on inconstant length) in a loop that is constant it's O(n) too, right?
can i assume, that the list input is from the form ['b','c','d','r','a'] that each lst[i] is from type string? , and not [b,c,d,r,a],(in the example it was like this (the command list("bcdra") turn is to ['b','c','d','r','a'] ) , thanks