Insertion sort is an In Place sorting algroithm and is similar to how most people arrange a hand of poker cards.

func insertionSort<T: Comparable>(_ nums…

Selection sort is an In place sorting algorithm and follows the following three steps to sort an array

If we are given an array of N items and L = 0(lower bound), Selection Sort will:

Bubble sort is an In place sorting algorithm and follows the following four steps to sort an array

This pattern is used to count frequencies of values appearing in a string or array.

Let’s see how this pattern works.

Example 1

Create a function called same, which accepts two arrays. The function should return true if every value in the array has it's corresponding value squared in the…

Two pointers is an easy and effective technique used for searching pairs in collections such as arrays or even on string.

This technique is used for solving problems with minimal space complexity.

Common patterns in the two-pointer approach are:

Definition

A variadic parameter accepts zero or more values of a specified type. You use a variadic parameter to specify that the parameter can be passed a varying number of input values when the closure is called.

Variadic parameters can be used in closures only if we name the variadic parameters…

Sudarshan Sharma

I make simple iOS apps

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store