hi every 1
i wanna to ask about sigl and double linked list
*what is the advanyages and desadvantegs of the double linke list
*when we use the double and when we use the single
thanks
hi every 1
i wanna to ask about sigl and double linked list
*what is the advanyages and desadvantegs of the double linke list
*when we use the double and when we use the single
thanks
>*what is the advanyages and desadvantegs of the double linke list
Is this homework? A double linked list allows you to move foward and backward, thus simplifying and optimizing some operations. However, the maintenance of the extra pointer complicates the algorithms.
>*when we use the double and when we use the single
It's largely a matter of taste. I know people who only use double linked lists even when they're overkill. In general, if you use the operations that a double linked list will make easier or faster, you should at least consider using one. Otherwise, why bother? If I write a simple linked stack, I'm not going to waste my time with the extra pointer because it's not necessary. But if I'm writing a simple linked deque, double linking makes sense.
thanks narue you mean that in stack we prefer to use the single
but in the qeue we use the double
A singly linked list can be used to create a stack, but so could a doubly linked. It depends what you are most comfortable with.
A queue and a deque are different containers. A queue removes the first item pushed on the queue, whereas a deque can remove either the first or the last item pushed onto the deque. Again a singly linked list or a doubly linked list could be used with either container. It depends on how comfortable you are using one or the other. I can't think of any manipulation of data you can do with a singly linked list you can't do with a doubly linked or visa versa. It's ease of the manipulation and ease of implementation that counts. If you are familiar with doubly linked lists, then some process are easier to implement using that container than singly linked, but the syntax of working with doubly linked lists is a little trickier to work with than singly, so if you are familiar and comfortable with singly linked use it. However, you will want to become familiar with doubly linked because it can make your life easier under some circumstances.
thanks
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.