commit e6070ccf580804362ec7447955d3b1a23ad1a76b parent b88ffd59d45616d17a48a575e8ea7da039e523fb Author: Amit Dutta <mail@amit.is-a.dev> Date: Wed, 7 Oct 2026 23:06:43 +0530 Fix algorithm syntax and improve clarity Diffstat:
| M | semester_2/algorithms/algo_025.md | | | 20 | +++++++++----------- |
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/semester_2/algorithms/algo_025.md b/semester_2/algorithms/algo_025.md @@ -6,24 +6,23 @@ ## Algorithm ``` -procedure delete_lastNode(dl) +Procedure delete_lastNode(dl) begin - if(dl = NULL) - write("List is empty. deletion not possible"); + if (dl = NULL) then + write("List is empty, deletion not possible."); else ptr ← dl; - if(next(ptr) = NULL) - dl ← next(ptr); + if (next(ptr) = NULL) then + dl ← NULL; delete(ptr); else - while(next(ptr) ≠ NULL) + while (next(ptr) ≠ NULL) do ptr ← next(ptr); - end while - ptr ← prev(ptr); - next(ptr) ← NULL; + endwhile + next(prev(ptr)) ← NULL; delete(ptr); endif endif return(dl); end procedure -``` -\ No newline at end of file +```