Friday, June 28, 2013

3-SUM problem implementation in Java

.
/*
 * 3-SUM problem
 * Are there 3 numbers a, b, c among N numbers whose sum is ZERO?
 * */


public class test{

public static void main(String[] args) {
int[] al = {1, 5, 7, 0, -1, -5, -8, 2, 4};
if(is3sum(al))
System.out.println("Above three numbers in the array have sum ZERO!");
else
System.out.println("There are no three numbers whose sum is ZERO");
}
static boolean is3sum(int[] al){
int j, k = 0;
int iterations = 0;
for (int i = 0; i <= al.length - 2; i++) {
j = i + 1;
k = al.length - 1;
while(k > j){
iterations++;
if(al[i] + al[j] + al[k] == 0){
System.out.println("Iterations: " + iterations);
System.out.print("Numbers: ");
System.out.println(al[i] + ", " + al[j] + ", " + al[k]);
return true;
}else if (al[i] + al[j] + al[k] > 0){
k = k - 1;
}else {
j = j + 1;
}
}
}
return false;
}

}

Sunday, March 17, 2013

Algorithm: Triangle in Java

Problem: Create a triangle like below in Java:
   *
 ***
*****

Solution: Java Program:

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class triangle {


    public static void main(String[] args) {
        try {
            BufferedReader object = new BufferedReader
                    (new InputStreamReader(System.in));
            System.out.println("enter the number");
            int a= Integer.parseInt(object.readLine());
            for (int i = 1; i <= a; i++) {
                for (int j = i; j < a; j++) {
                    System.out.print(" ");               
                }
                for (int k = ((i*2)-1); k > 0 ; k--) {
                    System.out.print("*");                       
                }
                System.out.println("");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


The run-time execution on my Linux machine (core2duo 1.6GHz, 3GB ram) is around 0.60 secs for a triangle of length 100. Can you improvise this algo further?

Thursday, April 26, 2012

PMI-PMP Preparation || What are Project Stakeholders?

People/Group  which either INFLUENCE OR INVOLVE OR gets IMPACTED positively of negatively by a Project. Some of the key stakeholder of any project can be - Project Manager, Customer, Performing Organization, Project Team, Project Management team, sponsor, PMO, vendors, government etc.


Stakeholder either has any INFLUENCE on a project OR INVOLVED in some way OR IMPACTED by a project. 


- Influence
- Involved
- Impacted


Identification of right stakeholders is extrenely important for a Project Manager.

Wednesday, April 25, 2012

PMI-PMP Preparation || How to differenciate between Portfolios, Programs and projects? (Project Endeavors) - PART2

So far, we have discussed Projects, Operations, Programs and Portfolios individually and here, we are going to discuss about basic differences between these. Here we shall discuss on the basis of different basic parameters -

SCOPE :-

Project : Well Defined Scope.
Program : More attuned towards benefits.
Portfolio : Frequently changes with change in Strategy.

Planning :-

Project : 'Rolling Wave' planning
Program : Plan for a Program, which guides Project planning
Portfolio : Top level plan which of-course is main benchmark for all plans.

Management:-

Project : Project Manager, who mainly concentrate on one Project at any point of time
Program : Takes care of multiple Projects of similar types
Portfolio : Takes care of overall Portfolio of various projects/programs

Change Control:-

Project : Keep changes minimum
Program : Open to changes
Portfolio : Market driven changes are always welcome

Delivery Style :-

Project : Task oriented
Program : Benefit Realization
Portfolio : Value Oriented

Monitoring :-

Project : Project Objective related
Program : benefit related
Portfolio : Value indicator or overall performance
 

Tuesday, April 24, 2012

PMI-PMP Preparation || How to differenciate between Portfolios, Programs and projects? (Project Endeavors)

Before we start discussing about Portfolios and Programs, I would recommend to check about Projects and Operations @ HERE

At top level, Program is basically a group of Projects managed in a coordinated way to achieve synergy which is  not available from managing those Projects individually. 


At the same time Portfolio is group of Projects and Programs and associated operations to facilitate effective management to achieve strategic objectives. Portfolios are designed by main thoughts around business proposition and strategic coherence. 

Program Management at top level take cares of -

- Managing inter-dependencies between different projects and operations. 
- Resolving resource constraints, aligning strategic directions, resolving issues and change management stuff.
- Capability enhancement and achieving end result 
- Program Managers are more open to changes as compared to Project Managers. 

 Few things about Portfolios -

- Portfolios are directly mapped to strategic goals of any organization.
 - Portfolio management is mainly driven by business propositions, market demand and need to maximize  vlue of Organization.
- Guiding investments to streamline organizational objectives.