Monthly Archives: August 2013
Raspberry Pi unboxing and an example to flash LED
Raspberry Pi Model B Revision 2.0
Broadcom BCM2835 700MHz ARM1176JZFS processor with FPU and Videocore 4 GPU
512MB RAM
Additional specs: 10/100 BaseT Ethernet, HDMI, (2) USB 2.0, RCA video, SD card socket, Powered from microUSB socket, 3.5 mm audio out jack, boots from SD card
Sorting – Quick Sort
Time complexity:
Worst-case: \(O(n^2)\)
Best-case: \(O(nlog(n))\)
Average-case: \(O(nlog(n))\)
Pick a random element (pivot) and partition the array.
[all numbers that are less than the pivot] pivot [all numbers that are greater than the pivot]
Sorting – Merge Sort
Time complexity:
Worst-case: \(O(nlog(n))\)
Best-case: \(O(nlog(n))\)
Average-case: \(O(nlog(n))\)
Merge sort divides the array in half, sorts each of those halves, and them merges them back together.
Sorting – Selection Sort
Time complexity:
Worst-case: \(O(n^2)\)
Best-case: \(O(n^2)\)
Average-case: \(O(n^2)\)
Find the smallest element and move it to the front. Then, find the second smallest and move it.
Sorting – Bubble Sort
Time complexity:
Worst-case: \(O(n^2)\)
Best-case: \(O(n)\)
Average-case: \(O(n^2)\)
Sort array elements in ascending order. If the first element is greater than the second element, swap the first two elements.
Then, we go to the “next pair” and so on.