Data Structures Tutorial

Data Structures Tutorial Asymptotic Notation Structure and Union Array Data Structure Linked list Data Structure Type of Linked list Advantages and Disadvantages of linked list Queue Data Structure Implementation of Queue Stack Data Structure Implementation of Stack Sorting Insertion sort Quick sort Selection sort Heap sort Merge sort Bucket sort Count sort Radix sort Shell sort Tree Traversal of the binary tree Binary search tree Graph Spanning tree Linear Search Binary Search Hashing Collision Resolution Techniques

Misc Topic:

Priority Queue in Data Structure Deque in Data Structure Difference Between Linear And Non Linear Data Structures Queue Operations In Data Structure About Data Structures Data Structures Algorithms Types of Data Structures Big O Notations Introduction to Arrays Introduction to 1D-Arrays Operations on 1D-Arrays Introduction to 2D-Arrays Operations on 2D-Arrays Strings in Data Structures String Operations Application of 2D array Bubble Sort Insertion Sort Sorting Algorithms What is DFS Algorithm What Is Graph Data Structure What is the difference between Tree and Graph What is the difference between DFS and BFS Bucket Sort Dijkstra’s vs Bellman-Ford Algorithm Linear Queue Data Structure in C Stack Using Array Stack Using Linked List Recursion in Fibonacci Stack vs Array What is Skewed Binary Tree Primitive Data Structure in C Dynamic memory allocation of structure in C Application of Stack in Data Structures Binary Tree in Data Structures Heap Data Structure Recursion - Factorial and Fibonacci What is B tree what is B+ tree Huffman tree in Data Structures Insertion Sort vs Bubble Sort Adding one to the number represented an array of digits Bitwise Operators and their Important Tricks Blowfish algorithm Bubble Sort vs Selection Sort Hashing and its Applications Heap Sort vs Merge Sort Insertion Sort vs Selection Sort Merge Conflicts and ways to handle them Difference between Stack and Queue AVL tree in data structure c++ Bubble sort algorithm using Javascript Buffer overflow attack with examples Find out the area between two concentric circles Lowest common ancestor in a binary search tree Number of visible boxes putting one inside another Program to calculate the area of the circumcircle of an equilateral triangle Red-black Tree in Data Structures Strictly binary tree in Data Structures 2-3 Trees and Basic Operations on them Asynchronous advantage actor-critic (A3C) Algorithm Bubble Sort vs Heap Sort Digital Search Tree in Data Structures Minimum Spanning Tree Permutation Sort or Bogo Sort Quick Sort vs Merge Sort

Asymptotic Notation

Asymptotic notation is expressions that are used to represent the complexity of algorithms. The complexity of the algorithm is analyzed from two perspectives: 

  1. Time complexity
  2. Space complexity

Time complexity

The time complexity of an algorithm is the amount of time the algorithm takes to complete its process. Time complexity is calculated by calculating the number of steps performed by the algorithm to complete the execution.

Space complexity

The space complexity of an algorithm is the amount of memory used by the algorithm. Space complexity includes two spaces: Auxiliary space and Input space. The auxiliary space is the temporary space or extra space used during execution by the algorithm. The space complexity of an algorithm is expressed by Big O (O(n)) notation. Many algorithms have inputs that vary in memory size. In this case, the space complexity that is there depends on the size of the input.

Different types of asymptotic notations are used to describe the algorithm complexity.

  • O? Big Oh
  • ?? Big omega
  • ?? Big theta
  • o? Little Oh
  • ?? Little omega

O- Big Oh: Asymptotic Notation (Upper Bound)

"O- Big Oh" is the most commonly used notation. Big Oh describes the worst-case scenario. It represents the upper bound of the algorithm.

Function, f(n) = O (g(n)), if and only if positive constant C is present and thus:

                              0 <= f(n) <= C(g(n))              for all n >= n0

Therefore, function g(n) is an upper bound for function f(n) because it grows faster than function f(n).

The value of f(n) function always lies below the C(g(n)) function, as shown in the graph.

Asymptotic Notation

?-Big omega: Asymptotic Notation (Lower Bound)

The Big Omega (?) notation describes the best-case scenario. It represents the lower bound of the algorithm.

Function, f(n) = ? (g(n)), if and only if positive constant C is present and thus:

                              0 <= C(g(n)) <= f(n)               for all n >= n0

The value of f(n) function always lies above the C(g(n)) function, as shown in the graph.

Asymptotic Notation

?-Big theta: Asymptotic Notation (Tight Bound)

The Big Theta (?) notation describes both the upper bound and the lower bound of the algorithm. So, you can say that it defines precise asymptotic behavior. It represents the tight bound of the algorithm.

Function, f(n) = ? (g(n)), if and only if positive constant C1, C2 and n0 is present and thus:

                           0 <= C1(g(n)) <= f(n) <= C2(g(n))                 for all n >= n0

Asymptotic Notation

o-Little Oh: Asymptotic Notation

The Little Oh (o) notation is used to represent an upper-bound that is not asymptotically-tight.

Function, f(n) = o (g(n)), if and only if positive constant C is present and thus:

                           0 <= f(n) < C(g(n))              for all n >=n0

The relation, f(n) = o(g(n)) implies that limn-? [ f(n) / g(n)] = 0.

??Little omega: Asymptotic Notation

The Little omega (?) notation is used to represent a lower-bound that is not asymptotically-tight. Function, f(n) = ?(g(n)), if and only if positive constant C is present and thus:

                           0 <= C(g(n)) < f(n)                for all n >=n0

The relation, f(n) = ?(g(n)) implies that limn-? [ f(n) / g(n)] = ?.



ADVERTISEMENT
ADVERTISEMENT