You are given a string e.g. "acdfdcqqc" and need to create an algorithm to find the largest palindromic substring, in our case "cdfdc". It's easy to devise a O(n^2) algorithm by creating an array of size 2n and each time computing the length of the largest palindrome with that point for center i.e.:
a - c - d - f - d - c - q - q - c
1 0 1 0 1 0 5 0 1 0 1 0 1 4 1 0 1
For each of the 2n possible starting points I move in both direction finding the length of the largest palindrome starting at that position. So for each of the 2n operations I do at most O(n) operations, hence the O(n^2) time complexity.
I know it can be done in linear time using a fancier algo: https://en.wikipedia.org/wiki/Longest_palindromic_substring .
But assuming that the string we are handling are extracted from natural English text. If we pick a position at random in an English text, the expected symmetry that we might expect to find is quite low. I would even say that the expected symetry is of less than one character on each side. Therefore, is it ok for me to say that my algorithm is doing 2n times expected constant time operations, making the algorithm O(n) on average ?