Saturday, 22 April 2017

Find increasing triplets such that sum is less than or equals to k

Code :
# include <stdio.h>
void find3Numbers(int A[], int arr_size, int sum)
{
    int l, r;
    for (int i = 0; i < arr_size-2; i++){
       for (int j = i+1; j < arr_size-1; j++){         
           for (int k = j+1; k < arr_size; k++){
               if (A[i] + A[j] + A[k] <= sum)
                 printf("Triplet is %d, %d, %d\n", A[i], A[j], A[k]);
            }
        }
     }
}
int main()
{
    int A[] = {1, 2, 3, 4, 6};
    int sum = 8;
    int arr_size = sizeof(A)/sizeof(A[0]);
    find3Numbers(A, arr_size, sum);
    return 0;
}

Output :
Triplet is 1, 2, 3
Triplet is 1, 2, 4
Triplet is 1, 3, 4

Execution :
arr_size = 5
Step:1   i=0 and i<3 (arr_size-2)
                                j=1 and j<4 (arr_size-1)
                                                k=2 and k<5 (arr_size)
                                                                A[0]+A[1]+A[2]<=sum --> 1+2+3 <=8 --> 6<=8 ( true )
                                                k=3 and k<5
                                                                A[0]+A[1]+A[3]<=sum --> 1+2+4 <=8 --> 7<=8 ( true )
                                                k=4 and k<5
                                                                A[0]+A[1]+A[4]<=sum --> 1+2+6 <=8 --> 9<=8 ( false )
                                j=2 and j<4
                                                k=3 and k<5
                                                                A[0]+A[2]+A[3]<=sum --> 1+3+4 <=8 --> 8<=8 ( true )
                                                k=4 and k<5
                                                                A[0]+A[2]+A[4]<=sum --> 1+3+6 <=8 --> 10<=8 ( false )
                                j=3 and j<4
                                                k=4 and k<5
                                                                A[0]+A[3]+A[4]<=sum --> 1+4+6 <=8 --> 11<=8 ( false )
                                j=4 and j<4 (false)
Step:2  i=1 and i<3
                                j=2 and j<4
                                                k=3 and k<5
                                                                A[1]+A[2]+A[3]<=sum --> 2+3+4 <=8 --> 9<=8 ( false )
                                                k=4 and k<5
                                                                A[1]+A[2]+A[4]<=sum --> 2+3+6 <=8 --> 11<=8 ( false )
                                j=3 and j<4
                                                k=4 and k<5
                                                                A[1]+A[3]+A[4]<=sum --> 2+4+6 <=8 --> 12<=8 ( false )
                                j=4 and j<4 (false)
Step:3 i=2 and i<3
                                j=3 and j<4
                                                k=4 and k<5
                                                                A[2]+A[3]+A[4]<=sum --> 3+4+6 <=8 --> 13<=8 ( false )
                                j=4 and j<4 (false)
Step:4 i=3 and i<3 (false)



Monday, 17 April 2017

Types of variables in java


1) Local Variable - A variable which is declared inside the method is called local variable.
2) Instance Variable - A variable which is declared inside the class but outside the method, is called instance variable . It is not declared as static.
3) Static variable - A variable that is declared as static is called static variable. It cannot be local.

Example:
class A{
int data=50;//instance variable
static int m=100;//static variable
void method(){
int n=90;//local variable
}
}//end of class

Sunday, 16 April 2017

Why java main method is public static void main(String []args)?

Pubilc - The main method must be public so it can be found by the JVM when the class is loaded.

Static - Since it is static it can be directly invoked via the class. Similarly, we use staticsometime for user defined methods so that we need not to make objects.

Void - void indicates that the main() method being declared does not return a value.

String []args - String is the class which can able to store collection of  characters and strings. []args refers the array of object which can store command line arguments when the program is executed with command line arguments.

For example,

java MyProgram one two

Then args contains: [ "one", "two" ]

public static void main(String [] args) {
    String one = args[0]; //=="one"
    String two = args[1]; //=="two"
}

Saturday, 18 March 2017

What is Data warehousing?

Data warehousing is a technology that aggregates structured data from one or more sources so that it can be compared and analyzed for greater business intelligence. 




What is Data Mining?

Data Mining is defined as the procedure of extracting information from huge sets of data.


List of ETL tools


  • Informatica PowerCenter 
  • Oracle Warehouse Builder (OWB)
  • SAP Data Services
  • IBM Infosphere Information Server
  • SAS Data Management
  • PowerCenter Informatica
  • Elixir Repertoire for Data ETL
  • Data Migrator (IBI)
  • SQL Server Integration Services (SSIS)
  • Talend Studio for Data Integration
  • Sagent Data Flow
  • Pervasive Data Integrator
  • Open Text Integration Center
  • Oracle Data Integrator (ODI)
  • Cognos Data Manager
  • CloverETL
  • Centerprise Data Integrator
  • IBM Infosphere Warehouse Edition
  • Pentaho Data Integration
  • Adeptia Integration Server
  • Syncsort DMX
  • QlikView Expressor
  • Relational Junction ETL Manager (Sesame Software)

What is ETL and its process?

ETL - Extract Transform Load

1) Extracting the data from various sources.

2) Transforming the data based on the requirements.

3) Loading the transformed data into destinations.


What is Data Integration ??

Integration of data from various sources into data warehouse.


Tuesday, 3 January 2017


Bluetooth Chat app



https://play.google.com/store/apps/details?id=appinventor.ai_msg2soulmate.Bluetoothchat