Convert a Lead to person Account


If your organization uses person accounts, 
you can convert leads to either person accounts or business accounts. 
Leads with a blank Company field are converted to person accounts. 
The default person account record type for your profile is applied to the new person account
Note that you can only create leads with a blank Company field using the Force.com API. Leads with a value in the Company field are converted to business accounts. The default business account record type for your profile is applied to the new business account.

As a best practice, use different lead record types and page layouts to differentiate leads that will be converted to person accounts from those that will be converted to business accounts. 
In particular, remove the Company field from the page layouts of leads(So that it can be blank) that will be converted to person accounts, and make the Company field required on the page layouts of leads that will be converted to business accounts.

function to check if a given array is BST or Not

//function to check if a given array is BST or Not
boolean canRepresentBST(int pre[]) 
              {
Stack<Integer> s = new Stack<Integer>();
                 int root = Integer.MIN_VALUE;    //  Integer.MIN_VALUE=2147483648

// Traverse given array
for (int i = 0; i < pre.length; i++) 
                       {
 if (pre[i] < root) /* if current elemnt is less than root*/
                           {
return false;
                          }

/*if   TOP of the stack  is less than the current element  
                          then  make  the ROOT= TOP  and TOP=ELEMENT  */
while (!s.empty() &&  s.peek() < pre[i]) 
                          {
root = s.peek();
                        s.pop();
                        }
                           s.push(pre[i]); 
                     }
return true;
             }


_______________________________________________________________
                                                                      50

                             30                                                                                                70
      20                                35                                                                60                           75

10           25               32          36                                              55             65           72           77

_______________________________________________________________

50   30     20    25      10    35     32       36            70    60         55    65   75    72    77

Note:
          put all the LEFT values in the stack until first right(25) come to traverse. when first right(25) comes then remove all the values(10,20) those are less than first right(25)  and store the rest values(25,30,50) in the stack and make the root=20 i.e  just less than the right value(25) and so on...



Counters