Important Notice:

Pseudocode & Examples

Pseudocode & Examples

25 views 1 min read

Pseudocode

Pseudocode is an informal description of an algorithm using English-like statements.

Example: Sum of N numbersBEGIN\n READ N\n SET SUM = 0\n FOR I = 1 TO N\n SUM = SUM + I\n END FOR\n PRINT SUM\nENDExample: Check Even/OddBEGIN\n READ NUM\n IF NUM % 2 == 0 THEN\n PRINT "Even"\n ELSE\n PRINT "Odd"\n END IF\nENDComplexity

  • Time Complexity — how long the algorithm takes
  • Space Complexity — how much memory it uses

Related Notes