What are the differences between an algorithm and a protocol ? Are they same ?
I know all the protocols are based on algorithm. though i am not sure, but i can see commercially used algorithms are called protocols.
- 1 decade agoFavorite Answer
Algorithms are mathematical equations designed to solve a certain computer problem. Protocols are designed using algorithms. Think of it like a cake; algorithms are the ingredients and protocols are the result.
Protocols are used to specify how a certain component should act. There are networking protocols, for example, to determine how devices should communicate with one another... this is useful so that you can buy a network cable from any manufacturer and it will work with any network card you have because of the protocols each company adheres to.
- 1 decade ago
Algorithm are defined steps to perform certain tasks. The steps are more not exact programming steps but they give broad outline of the process to be carried out. As they do not have direct programming language interpretation, the depth or details of the solution are also flexible. An example of algorithm may be how to boil an egg:
2 Take a container
2 Pour some water in it, enough to boil the egg
3 Put container on hot stove
4 Bring water to boil
5 Put egg into the boiling water
6 Wait for 5-10 minutes
7 Take egg out of water
The algorithm and flowcharts can be translated to each other.
A protocol on the other hand is definition of how communication between two nodes (devices/computers) will take place. It is usually defined in form of:
- Handshaking: How the two nodes will initially establish the connection and will reach a state when they can start talking to each other
- Communication: This is to define what requests and responses can be used by the nodes while talking to each other
- Exception handling: How will the nodes deal when the communication encounters an exception, either of known or unknown type.
An example for protocol would be the electronic mailing protocol for sending a mail (SMTP).
In this case one of the node will act like server and the other would be acting like client. The client initiates the handshaking by connecting to port 25 of the server. Then there are certain requests which are defined in SMTP protocol which client can send to server and server will respond in defined manner for each request.
Regards.Source(s): For more information on SMTP, check http://en.wikipedia.org/wiki/Simple_Mail_Transfer_...