एक problem में कई अल्गोरिथ्म हो सकते हैं और एक अल्गोरिथ्म में एक language के साथ-साथ विभिन्न languages के कई program हो सकते हैं।एक अच्छा अल्गोरिथ्म:
  1. यह समय-कुशल होना चाहिए।
  2. यह कम जगह का उपयोग करता है।
  3. न्यूनतम संभव परिणामों (minimum possible result) में समस्याओं को हल करता है।
  4. समाधान तक पहुंचने के लिए न्यूनतम संसाधन (minimum resources) का उपयोग करता है।
  5. इसे आसानी से समझा जाना चाहिए ।
  6. न्यूनतम लागत पर बनाए रखा जा सकता है।
  7. यह लचीला होना चाहिए ।
  8. सभी प्रकार के अपवादों और त्रुटियों (exceptions & errors) का प्रबंधन करता है।
  9. आत्मनिर्भर है।
  10. एक जैसी समस्याओं के लिए इसे लागू किया जा सकता है।
  11. संतुलित होना चाहिए।
कोरमैन की किताब के मुताबिक, अल्गोरिथ्म एक तकनीक की तरह ही हैं। हम सभी नवीनतम और सबसे तेज़ processor का उपयोग करते हैं लेकिन हमें उस कंप्यूटर पर अच्छे अल्गोरिथ्म को चलाने की आवश्यकता है ताकि हम नवीनतम processor के लिए खर्च किए गए पैसे का ठीक से लाभ उठा सके।उदाहरण – एक fast computer A एक sorting अल्गोरिथ्म चला रहा है जिसका चलने का समय n2 की तरह बढ़ता है (इसका मतलब है कि time complexity C*n2 है) एक slow computer B एक sorting अल्गोरिथ्म चला रहा है जिसका चलने का समय n logn की तरह बढ़ता है (इसका मतलब है कि time complexity C*n logn है)। C एक constant है।उनमें से प्रत्येक computer को 10 लाख नंबरों के एक input को sort करना होगा। इनपुट n =10 लाख numbers = 106 numbers है ।
Computer AComputer B
1 second में 100 crore instruction हल करता है = 109/sec1 second में 1 crore instruction हल करता है  = 107/sec
Algorithm time complexity = n2 instructionsAlgorithm time complexity = 25*nlogn instructions
समय लगा  = n2/ (execute instructions in a sec) = (106)2/109समय लगा  = n log n / (execute instructions in a sec) = 25*(106 log106)/107
इसमें लगे 16.66 minutesइसमें लगे 15 seconds
धीमे कंप्यूटर दौड़ जीत सकते हैं । जैसे की कछुए ज़्यादातर खरगोश से जीतते हैं।

Test Yourself

Q1- Can an algorithm have two or more than two problems?

Q2- Can a program have two or more than two algorithms?

The answer is yes. Why? Because if you have a program in an old language and decide to make a program in a new and efficient language, you will need the program’s algorithm. If you don’t have the algorithm of the same program, then you can write one.

Q3- Can an algorithm have two or more than two programs?

Yes. Programs can be made in many languages if you have the algorithm’s logic and many programs can be made in the same language also.

Q4- According to Coreman’s book, algorithms are just like __________.

Technology

Q5- Can a fast algorithm makes the slow computer fast?

Yes

Q6- What a good algorithm means in time context?

A good algorithm must be time-efficient.

Q7- “A good algorithm should be balanced”. Explain?

There are two complexities in an algorithm in which we can find its efficiency. One is Time Complexity and Second is Space Complexity.
So, a good algorithm should be balanced between the two complexities. It may not be the case that the time complexity of the algorithm is very low, but it is taking so much space that there is no point in doing it, and vice-versa also.