Data Structure

Yolanda Johansson
1 min readJun 22, 2021

Data structure includes two types: linear and nonlinear. Linear data structure has a linear relationship between each two consistent elements, while nonlinear data structure has hierarchical relationship.

Linear data structure has Array, Queue, Stack, Linked List, nonlinear data has Tree, Graph, Map, Set.

  • An Array is a collection of data items having similar data types.
  • A Linked list is a collection of nodes, where each node has a data element and a reference to the next node in the sequence.
  • A Stack is a FILO (First In Last Out) data structure where the element that is added first will be deleted last.
  • A Queue is a FIFO (First in First Out) data structure where the element that added is first will be deleted first.
  • A Tree is a collection of nodes where these nodes are arranged hierarchically and form a parent-child relationship.
  • A Graph is a collection of a finite number of vertices and edges. Edges connect the vertices and represent the relationship between the vertices that connect these vertices.
  • A Map stores key-value (k,v) pairs, there cannot be duplicate keys. Maps are useful in situations where a key can be viewed as a unique identifier for the object. Map is called Hash table also.
  • A Set is like a map except it only stores keys, without values. Or it can be seen as that it can store unique values, without any particular order.

--

--