i am asking when we implement find operation using union by rank+path compression technique as in this case worst time is O(logn) but amortized time is O(1) .so while calculating the complexity in algorithms in which we use find operation which time to consider-- worst case time or amortised time?
Complexity issue
@Rj.25
while calculating time complexity of a function, you will consider worst case time. (if the question explicitly asks the time complexity)
in contests/ while solving problems on OJ, you consider amortized time.
for example, when you do vector push_back() it is amortized O(1) , but in worst case when the vector gets completely filled, and then it doubles its size , that operation is O(N). but we always consider push_back as O(1).