DEV Community

Cover image for Learning Data Structures? Master in 6 simple steps.
g
g

Posted on

Learning Data Structures? Master in 6 simple steps.

Learning a new Data Structure?

⬘ First, check its behavior for the below attributes
➊ Linearity
➋ Memory Allocation
➌ Connectivity
➍ Ordering
➎ Uniqueness

⬙ Then, implement
➏ Common Operations

➊ Linearity

  ❍  Linear
  ❍  Non-linear
Enter fullscreen mode Exit fullscreen mode

✧ It says about the traversal path.

➋ Memory Allocation

  ❍  Contiguous
  ❍  Non-contiguous
Enter fullscreen mode Exit fullscreen mode

✧ It says about how elements are stored in physical memory.

➌ Connectivity

  ❍  One-Directional
  ❍  Bi-Directional
Enter fullscreen mode Exit fullscreen mode

✧ It says about how 2 elements are connected to each other.

➍ Ordering

  ❍  Ordered
  ❍  Unordered
Enter fullscreen mode Exit fullscreen mode

✧ It says if the fetching of elements is always predictive or randomized.

➎ Uniqueness

  ❍  Only Unique Elements
  ❍  Duplicates are allowed
Enter fullscreen mode Exit fullscreen mode

✧ It says if insertion of an element is restricted when a similar element already exists.

➏ Common Operations

  ❍  Traversal
  ❍  Insertion
  ❍  Deletion
  ❍  Get
Enter fullscreen mode Exit fullscreen mode

✧ These are the common operations performed on all data structures.

Example ➊ : Array

➤  Linear
➤  Contiguous
➤  One-Directional
➤  Ordered
➤  Duplicates are allowed
Enter fullscreen mode Exit fullscreen mode

Example ➋ : Set

In case of Array based implementation,

➤  Linear
➤  Contiguous
➤  One-Directional
➤  Ordered
➤  Only Unique Elements
Enter fullscreen mode Exit fullscreen mode

Example ➌ : Hash Table

➤  Linear
➤  Non-Contiguous
➤  One-Directional
➤  Unordered
➤  Only Unique Keys
Enter fullscreen mode Exit fullscreen mode

Example ➍ : Doubly Linked List

➤  Linear
➤  Non-Contiguous
➤  Bi-Directional
➤  Ordered
➤  Duplicates are allowed
Enter fullscreen mode Exit fullscreen mode

Example ➎ : Tree

➤  Non-Linear
➤  Non-Contiguous
➤  Mostly One-Directional
➤  Ordered
➤  Duplicates are allowed
Enter fullscreen mode Exit fullscreen mode

Top comments (0)