Posts

Showing posts from December, 2018

C: Sorting & Searching

Sorting Bubble sort - compare two values, swap if necessary - continue until sorted Selection sort - pick the lowest value, put it in the first slot - then the next lowest value, put it in the second slot - and so on - continue until sorted Insertion sort - compare values, take the lowest into a temp value - move the temp value to the front - continue until sorted Quick sort - pick a pivot - divide the other values into values less than the pivot and values greater than the pivot - repeat the process with the split groups - continue until sorted Merge sort - divide the value group into two until only two values remain in each subgroup - sort each subgroup - merge subgroups, sorting again - continue until sorted Searching Linear search - normal search, compare each value with the key until found Binary search - only for sorted arrays - search from the middle - if key is greater than middle value, go right - if key is lesser than middle value, go le...

C: File Processing

fopen() to open a file fopen("filename", "mode") modes: 'r' to read 'w' to write 'a' to append data 'r+' to read/write 'w+' to read/write 'a+' to read/append 'rb' to read (binary) 'wb' to write (binary) fclose() to close a file fcloseall() to close all files fgetc() to read one character from a file fputc() to write one character to a file fgets() to read a line from a file fputs() to write a line to a file fscanf() to read from a file with scanf() fprintf() to write to a file with printf() 2201757635 skyconnectiva.com binus.ac.id Juanda P. G.

Cloud Computing

Cloud computing is the practice of using servers hosted on the internet to store, manage, and process data, instead of using local servers. Advantages: - less expenses, pay only for what you use, instead of buying whole servers - less memory capacity problems - faster computing - no need of maintaining data centers Types: - IaaS - PaaS - SaaS 2201757635 skyconnectiva.com binus.ac.id Juanda P. G.

C: Function

Functions are groups of statements which work together to perform a task. A program is made of at least one function (int main). A function is declared as: return_type function_name(parameter) { } A function is called with: function_name() There are two types of function calls, by value and by reference. In the first case, variables are used. In the second case, pointers are used. 2201757635 skyconnectiva.com binus.ac.id Juanda P. G.