Hi, Im suppose to write a Maximum consecutive sorted substring in a string. "abacdefkabfh" is acdefk. Im suppose to analyze the time omplexity of an algorithm.. I dont know where to begin
selenask 0 Newbie Poster
Recommended Answers
Jump to PostGoogle.
Jump to PostComplexity should be O(n). You only need to scan through the entire String once. If you get to a point where your current sequence it is no longer in sorter order, start your current counter over, moving to the next character. Then repeat.
All 5 Replies
verruckt24 438 Posting Shark
verruckt24 438 Posting Shark
selenask 0 Newbie Poster
selenask 0 Newbie Poster
BestJewSinceJC 700 Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.