echadisraeli

Q: Pseudocode isn't indented properly, is there an option to fix it?

I recently bought Introduction to Algorithms, which is very convenint to have on my phone and laptop.

However, any pseudocode that's interperted in text, as oppose to figure are not indented properly, so it looks like every line starts from the beginning.
This is really troubling because in a case where there are control flow sections, it's hard to tell what's going on like the following hypothetical pseudocode.

1. for a to b

2.     if C[a] < C[b]

3.           sum = sum + C[a]

4.            var = C[b]


would look like

 

1. for a to b

2. if C[a] < C[b]

3. sum = sum + C[a]

4. var = C[b]


and can be interpreted as the following by accident, when in fact it's not.


1. for a to b

2.     if C[a] < C[b]

3.           sum = sum + C[a]

4. var = C[b]

Posted on May 29, 2015 6:01 AM

Close

Q: Pseudocode isn't indented properly, is there an option to fix it?

  • All replies
  • Helpful answers