description FOR DATA STRUCTURES code example

Example 1: purpose of data structure

In computer science, a data structure is a data organization, management,
and storage format that enables efficient access and modification. 
More precisely, a data structure is a collection of data values, 
the relationships among them, and the functions or operations that can be
applied to the data.

Example 2: data structures

Data Structures
in Java: Array, Collections Framework, Map.

1-ARRAY:
- It is fixed size.
- Ordered
-Allows Duplicates
-Can store Primitives and objects
-Can be multi-dimensional
-Build in data structure

2-COLLECTIONS: (LIST, SET, QUQUE)
List: Can store duplicate values,
      Keeps the insertion order. 
      It allows multiple null values, 
      Also we can read a certain value by index.
- ArrayList not syncronized, array based class 
- LinkedList not synchronized, doubly linked
- Vector is synchronized, thread safe

Set: Can only store unique values, 
     And does not maintain order
- HashSet can have null, order is not guaranteed
- LinkedHashSet can have null and keeps the order 
- TreeSet sorts the order and don't accept null 

Quque : Accepts duplicates, 
        Doesn't have index num,
        First in first our order.

3-MAP:
is a (key-value format) 
      and keys are always unique, 
      and value can be duplicated. 
- HashTable don't have null key, sychronized(thread-safe)
- LinkedHashMap can have null key, keeps order
- HasHMap can have null key, order is not guaranteed
- TreeMap doesn't have null key and keys are sorted

Tags:

Misc Example