Please enable JavaScript.
Coggle requires JavaScript to display documents.
Abstract Data Types and Data Structures, Lists, Comparison of List…
-
Lists
Types of implementation
-
Linked lists
-
Uses dynamic memory allocation, that is, it allocates memory for new list elements as needed
Is made up of a series of objects, called the nodes of the list
-
-
-
The most important concept related to lists is that of position. In other words, we perceive that there is a first element in the list, a second element, and so on
We define a list to be a finite, ordered sequence of data items known as elements
A list is said to be empty when it contains no elements. The number of elements currently stored is called the length of the list. The beginning of the list is called the head, the end of the list is called the tail
Class List defines the member functions that any list implementation inheriting from it must support, along with their parameters and return types
-
Element Implementation
The first issue is that the list users must decide whether they wish to store a copy of any given element on each list that contains it or store a pointer to that record
A second issue faced by implementors of a list class (or any other data structure that stores a collection of user-defined data elements) is whether the elements stored are all required to be of the same type
The third issue that users of the list implementations must face is primarily of concern when programming in languages that do not support automatic garbage collection
That is how to deal with the memory of the objects stored on the list when the list is deleted or the clear method is called