Posts

Showing posts from December, 2018

Sorting & Searching

Sorting Sorting is the process of placing elements from a collection in some kind of order. Types: Ascending Descending Algorithms: Internal Sorting, where the data is loaded into the RAM External Sorting, where the data is stored in a secondary storage Bubble Sort The bubble sort makes multiple passes through a list. It compares adjacent items and exchanges those that are out of order. Each pass through the list places the next largest value in its proper place. In essence, each item “bubbles” up to the location where it belongs. Selection Sort The selection sort improves on the bubble sort by making only one exchange for every pass through the list. In order to do this, a selection sort looks for the largest value as it makes a pass and, after completing the pass, places it in the proper location. As with a bubble sort, after the first pass, the largest item is in the correct place. After the second pass, the next largest is in place. Insertion Sort Whi...

File Processing

Stream A sequence of character that are stored as data. There are 3 types of streams: Input Stream Output Stream Error Stream File A collection of records There are 2 types of file: Text File Binary File Buffer Area Part of the memory used as a temporary space before the data is moved to a file. Syntax : FILE *fp; Open File To open a File, use fopen() : FILE *fopen (const char *filename, const char *mode ); fopen() : return a pointer to the start of a buffer area. Null will be returned if file is unable to open. Possible mode Value : “ r ”     = opening a file to be read. " w ”     =   creating a file to be written. “ a ”      =  opening a File for data append. “ r+ ”    =  opening a File for read/write. “ w+ ”   =   creating file for read/write. “ a+ ”    =   opening a File for read/append “ rb ”     =  o pening a ...

Structure, Unions & Memory Allocation

Structure  A data type to store groups of data of various of data types. As such, they are heterogeneous. Structure components consist of: Member Field Element There is a type of structure called a nested structure because one of it's element is another structure. (note that this should be declared first) syntax: struct struct_name variable(value_m) Union A memory location that can be assigned for two or more variable with different  data types.  Enumeration A data type with a predefined number of data. Memory Allocation The act of acquiring memory space in an OS to be used by a program. There are 2 types: Static Can be assigned with name -> variable. Allocated at compile time. Stored at local stack memory. Remain unchanged during the program run. De-Allocated when the program ends. Dynamic Can be assigned with name Allocated at run-time Stored at heap memory Can be De-Allocated at any time

Function and Recursion

A function is a grouping of statements that are created to do a particular job. Modules are required when a group of statements are frequently used by other distinct code. These are called Sub-Program. Together, they referred to as Modular Programming. Advantages: An easily comprehensible top-down design Can be done by more than one developers Easy to debug Modifications can be done without affecting the overall code Easier to document Functions are divided into two types: Library function, a standard function provided by the code compiler User-defined function, a self defined function In addition to Function, there are also Identifiers. There are two types: Local Identifier, which are declared in the function and are limited to the functions Global Identifier, which are declared outside the function, can be re-declared in the function, and can be reached from anywhere in the program Do note, however, that it is advisable not to use Global Variable for a number o...

Cloud Computing

Cloud Computing A shared pool of configurable computer system resources and higher-level services that can be rapidly provisioned with minimal management effort, often over the Internet. Cloud computing relies on sharing of resources to achieve coherence and economies of scale, similar to a public utility. Characteristics The National Institute of Standards and Technology's definition of cloud computing identifies five essential characteristics: On-demand self-service.  Broad network access.  Resource pooling.  Rapid elasticity.  Measured service.  Service Models Infrastructure as a Service (IaaS).  Platform as a Service (PaaS). Software as a Service (SaaS).  Deployment Models Private Cloud Public Cloud Hybrid Cloud Advantages of Cloud Computing Cost Savings Reliability Manageability Strategic Edge Disadvantages of Cloud Computing Downtime Security Issues Vendor Lock-In Limited Control Deployments ...