# Merging Sorted Arrays:

## Time complexity :

Because we have to take two different arrays, those can vary in length so the time complexity will be: O(n +m)

## How it works:

This function is going to take to arrays sorted in the same way and compare both of them.
In order to compare them we’ll create two variables (i and j)to take care of the indexes of each array and also an array to store the results.
Then we’ll iterate over them using a while…

# Sorting Algorithms: Insertion Sort

## Time complexity:

Worst case: O(n²)

## How it works :

Insertion sort works a little bit different than Selection Sort and Bubble Sort.

# Sorting Algorithms : Selection Sort

## Time Complexity :

Worst Case : O(n²)
It could be slightly better than “Bubble Sort” in case that you want to minimize the swaps.

## How it works :

Contrary to Bubble Sort, this algorithm will start sorting the elements towards the beginning of the array instead of the end.

# Sorting Algorithms : Bubble Sort

## Time Complexity :

Worst Case: O (n²)
If we use our optimized version and the given array is sorted the best case would be O(n).

## How it works :

Bubble Sort it’s going to loop through the array and compare two adjacent elements, so it can swap them in case one is bigger than the other.
It will repeat this operation until the array is sorted.

# Naive String Searching Algorithm

## Time complexity:

Worst Case: O(m*n)

## How it works:

We’re going to create a function with a parameter for the givenString and a parameter for the pattern we’re looking for.

# Searching Algorithms: Binary Search

## Time complexity:

• Worst and Average Case: O(log n)
• Best Case: O(1)

# How Binary Search Works?

Binary search is going to compare the element we are looking for with the middle element of the collection. If there is a match, it will return the index of the middle item. If the middle item is shorter than the item we’re looking for, we forget about the sub-array from the middle to the right, and repeat the operation searching for the…

# Linear Search :

Linear search is probably the easiest searching algorithm out there. It’s going to check one by one all the elements of an array in a sequential order.

## Time complexity

As “n” grows, the average amount of time it takes will grow. If we have an array with a million elements it is going to search one by one until it finds the passed value. ## Edur

Computer Science and Software Engineering