bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / algorithms / algo_025.md

algo_025.md (600B)


      1 # algo_025
      2 
      3 ### Problem Statement
      4 
      5 > Write an algorithm to delete the last node from a double linked list.
      6 
      7 ## Algorithm
      8 ```
      9 procedure delete_lastNode(dl)
     10 begin
     11     if(dl = NULL)
     12         write("List is empty. deletion not possible");
     13     else
     14         ptr ← dl;
     15         if(next(ptr) = NULL)
     16             dl ← next(ptr);
     17             delete(ptr);
     18         else
     19             while(next(ptr) ≠ NULL)
     20                 ptr ← next(ptr);
     21             end while
     22             ptr ← prev(ptr);
     23             next(ptr) ← NULL;
     24             delete(ptr);
     25         endif
     26     endif
     27     return(dl);
     28 end procedure
     29 ```
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror