Week 2 REPLY
1. Please comment to Sharon L on this comment she made in 137 words.
After some research, I discovered that a singly-linked list and a doubly-linked list is as follows;
A singly-linked list looks to the node directly after it.
A doubly-linked list looks at the nodes before it, as well as, the one after it.
Singly-linked list are also smaller than doubly-linked and may be easier to update and maintain. However, they are not as efficient.
A doubly-linked node takes longer to build and run but one of the main advantages is it can be iterated in reverse without recursion.
A situation in which a singly-list would be used is when you need to save memory. They are generally used in the implementation of stacks. It can be compared to a scavenger hunt, you have to solve each clue in the sequence to get to the final result.
When better performance is required and memory is not an issue a doubly-linked node can be used. A real world example would be navigation on an internet browser. It has the back and forward arrows. This is very similar to how a doubly-linked list works.
2. Please comment to Kim W on this comment she made in 137 words.
Before today, I have never heard of a singly-linked list nor a doubly-linked list – so I did some searching online and found a great article that describes both very well. Basically, a singly linked list is a set of nodes where each node has two fields ‘data’ and ‘link’. The data field will store the information and the link field will point to the next node. A doubly linked list contains an extra pointer (previous pointer). As a comparison, SLL requires less memory because it only has two field and it is also not as complex.
A situation where I would choose a SLL over a DLL would be a line at a grocery store. Lines require you to wait for your turn, but you also know for sure when the person in front of you is done, it’s your turn.
A time where I would pick DLL over SLL is when it comes to listening to a playlist. Most of the time, I just want to keep my music on shuffle.
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
