Sorting in Data Structure - Tech Geek Loves Music

Sorting in Data Structure

Basics and Time Complexities of all Sorting Algorithms

A sorting algorithm is an algorithm made up of a series of instructions that takes an array as input, performs specified operations on the array, sometimes called a list, and outputs a sorted array. 

Sorting algorithms are often taught early in computer science classes as they provide a straightforward way to introduce other key computer science topics like Big-O notation, divide-and-conquer methods, and data structures such as binary trees, and heaps. There are many factors to consider when choosing a sorting algorithm to use.

Following is a quick revision sheet that you may refer at last minute.

Calculating Time Complexity

Now lets tap onto the next big topic related to Time complexity, which is How to Calculate Time Complexity. It becomes very confusing some times, but we will try to explain it in the simplest way.
Now the most common metric for calculating time complexity is Big O notation. This removes all constant factors so that the running time can be estimated in relation to N, as N approaches infinity. 

Types of Notations for Time Complexity :

Now we will discuss and understand the various notations used for Time Complexity.
  1. Big Oh denotes "fewer than or the same as" <expression> iterations.
  2. Big Omega denotes "more than or the same as" <expression> iterations.
  3. Big Theta denotes "the same as" <expression> iterations.
  4. Little Oh denotes "fewer than" <expression> iterations.
  5. Little Omega denotes "more than" <expression> iterations.

Understanding Notations of Time Complexity :

O(expression) is the set of functions that grow slower than or at the same rate as expression.

Theta(expression) consist of all the functions that lie in both O(expression) and Omega(expression).
Omega(expression) is the set of functions that grow faster than or at the same rate as expression.

Sorting Efficiency

There are many techniques for sorting. Implementation of particular sorting technique depends upon situation. Sorting techniques mainly depends on two parameters. First parameter is the execution time of program, which means time taken for execution of program. Second is the space, which means space taken by the program.

Types of Sorting :

There are many types of Sorting techniques, differentiated by their efficiency and space requirements. Following are some sorting techniques which we will be covering in next sections.
  1. Bubble Sort
  2. Insertion Sort
  3. Selection Sort
  4. Quick Sort
  5. Merge Sort
  6. Heap Sort

Soon, I will upload the programs as well as its description to under Sorting concept in detail.

Please, Share your feedback and reviews about this blogs in the comment section below.

Thank You and Stay Active for more updates.

Bluestacks App Error | Physical Memory Error Solution

Bluestacks App Error | Physical Memory Error Solution | *What can you achieve by doing this?* 1. Solutions to Increase the Memor...

Powered by Blogger.