Linear Data Structure

Array:

  • Store homogenous elements.
  • Store in contiguous locations.
  • Fixed size not dynamic.
  • Complexities
    • Accessing O(1)
    • Insertion and deletion O(n) worst case
    • Searching O(n) sequential | O(nlogn) is sorted

LinkedList

  • Every entry is an object store data and reference of next object.
  • Single LL
    • Every node store reference of next node and last node NULL.
  • Double LL
    • Every node have one reference of next node and another reference of previous node.
    • Can traverse in both direction.
    • Last node next is having reference as NULL.
  • Circular LL
    • Form Cycle when all node connected.
    • Last Node dont have reference NULL.
  • Complexities
    • Insertion And Deletion O(1)
    • Access O(n)
    • Searching O(n)

Stack

  • Last In First Out
  • Two Core Principal : Push() & Pop()
  • Complexity
    • Insertion And Deletion O(1)
    • Accessing O(n)

Queue

  • First In First Out
  • Two Core Principal: Enqueue and Dequeue
  • Complexity
    • Insertion And Deletion O(1)
    • Accessing O(n)
Advertisements

2 thoughts on “Linear Data Structure

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: