answersLogoWhite

0


Best Answer

Yes.

With a linked list, each node in the list points to the next node, except the tail which points to nothing. To maintain the list we must keep track of the head node at all times. In order that all insertions and extractions occur in constant time, all insertions and extractions must occur at the head. Thus when we insert a new node, it simply points to the head and then becomes the head. And to extract the head, the next node from the head becomes the head before we delete the old head. Since all insertions and extractions occur at the head, linked lists can be used to implement a stack (last in, first out). We can also traverse the list from the head and insert at any point in the list in order to maintain a sorted order, however this cannot be done in constant time and there are more efficient ways of maintaining order than by a linked list.

In order to implement a queue (first in, first out) using a linked list, we need to maintain a pointer to the tail as well as the head. Extractions still occur at the head, as before but insertions now occur at the tail, where the tail points to the new node which then becomes the tail. However, rather than maintaining a separate pointer for the head, we can simply point the tail at the head, thus creating a circular linked list. Since the tail always points at the head we have constant time access to both through a single pointer. Insertions are only slightly more complicated in that new nodes must first point at the head node (which they can copy from the tail node) before the tail node points to the new node which then becomes the tail.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Yes you can implement using tail pointer.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can a queue be represented by a circular linked list with only one pointer pointing to the tail of the queue?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Write an algorithm for the implementation of a circular doubly linked list?

Create a new node, making sure it is not allocated locally in the function and thus will not be destroyed when the function execution finishesFill in dataUse the "last node" pointer in the list and copy the "next" pointer location (pointing to the first node) into the new nodes "next" pointerSet the "last node" "next" pointer to point to the new nodeChange the list's "last node" pointer to point to the new nodeFor an example of implementation see: How_you_insert_a_newnode_in_singly_circular_link_list


Difference between circular and single linklist?

A regular linked list will have a pointer to the start of the list, with each node pointing to the next node, and finally the last node points to NULL. In a circular linked-link, the last node will point to the first node, making the list circular. This requires extra checks to ensure that you don't end up going into an infinite loop while traversing the list.


What are the basic types of link list in java?

linear circular double linked linear double linked circular Knowing the names does not help much when your teacher will require you to actually know what the names mean. Start reading. Programming requires lots of reading.


How the pointer used in the linked list?

The pointer in linked list is used for traversing through the elements of the linked list. In a singly linked list, only a next pointer exits. So this pointer can be used for traversing only in one direction in the list. In case of a doubly linked list, a next and previous pointer exits. These pointers are used for traversing in both direction in the list.


What are the applications for circular linked lists?

A singly-linked circular list is useful for implementing queue data structures with minimum overhead. Normally we implement a queue with two pointers: one to the tail for insertions and one to the head for extractions. With a circular list we only need to maintain a single pointer to the tail because the tail always points "forwards" to the head (instead of null as it normally would), thus achieving constant-time access to both the head and tail via a single pointer. Circular linked lists are generally useful wherever "wraparound" is necessary. That is, from any given node in the list, we can traverse forwards with the guarantee that we will eventually arrive back at that same node. With doubly-linked circular lists we have the advantage of traversing in either direction (bi-directional traversal).

Related questions

How do you check whether a linked list is circular?

A linked list is circular if the tail of the list points to the head. The easiest way to check this is to check whether the pointer of the tail is a null pointer. If it is, then the list is not circular.


Write an algorithm for the implementation of a circular doubly linked list?

Create a new node, making sure it is not allocated locally in the function and thus will not be destroyed when the function execution finishesFill in dataUse the "last node" pointer in the list and copy the "next" pointer location (pointing to the first node) into the new nodes "next" pointerSet the "last node" "next" pointer to point to the new nodeChange the list's "last node" pointer to point to the new nodeFor an example of implementation see: How_you_insert_a_newnode_in_singly_circular_link_list


Difference between circular and single linklist?

A regular linked list will have a pointer to the start of the list, with each node pointing to the next node, and finally the last node points to NULL. In a circular linked-link, the last node will point to the first node, making the list circular. This requires extra checks to ensure that you don't end up going into an infinite loop while traversing the list.


Is Far pointer necessary to create a circular linked list?

It has to be a pointer all right.Regarding 'far' and 'near': forget it, simply use 'Large' data modell (or 'Huge').


What are the basic types of link list in java?

linear circular double linked linear double linked circular Knowing the names does not help much when your teacher will require you to actually know what the names mean. Start reading. Programming requires lots of reading.


How the singly Linked List related with Circular Linked List?

With a singly linked list you will typically maintain a pointer to the head node and perform all insertions and extractions at the head because it is the only node you have constant time access to. If you need to insert at the tail node as well then you must maintain a separate pointer to the tail. You would typically do this to implement a queue (first in, first out), where all insertions occur at the tail and all extractions at the head. But with a circular linked list, the tail node points to the head node thus you no longer need to maintain a separate pointer to the head in order to implement a queue, you only need to maintain a pointer to the tail.


How the pointer used in the linked list?

The pointer in linked list is used for traversing through the elements of the linked list. In a singly linked list, only a next pointer exits. So this pointer can be used for traversing only in one direction in the list. In case of a doubly linked list, a next and previous pointer exits. These pointers are used for traversing in both direction in the list.


What are the applications for circular linked lists?

A singly-linked circular list is useful for implementing queue data structures with minimum overhead. Normally we implement a queue with two pointers: one to the tail for insertions and one to the head for extractions. With a circular list we only need to maintain a single pointer to the tail because the tail always points "forwards" to the head (instead of null as it normally would), thus achieving constant-time access to both the head and tail via a single pointer. Circular linked lists are generally useful wherever "wraparound" is necessary. That is, from any given node in the list, we can traverse forwards with the guarantee that we will eventually arrive back at that same node. With doubly-linked circular lists we have the advantage of traversing in either direction (bi-directional traversal).


Advantage and disadvantage of linked list?

Linked list is a dynamic data structure that contains a "link" to the structure containing the next item. It is a collection of structures ordered not by their physical placement in memory (like array) but by logical links that are stored as part of the data in the structure itself.Advantages of Linked Lists- Dynamic structure (Mem. Allocated at run-time).- We can have more than one datatype.- Re-arrange of linked list is easy (Insertion-Deletion).- It doesn't waste memory.Disadvantages of Linked Lists- In linked list, if we want to access any node it is difficult.- It is occupying more memory.


What is link list and type of link list?

A linked list is a set of elements, usually structures, where each element contains a pointer or index to the "next" element, along with the data represented by the element.Often, the elements are allocated from the heap. Sometimes, a fixed number of elements is contained in an array. In the first case, pointers are used. In the second case, indices are used.Types of linked lists are ... In an array implementation, read pointer as index.Singly linked - there is a head pointer, and one next pointer per element. The last element's pointer is null. This type of list can be traversed in only one direction.Doubly linked - there is a head pointer, and each element contains two pointers, one to the previous element and one to the next element. This type of list can be traversed in two directions, making insertion and deletion a bit easier, at the cost of extra memory.Circularly linked - the same as Singly or Doubly linked, except that the last element's pointer points back to the first element's pointer. These types of lists are often used as queues.


Difference between linear linked list and circular linked list?

LINEAR STRAIGHT CIRCULAR CURVED


What pointer type will you use to implement a heterogeneous linked list in c?

void pointer