I spent most of my weekend working on the doubly link list in objective-c. To be honest this project got me going as far as link lists are concern. I did the delete node function, i got done with that then, i started working on the sorting aspect of the list which i finished yesterday. At first I started imagining how i wanted to code this in my head and then tried to code it, and it did not work so well. So i decided to go back to the basics, by basics i mean drawing the link list on the paper and try to simulate the deletion of a node. I came up with 4 scenarios that could happen when trying to delete a node from a list. Then i followed the same procedures i drew on the paper and lord and behold there it was, and i know every programmer knows the feeling when you get stuff to work.
The four scenarios i check for of what could happen when deleting a node are:
1: if we found the node and it is in the middle of two nodes.
2: if we found the node and it is at the beginning of the list.
3: if we found the node and it is at the end of the list.
4: if we found the node and it is the only node in the list.
I don't know maybe there are more scenarios but these are the only ones i could possibly think of when i was doing my drawing simulation of a doubly link list. Overall this project taught me a lot of things on the aspect of a Link List and when you get stuck is is always good o go back to basics.
Till next time, so long stay tuned and thirst my friends.