Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

Also you call input.IndexOf(c, charcheck);. I'm not 100% sure what the complexity of string.IndexOf is in C# but it's going to be related to the length of the string in some way - the naive implementation would be O(n*m) (m == 1 as you're searching 1 char at a time) worst case. Update: speculation confirmed by http://stackoverflow.com/a/2584204/1402923https://stackoverflow.com/a/2584204/1402923

Also you call input.IndexOf(c, charcheck);. I'm not 100% sure what the complexity of string.IndexOf is in C# but it's going to be related to the length of the string in some way - the naive implementation would be O(n*m) (m == 1 as you're searching 1 char at a time) worst case. Update: speculation confirmed by http://stackoverflow.com/a/2584204/1402923

Also you call input.IndexOf(c, charcheck);. I'm not 100% sure what the complexity of string.IndexOf is in C# but it's going to be related to the length of the string in some way - the naive implementation would be O(n*m) (m == 1 as you're searching 1 char at a time) worst case. Update: speculation confirmed by https://stackoverflow.com/a/2584204/1402923

fixed bug
Source Link
JanDotNet
  • 8.6k
  • 2
  • 22
  • 48
for (var i = 0; i < list.Count; i++)
{
    var word = list[i];
    if (word.Length >= 5 && input[0] == word[0] && input[input.Length - 1] == word[word.Length - 1])
    {
        acceptableList.Add(counti);
    }
}
for (var i = 0; i < list.Count; i++)
{
    var word = list[i];
    if (word.Length >= 5 && input[0] == word[0] && input[input.Length - 1] == word[word.Length - 1])
    {
        acceptableList.Add(count);
    }
}
for (var i = 0; i < list.Count; i++)
{
    var word = list[i];
    if (word.Length >= 5 && input[0] == word[0] && input[input.Length - 1] == word[word.Length - 1])
    {
        acceptableList.Add(i);
    }
}
added 76 characters in body
Source Link
RobH
  • 17.1k
  • 6
  • 38
  • 73

Also you call input.IndexOf(c, charcheck);. I'm not 100% sure what the complexity of string.IndexOf is in C# but it's going to be related to the length of the string in some way - the naive implementation would be O(n*m) (m == 1 as you're searching 1 char at a time) worst case. Update: speculation confirmed by http://stackoverflow.com/a/2584204/1402923

Also you call input.IndexOf(c, charcheck);. I'm not 100% sure what the complexity of string.IndexOf is in C# but it's going to be related to the length of the string in some way - the naive implementation would be O(n*m) (m == 1 as you're searching 1 char at a time) worst case.

Also you call input.IndexOf(c, charcheck);. I'm not 100% sure what the complexity of string.IndexOf is in C# but it's going to be related to the length of the string in some way - the naive implementation would be O(n*m) (m == 1 as you're searching 1 char at a time) worst case. Update: speculation confirmed by http://stackoverflow.com/a/2584204/1402923

Source Link
RobH
  • 17.1k
  • 6
  • 38
  • 73
Loading