Static Queue: A queue is an ordered list of elements. It always works in first in first out(FIFO) fashion. All the elements get inserted at the REAR and removed from the FRONT of the queue. In implementation of the static Queue, an array will be used so all operation of queue are index based which makes it faster for all operations except deletion because deletion requires shifting of all the remaining elements to the front by one position.
A Static Queue is a queue of fixed size implemented using array.
Singly Linked List: A linked list is also an ordered list of elements. You can add an element anywhere in the list, change an element anywhere in the list, or remove an element from any position in the list. Each node in the list stores the content and a pointer or reference to the next node in the list. To store a single linked list, only the reference or pointer to the first node in that list must be stored. The last node in a single linked list points to nothing (or null).
Here are some of the major differences between a Static Queue and a Singly Linked List
|Static Queue||Singly Linked List|
|Queue is a collection of one or more elements arranged in memory in a contiguous fashion.||A linked list is a collection of one or more elements arranged in memory in a dis-contiguous fashion.|
|Static Queue is always fixed size.||List size is never fixed.|
|In Queue, only one and single type of information is stored because static Queue implementation is through Array.||List also stored the address for the next node along with it’s content.|
|Static Queue is index based.||Singly linked list is reference based.|
|Insertion can always be performed on a single end called REAR and deletion on the other end called FRONT.||Insertion as well as deletion can performed any where within the list.|
|Queue is always based on FIFO.||List may be based on FIFI or LIFO etc.|
|Queue have two pointer FRONT and REAR.||While List has only one pointer basically called HEAD.|
Below is the implementation of a Static Queue:
Queue is Empty 20 <-- 30 <-- 40 <-- 50 <-- Queue is full 20 <-- 30 <-- 40 <-- 50 <-- after two node deletion 40 <-- 50 <-- Front Element is: 40
Below is the implementation of a Singly Linked List:
1->2->3-> after inserting node at the end 1->2->3->1-> after deleting node: second, first and last 3->
- Difference between Singly linked list and Doubly linked list
- Convert singly linked list into circular linked list
- Convert Singly Linked List to XOR Linked List
- QuickSort on Singly Linked List
- Sum of the nodes of a Singly Linked List
- Alternate Odd and Even Nodes in a Singly Linked List
- Implement a stack using singly linked list
- Binary Search on Singly Linked List
- Alternating split of a given Singly Linked List | Set 1
- Insertion Sort for Singly Linked List
- Circular Singly Linked List | Insertion
- Product of the nodes of a Singly Linked List
- Delete all Prime Nodes from a Singly Linked List
- C Program to reverse each node value in Singly Linked List
- Count of Prime Nodes of a Singly Linked List
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.