Linked list, queue, and stack examples
The following example demonstrates the OOP usage of a linear linked list that can contain any generic type T. The idea behind this example is to show inheritance usage as a model for the relation that "B is a kind of A".
A linear list is a structure of linearly arranged elements in which we know that the first element links to the second, the second element links to the third, and so on. Basic operations with a linked list are insert element (
PUT) and obtain element (
GET). A queue is a linear list where the elements are arranged in order so that what enters a queue first gets out first, in other words, FIFO—First In First Out. Therefore, when you get an element, it is obtained from the top of the list, and ...