0

I want to calculate the complexity of an algorithm for which i need to mention each line of algorithm cost and frequency as a separate cell for each row of algorithm. I intend to write it in the fashion as shown at the end. I am using the algorithmic package, using it inside the tabular is giving many errors. I hope there is some way to do it.

___________________________
|1| x=0         | c | 1   |
|2| y=0         | c | 1   |
|3| for z=0 to n| c | n+1 |
---------------------------

not the duplicate of the question marked, as it says to write the algo in a column while i want each row to carry an each line of algorithm, that's why I have also added the same question in my comments for ease of understanding.

  • Please provide a minimal working example (MWE) of what you've tried so far. – CarLaTeX Sep 26 '17 at 5:16
  • what ever i tried give me error, i tried to encapsulate the algorithm with in the tabular and tried to use the algorithm each line as an element of a cell, but since it has its own tags and different line numbers so its not getting along. – Shahensha Khan Sep 26 '17 at 5:18
  • i want something like this which is also not answered :( tex.stackexchange.com/questions/312992/… – Shahensha Khan Sep 26 '17 at 5:19
  • It doesn't matter if your MWE doesn't work, just add it please! – CarLaTeX Sep 26 '17 at 5:19
  • Are you bound by algorithm2e or could you use another package, such as listings? – CarLaTeX Sep 26 '17 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.