Compare an Array, Single Linked List and Circular Linked List. Which is better to use in general and why? Which one is better for implementing a Queue or Stack?
Compare an Array, Single Linked List and Circular Linked List. Which is better to use in general and why? Which one is better for implementing a Queue or Stack?
ARRAY
An array is an information structure that holds similar types of components. Commonly these components are the entirety of a similar information type, for example, a number or string. Array are normally utilized in program to coordinate information so the information can be store and find easily.
Syntax to store and display information:
array_name[0] = "xxx ";
array_name[1] = "yyy ";
array_name[2] = "zzz";
print array_name[0];
print array_name[1];
print array_name[2];
In the above given commands will print the three value of an array. BY using for loop or while loop can print the all value until the last value reached. its manage the memory efficiently and make the programmer job easy.
Single Linked List
A single linked list is a linear collection of a data . Its contain data in a sequence manner such that each element connect to its next element which called 'Node'.
The single element called node and every node contain two field one is data field and next node field. Data field hold the actual value and the next field hold the address of the next node
Circular Linked List
Circular linked list is a list where all the nodes connect to each other and create a circular form of list.It can be singly linked list and doubly linked list.It does not contain the null node.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps