I'm trying to figure out what is a straightforward algorithm.

The following pseudocode comes from section 4.2 of "Introduction to Algorithms, 3rd Edition By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest and Clifford Stein"

enter image description here

Is it a straightforward algorithm?

Does a straightforward algorithm refer to the algorithm which intuitively solves a specific problem?


1 Answer 1


Yes, that is a straightforward algorithm.

There is no special mathematical or computational meaning that is attached to the word "straightforward" here. It just means what it means in plain English, as by Google search by me today,

uncomplicated and easy to do or understand.

To be slightly pedantic, I would avoid saying "a straightforward algorithm refers to the algorithm which intuitively solves a specific problem". Usually, we use intuition when we rely on some instinct, heuristics or experience . The algorithm here, which computes the square of a matrix, is implemented strictly according to the definition of matrix multiplication. This implementation is completely mechanical, assuming the ability to transform a specification of a procedure into program.

"Straightforward" is, indeed, the most appropriate word to describe the algorithm.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.