Professional Documents
Culture Documents
Data Structures.
Data Structures.
A data structure is a data organization, management, and storage format that enables efficient
access and modification
Data Type
Data type is a way to classify various types of data such as integer, string, etc. which determines
the values that can be used with the corresponding type of data, the type of operations that can
be performed on the corresponding type of data. There are two data types −
Those data types for which a language has built-in support are known as Built-in Data types. For
example, most of the languages provide the following built-in data types.
Integers
Those data types which are implementation independent as they can be implemented in one or
the other way are known as derived data types. These data types are normally built by the
combination of primary or built-in data types and associated operations on them. For example −
List
Array
Stack
Queue
Lists -A list is a collection of items (called nodes) orderer in linear sequence. It is a tool that can
be used to store multiple pieces of information at once. It can also be defined as a variable
containing multiple other variables.
It is therefore an abstract data type that contains a countable number of ordered values where
the same value may occur more than once.The name list is also used for several concrete data
structures that can be used to implement abstract lists, especially linked lists
Arrays
An array is an ordered collection of items,where each item inside the array has an index
list: user has to keep in track of next location where memory is allocated
(STL)
Push front(g) – Adds a new element ‘g’ at the beginning of the list
the list
remove() – Removes all the elements from the list, which are
A linked list (also just called list) is a linear collection of data elements of any type, called nodes,
where each node has itself a value, and points to the next node in the linked list. (A linked list is a
linear data structure, in which the elements are not stored at contiguous memory locations. The
elements in a linked list are linked using pointers)
The principal advantage of a linked list over an array, is that values can always be efficiently
inserted and removed without relocating the rest of the list. Certain other operations, such as
random access to a certain element, are however slower on lists than on arrays
Each element (node) of a list is comprising of two items - the data and a reference to the next
node.
The entry point into a linked list is called the head of the list.
It should be noted that head is not a separate node, but the reference to the first node.
A linked list is a dynamic data structure. The number of nodes in a list is not fixed and can grow
and shrink on demand. Any application which has to deal with an unknown number of objects
will need to use a linked list.
One disadvantage of a linked list against an array is that it does not allow direct access to the
individual elements. If you want to access a particular item then you have to start at the head
and follow the references until you get to that item.
Another disadvantage is that a linked list uses more memory as compared with an array – we
need extra 4 bytes (on 32-bit CPU) to store a reference to the next node.
A doubly linked list is a list that has two references, one to the next node and another to
previous node.
Another important type of a linked list is called a circular linked list where the last node of the
list points back to the first node (or the head) of the list.
A circular doubly linked list has the same arrangement as the doubly linked list but in a circular
format.
ref https://www.geeksforgeeks.org/data-structures/linked-list/
https://www.tutorialspoint.com/data_structures_algorithms/linked_list_algorithms
https://en.wikipedia.org/wiki/Linked_data_structure