Array

An array is a piece of data continously spreaded which commonly used to save data with preallocated space or known size.

A dynamic array, also called vector, slice, handled the expansion of the array with pre-defined threshold.

Sort

Bubble Sort

The basic idea of bubble sort is:

  1. Start from the first two element, compare and swap them until all elements are compared.
  2. Repeat 1 but each time the start position adds one.

Quick Sort

The basic idea of quick sort is:

  1. Select the first or the last element of to-be-sorted array as a pivot.
  2. Compare and swap the rest elements until the elements reside on the left of the pivot are less than the pivot and the elements reside on the right of the pivot are greater than the pivot.
  3. sort the left and right subarray reside on both side of the pivot.

Reverse

Double Pointer

results matching ""

    No results matching ""