Write an Algorithm in Programming Language

This article will help how to write an algorithm for any programming language. Nowadays, programming languages play a vital role in the real world and use to develop real world applications. To design a code, one must design an algorithm first.

Steps

  1. Keep in mind that algorithm is a step-by-step process.
  2. Depending upon programming language, include syntax where necessary.
  3. Begin.
  4. Include variables and their usage.
  5. If they are any loops, try to give sub number lists.
  6. Try to give go back to step number if loop or condition fails.
  7. Use jump statement to jump from one statement to another.
  8. Try to avoid unwanted raw data in algorithm.
  9. Define expressions.
  10. Use break and stop to terminate the process.

Logging in

  1. Get user input.
  2. Check if the entered username and password match the pre-stored credentials in the database.
  3. If true, set session and redirect your user to the success page.
  4. If false, print a failure message, redirect on the same login page and ask user to re-enter the credentials.
  5. Exit.

Tips

  • Remove unwanted comments.
  • Use proper logic
  • Use fast calculating iterations
  • Have a clear plan before creating the algorithm
  • Make it small
  • Make it efficient

Warnings

  • Remember to check time and space complexity
  • Don't forget to terminate or else the code will fail