algo_012.md (706B)
1 # algo_012 2 3 ### Problem Statement 4 5 > Write an algorithm which remores the first element of a list and adds it to the end of the list without changing any values in INFO part. 6 7 ## Algorithm 8 ``` 9 procedure ding(head) 10 begin 11 ptr ← head; 12 ptr2 ← head; 13 head ← next(head); 14 next(ptr) ← NULL; 15 while(next(ptr2) ≠ NULL) 16 ptr2 ← next(ptr2); 17 end while 18 next(ptr2) ← ptr; 19 return(head); 20 end procedure 21 22 ---------------------------- 23 24 procedure dong(head) 25 begin 26 ptr ← head; 27 while(next(ptr) ≠ NULL) 28 ptr ← next(ptr); 29 end while 30 next(ptr) ← head; 31 p ← next(head); 32 next(head) ← NULL; 33 head ← p; 34 return(head); 35 end procedure 36 ```