- 2

Algorithms:. 1- Ptr=start; 2- If ptr->next == NULL, then: Print "Underflow" Exit; 3- Repeat Step 4 while ptr->next->

I have written this algorithm for deleting 2nd last element in link list is this right or not .

14th Jul 2020, 8:21 AM
Ali abbas
Ali abbas - avatar
4 odpowiedzi
+ 1
Why I can't see the 4th step that should be repeated as you wrote? Write the pseudo code in Description, more room for typing there. Use the question title to describe the question briefly e.g. "algorithm for linked-list element" Good luck! 👍
14th Jul 2020, 8:35 AM
Ipang
0
Algorithms:. 1- Ptr=start; 2- If ptr->next == NULL, then: Print "Underflow" Exit; 3- Repeat Step 4 while ptr->next->next!=NULL: 4:- sav= Ptr; Ptr=ptr->next; 5: Delete Ptr . 6:- Exit.
14th Jul 2020, 8:38 AM
Ali abbas
Ali abbas - avatar
0
Plz answer me is this correct or wrong and if this is wrong then what changes should be make
14th Jul 2020, 8:40 AM
Ali abbas
Ali abbas - avatar
0
Bro I see you posted new question where you write the pseudo code in Description. So in order to keep duplicates to the minimum you can delete this one, and monitor the new thread. Hope you got what you came for! 👍
14th Jul 2020, 8:49 AM
Ipang