Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I was solving a problem of arrray of finding the pivot index of the array, ie. left sum and right sum of that element should be equal I used accumulate in stl but i wonder if interviewer ask the time complexity of the accumulate fx then i shoul be answerable

What I have tried:

i google many website but could not locate the complexity of the accumulate function so my question is what is the time complexity of accumulate function in c++ STL for n integer vector?
Posted
Updated 11-Nov-20 23:01pm

Did your search find this page : accumulate - C++ Reference[^] ?
 
Share this answer
 
Comments
CPallini 12-Nov-20 5:12am    
5.
It is O(N), of course.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900