Right now, you are iterating the loop for the entire length of the sentence. That will cost you more time if a sentence is a long one, like a paragraph. One other way to achieve the same is, if you run the loop on array of 26 alphabets, for eg. arr[26]. Run the loop on array and search the sentence to see if that alphabet is missing in the sentence. Reiterate 26 times and whenever you find such an alphabet, record that. In the end print the recorded alphabets. By doing this, you run the loop for only 26 times, no matter how long the sentence. I have a code that I can share, if you want.
Great.. ++ Thanks
ReplyDeleteGood. Better to rename the title as pangram checker
ReplyDeleteThanks Anto, Will update :)
DeleteRight now, you are iterating the loop for the entire length of the sentence. That will cost you more time if a sentence is a long one, like a paragraph.
ReplyDeleteOne other way to achieve the same is, if you run the loop on array of 26 alphabets, for eg. arr[26]. Run the loop on array and search the sentence to see if that alphabet is missing in the sentence. Reiterate 26 times and whenever you find such an alphabet, record that. In the end print the recorded alphabets.
By doing this, you run the loop for only 26 times, no matter how long the sentence.
I have a code that I can share, if you want.
Agree!
DeletePlease share your code here if you like :)