May 2019 | Programming Guide

binary search tree

A binary tree is an abstract data type(ADT) in computer science. conditions of BST: Every tree has only 1 root(head) each node has 2 children If the node is greater than other, then it will go to the right child. if the node is smaller than other, then it will go to the left child. Advantage: low complexity […]

Bubble sort

Bubblesort Principle Bubblesort is the easiest sorting algorithm to implement. Bubblesort algorithm runs from left to right. If the value is greater than the neighbour, the values will swap with each other. The disadvantage of this algorithm is high complexity( O(n²)). Example: sorting following array 6 8 3 6 2   Algorithm: Source Code: BubbleSort

Linked List

Programming C tutorial: List Prerequisite: Call by Value, Call by reference, pointers In this chapter, you will learn more complex programming skills. I assume you understand the basic concept of programming C. The basic reason for the list is storing specific information for instance: name, first name, number. Every list has a Head,and tail. How do we start? […]


Recursion Recursion is a function that always repeats a specific number of executions over time until abort criteria(s) of execution(s) has(have) reached. 1. Abort critera is a condition when you reached your objective. example: if(n== 1) { //Do nothing } 2.Recursive function: void Dosomething(int n){ if(n== 1) { //Do nothing } Dosomething(n-1); } Exercise: Recursive Decimal to Dual Converter […]

Simple Calculator (Android)

How to start: 1. Install Android Studio and create empty Activity 2. We will be using class EvaluateEngine from Rhino  3. Click on build.gradle(Module: app) and set the following parameters: implementation ‘io.apisense:rhino-android:1.0’ testImplementation ‘junit:junit:4.12’ 4.Change the MainActivity Class to the following class: package learn.hq.myapplication; import; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends […]

Finding derivative of a function

How do we find a derivative of a function? There are many different ways to solve the derivative. Let’s use Newton difference quotient and evaluate derivative of \[ f(x)= x^2 \] Formula: $f^\prime(x)$ = $\lim_{h = 0}$ = \(\frac{f(x_0+h)-f(x)}{h}\) (1.0) h:range[slope] between 2 points x0 and x+h are data points at f(x0) and f(x+h). The red line is […]

Variables and Datatypes

Datatype Table Datatype Size Range Int 4 Bytes -2147483648 … +2147483647 Boolean 1 bit true or false Byte 1 Byte(8 bit) -127…+127 short 2 bytes -32.768 – 32.767 long 8 Bytes -9,223..*10E18….+9,223*10E18 float 4 Bytes -+3.410E38 double 8 Bytes -+ 1.7e+038 char 2 Bytes 0 … 65,536 Example int number = 10; float num2 = 10f; // dont […]


Arrays An array is used to store more variables into 1 variable. It starts from int[] with square brackets +variable name and the definition of the datatype(in this case: new int[length] Example: int[] vector1D = new int[5]; // create 1D Array with the size of 5 int[][] vector2D = new int[5][5] // create 2D Array with the size […]

Constructor java

Constructor is a block of code of another class.The main purpose of it is to instantiate an object of the other class.In general it’s possible to programm any code in one class, but it’s not really efficient way of programming.If your block of code is very big you, you will lose overview of your project. Syntax: Default constructor […]