Postingan

Menampilkan postingan dari 2018

Sorting and Searching (12 December 2018)

What is sorting? An action to speed up searching operation in a list Sorting can be done in 2 ways: Ascending Descending Sorting Algorithm can be divided into 2: Internal Sorting External Sorting There are 5 type of sorting: Bubble Sort Selection Sort Insertion Sort Quick Sort Merge Sort What is searching? A process to find and retrieve information based of a specific key value from some saved information. The key need to be unique because it's used to do record searching from a desired set of data list. Searching divided into 3: Linear Search Compares each element of the array with the search key. This method works well for a small or unsorted arrays, but not so efficient for large arrays. Binary Search This method works well for large arrays instead linear search. Interpolation Search A technique performed on the sorted data. This searching is similar with binary search.

File Processing (5 December 2018)

What is Stream? A sequence of character including Input, Output and even file. There are 3 standard streams activated when a C program running : Standard Input Stream : Keyboard Standard Output Stream : Monitor Standard Error Stream : Error Message What is File? File is a collection of record which is a collection of field of block of byte that is a collection of bit. Text file can be saved as a text format or ascii file Binary file storing numerical data in affixed format What is Buffer? A part of the memory used as a temporary storage before a data moved to a file that also can be called as stream pointer. How to use buffer : FILE *fp; fp is a file pointer pointing to the start of the buffer area. How to open a file? Inside <stdio.h> there is fopen() that can be used to open a file. Can write it as FILE *fopen (const char *filename, const char *mode); List of mode value: "r" :  open and read file "w"  :  cr...

Struct

Structure Definition A data type to store group of data with different data type. Component of struct called as member, field or element. Struct also called as Record. How to declare Struct struct name_of_the_struct{      dataType1 name_field1;      dataType2 name_field2; }; Variable of the struct also can be defined when being declared struct name_of_the_struct{      dataType1 name_field1;      dataType2 name_field2; }name_variable_structure; How to accessing the struct from the main program Example : struct data{     char name[10];     int age;     int class; }student[100]; int main(){     data student[100];    .....    .....    return 0; } How to use the struct on the main program Example : Example : struct data{     char name[10];     int age;    ...

Function and Recursion (28 November 2018)

Modular Programming Program can be divided into many modules using function which is formed by grouping some statements to do a particular job. This also called as Sub-Program. Using modules give advantages such as Can divide huge program into smaller modules Easier to debug Can modify it without affecting overall codes Easier to document Function divided into 2 types : Library function = Standard function provided by C compiler. Example : printf() in stdio.h, pow() in math.h User-defined function = Self defined functions created by the user. How functions looks like? return-value-type  function-name( parameter-list ){        statements; } return-value-type  : Data type of the value returned. If not filled it will use the default data type. If it's void it will not return any value. parameter-list : List of value sent from the user. Function usually written above the main program. Otherwise should use Function Prototype to...

Cloud Computing (28 November 2018)

What is Cloud? Cloud refers to a network/internet that present at places which accessible from any location over public or private network. Cloud Computing refers to managing, configuring, and accessing the applications by online, offering online data storage, network infrastructure and application that delivered as a network services. Cloud computing separate infrastructure with business, where "infrastructure" refer to hardware, networking, and software, that managed as 1 entity. Meanwhile "Business" refer to procedural workflow, strategic enforcement, etc. Cloud Computing Idea Separate IT infrastructure from main main system, managed separately by one party, accessible anywhere by internet and can be shared. Deploying Cloud means outsourcing "Infrastructure" management and risks to third party so company can focus more on "Business". Efficiency of infrastructure provisioning, utilization and management, related to adoption of new ...

Array and Pointers (17 October 2018)

> Pointer = A variable that used to store another variable address.                    Syntax -> <type> *(name of the pointer) Example: #include<stdio.h> int main(){ int angka; int *angka2; int **angka3; int ***angka4; *angka2 = angka; **angka3 = *angka2; ***angka4 = **angka3; angka = 8; printf("%d", ***angka4); return 0; } The program will print 8. Example 2: #include<stdio.h> int main(){ int angka; int *angka2; int **angka3; int ***angka4; *angka2 = angka; **angka3 = *angka2; ***angka4 = **angka3; angka = 8; **angka3 = 10; printf("%d", angka); return 0; } The program will print 10, same with printf("%d", *angka2); and ("%d",***angka4); > Array = Used to save several same type of data and the data can be accessed from anywhere or randomly by user.                 Syntax = ...

Program Control : Repetition (10 October 2018)

Definition of Repetition    => 1 or more instruction repeated for certain amount of time.    => Number of repetition can be predefined or defined later when running the program. Repetition or Looping operation consist of : 1. For 2. While 3. Do - While For = Syntax : for(exp1; exp2; exp3) statement;                          or                          for(exp1; exp2; exp3){                                 statement1;                                 statement2;                          }      exp1 : initialization      exp2 : conditional      exp3 : ...