Friday, December 19, 2014

It’s a friendship turned into love!

Oh! Oh! Oh! Oh! Oh my Love!
I remember I first met you on the beach,
At dusk when the sky was peach,
We got introduced as friends though
We both belong to two far away ends!

You ate the fries that I bought for all,
And showed me your gratitude;
You have never showed towards me your attitude!
And is that why I fell for you?!

Our second meeting my love,
Was near the lake, by Jove;
We both flirted like dove.
It’s a friendship turned into love!

We got closer to each other slowly.
One day you surprised me with a kiss.
I am never gonna give another chance like that a miss.
It’s a friendship turned into love!

One day you took me closer to you
You grabbed both my hands
Gave me a tight hug and whispered in my ear
That it was the valentine’s day of that year.

Wow! WOW! Wow!
You did not leave my hand,
You put on it a love’s band,
By the sand,

We spent that night together alone.

Sunday, December 14, 2014

True LOVE

Mrs.Dunne was sitting by the side of the fireplace in the cold winter night, knitting the woolen sweater. She was wearing her high-power-thick-framed spectacles and her hair was tied in a tight bun at her back.
The Rolling Stones' Paint It Black was playing in her old radio. On listening to the lyrics, her thoughts slowly traveled back in the memory lane to when she was a young girl.
                                                             *****

"Daddy, why are we painting the fence black while Mrs.Rosie and Mr.Gardner have their fence painted in white?"
"Black is my favorite color Dunne"
This happened when Dunne was four years old.
                                                             *****

"Daddy why are we still riding on a truck, while Mr.Alex and his son have got a small vehicle they call as Taar?"
"Its not Taar Dunne, it is car. We are still having a truck because, I love driving a truck than a car".
This happened when Dunne was six years old.
                                                             *****

Dunne has always felt that her father has not given her enough space in life. She felt that he always had the attitude of dominating things and doing stuffs in his own way. This Point of View of Dunne got more intensified when Mr.Weber married Ms.Allen when Dunne was twelve years old. Dunne felt lost and stranded.

Days, months and years rolled. Mrs. Allen gave birth to two sons and a daughter. At the age of fifteen, teenager Dunne picked up a fight with her father who according to her was the most selfish and dominating person in her world, and moved out to live with her then boyfriend Mr.Brown.
All her step-brothers and step-sister treated her unfriendly. Mrs.Allen Weber was Dunne's she school teacher. Dunne hated her. She cannot understand why her father married Ms.Allen. That was something strange to Dunne even then.

                                                            *****

When Mrs.Dunne Wellington was fifty-six years old, her father who was octogenarian has passed away. " That was before four years", she heard herself murmuring to her. The old arm chair creaked a little when she stood up. She adjusted her spectacles. Dunne slowly kept the woolen sweater and needle beside the hot tea-pot on the table and headed towards her bed room with her walking stick.
                                                            *****

Mr.Weber had always showed immense love for Dunne's mother. But, Since he joined hands with Allen, Dunne felt that her father's love for her mother is not true. She just recollected how many days she had cried thinking about her innocent mother; this only increased her hate more towards her father.

She slowly sat on her bed and placed the walking stick beside her and pulled out a drawer. She took out an envelope and slowly walked toward the fireplace. Her heart was as hard as rock.
                                                            *****

Moments later, she was standing in front of the fire place with the envelope in her hand. She was about to throw that into the fire. It was all that her father had left for her, after his death. But all of  sudden, her intuition told her," Dunne, do not be in a haste, think a little. Though Dad did not really like Mum, Mum's love for Dad is true and pure. She had always loved her husband and spoke good about him when she was alive. What if you open this and see what he has left for you?"
                                                            *****

Hours passed. Finally Dunne made up her mind and opened the seal with a big sigh. She found a small letter and a will enclosed with it.
                                                           *****

Dear Dunne,
                        I do not know if I will be alive when this letter reaches your hand. I have always loved your mother more than Allen and so you were born. Me and your mother have always loved you.
                        Your mother is my first true love in my life and so you are always special to me. Here I have enclosed a will stating that you are the sole owner of the 50 acre farm land that I have in Dundee, after my demise.
                        I would also like you to know that I have not given this to Allen's children because I Love You and your mother more than them.
Love.
Father.

P.S: First true love lives in heart till last breath.

                                                           *****
Dunne felt numb. She cried.


Monday, December 8, 2014

If we are not meant for each other....

If we are not meant for each other,
why did you steal my heart?
If we are not meant for each other,
why my heart always skips a beat when my mind gives about you a thought?
If we are not meant for each other,
why we had so much in common?
If we are not meant for each other,
why on earth did we fall for each other?

I know tis not lust, but tis pure love,
as pure as a baby's smile,
as pure as dew on a grass blade.

I also know that lust is just the next stage of love.
I was into you and you were into me.
We were about to tell each other how we felt,
when the whole world came inbetween and changed the way we dealt (each other)

Oh! My love, please dont leave me stranded;
Because it is your love that I most wanted.

I know we both belong to different religions,
But see we are united by a religion called love.
Tis one of the most powerful forces on this earth below (the heavens).

Jesus did preach love; and so did Krishna;
So, though we differ,
Love is something that our Gods prefer.

I know you did love me,
I felt it in the way you touched me,
I know some of our friends do not like this happening between us,
If only they know how life was like in NUS.

The memories live fresh in my heart as if they all happened today,
and I am still the One who wishes you every year on your Birthday;
I am not saying that you forgot me;
But do u know everyday I just think of that one night and cry?

Life is much hard for me now;
You having graduated and moved on;
Still my new life (after forgetting you) is yet to be born.

One thing still confuses me..
Have you really loved thee?
If so where did that love vanish?
All of a sudden , u ignored it as if it was devilish.

Love, as pure as a milk, is what I felt for thou.
But what use is it of, if we are not meant for each other?
What use is it of, if we are not meant for each other?

Monday, December 1, 2014

LMP

What does LMP stand for?
Well, to know about it in detail, please read this post.
Whenever, I face a difficult situation in life, my mind tries hard to distract me from that situation by engaging myself in bizarre activities that have no link at all to the difficulty that I am facing.
For example, in school days I had this friend of mine who is very studious and brilliant than me. We both were very close and best friends till this day.
During exam times, this friend of mine will not even cut her nails. When I asked her after exam one day,"Hey Prema, why you did not cut ur nails? See how bad it looks with so much of black dirt deposited inside it?"
She replied " Dear, I dont have time to cut, I am very busy preparing for exams".

( I was thinking to my self about how I wasted nearly 10 minutes in the previous day by cutting my overgrown nails from fingers and toes. Even then I did not feel guilty. Because, personal cleanliness and hygiene are the first things that my parents have taught me, since they are doctors. I thought Prema should use some of her intelligence on self-grooming also.)

Even today, when I am faced with any difficult situation or last minute panic, my adrenaline increases suddenly and my increase in aesthetic sense is directly proportional to the increase in adrenaline, this all ends me in concentrating on Self-Grooming.

I am not blaming Prema, nor I am blowing my own trumpet, see, as I have already mentioned in my previous post, people are different.

I should mention here that Prema is now a reputed MBBS doctor, from Stanley Medical College, in the society. The famous medical college in Chennai where my father finished Medicine. My parents are and were proud of Prema. I wonder if this message will ever reach her or will she ever read this post. Anyway, Prema, I just want to let you know that we both emerged out as successful people in out class - 10 & 12 but in our own different ways. We both are successful in our Education, again in our own different ways.
I have always thanked God for showing such a nice person like u in my life. Feeling nostalgic, when I remember the good old Gnanananda School days! esp our Class-8 days.

So, got the LMP???eh?

Thursday, November 27, 2014

Relationships of these days

If two people are happy together, just leave them alone.
But this is not the case that happened in my life. In my situation, there were some spoilers of my relationship, and the most worst thing is that the male person involved in the relationship is easily brain-washed by these spoilers.
The relationship breaks.
I think that is why our traditional Indian society was highly dependent on arranged marriages. Women, like me, these days are interested in living the life to the fullest of their wish, whatever it may be.
The same above situation happened in my life in Singapore and i found myself emotionally devastated. Then on , I started working on my EQ and Android.
Ahem...Ahem...ofcourse, u r right. Y r u reading it again? Yes, I have mentioned two irrelevant features simply in a single statement to confuse everyone.
But yes, its true, I started to work on my EQ.

Opportunity will knock the door only once. But in my case, opportunity came like a giant snake like the one shown in "The New Alcatraz". It broke my door into pieces, gulped me fast and I was inside its belly in no time.

Suddenly, someone came with a knife and killed this Alcatraz, and I came out of this oportunity, but i found myself in a strange country called Singapore.This opportunity which came in the form of Alcatraz, left me stranded in the streets of Singapore with a bunch of people like me on the roads.

Then...............
My Mum: Papa ! Papa! Wake up!!! Collegeku poriya illaiya? Time aachu paar...
Me: (Yawning) Pooooooooooogureeeeeeeaaaaaaaan ma.

All the dreams suddenly disappeared from my mind and i went to brush my teeth.
Good night people!
Have beautiful nightmares!!

Saturday, November 22, 2014

Wednesday, November 12, 2014

Sorting Part--6 HeapSort REFERNCE PANIMALAR ENGINEERING COLLEGE NOTES

HEAP SORT

In heap sort the array is interpreted as a complete binary tree. This method has two phases.

Phase 1 : Binary heap is constructed.
Phase 2 : Deletemin or Deletemax routine is performed for sorting.

Phase 1: Two properties of a binary heap namely structure property and heap order property are achieved.

Phase 2: The array elements are sorted using deletemin operation, which gives the elements arranged in descending order.

the array elements are sorted using deletemax operation, which gives the elements arranged in ascending order.

Algorithm

#define leftchild(i) (2*(i)+1)

void PercDown (ElementType A[], int N)
{
int child;
ElementType tmp;
for ( tmp = A[i]; leftchild (i){
child = leftchild(i);
if(child!=N-1 && A[child+1] > A[child])
child++;
if(tmpA[i]=A[child];
else
break;
}
A[i]=temp;
}

void HeapSort (ElementType A[], int N)
{
int I;
for(i=N/2;i>=0;i--)
PercDown(A,i,N);
for(i=N-1;i>0;i--)
{
Swap(&A[0], &A[i]);
PercDown(A,0,i);
}
}

Analysis of Heap Sort

Worst Case Analysis              - O(N log N)
Best Case Analysis                 - O(N log N)
Average Case Analysis           - O(N log N)

Advantages of Heap Sort

It is efficient for sorting large number of elements.
It has the advantage of Worst Case O(N log N) running time.

Limitations

It is not a stable sort.
It requires more processing time.

Example:

Input : 25, 73, 10, 95, 68, 82, 22, 60

Step 1: Build Heap routine execution to derive a MaxHeap structure




Step 2: Delete Max routine to derive a sorted list :


Tuesday, November 11, 2014

SOME SIMPLE SOURCE CODES THAT I DEVELOPED IN C#.NET AFTER REFERRING FEW BOOKS FEEL FREE TO POINT OUT ERRORS IF ANY

SOURCE CODE #1
using System;
class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello C#");
        }
    }

OUTPUT OF SOURCE CODE #1



SOURCE CODE #2:
using System;
namespace ConsoleApplication2
{
    public class Fraction
    {
        public Fraction(int numerator, int denominator)
        {
            this.numerator = numerator;
            this.denominator = denominator;
        }
        public void Add(Fraction rhs)   
        {
            if(rhs.denominator != this.denominator)
            {
                throw new ArgumentException("Denominators must match");
            }
            //return new Fraction(this.numerator+rhs.numerator, this.denominator);
            Console.WriteLine("The sum of the two fractions is " + (this.numerator + rhs.numerator) + " / " + this.denominator);
        }
        public override string ToString()
        {
            return numerator + "/" + denominator;
        }
        private int numerator;
        private int denominator;
        public static void Main (String []args)
        {
            Fraction frac = new Fraction(2,3);
            Fraction frac1 = new Fraction(4,3);
            frac1.Add(frac);
        }
    }
}

OUTPUT FOR SOURCE CODE #2:




Monday, November 10, 2014

Quick Sort (Part- 4)

REFERENCE : PANIMALAR ENGINEERING COLLEGE NOTES
Quick Sort:
Quick sort is one of the most efficient internal sorting technique. It possess a very good average behavior among all the sorting techniques. It is also called as partitioning sort which uses divide and conquer techniques.
                The quick sort works by partitioning the array A[1], A[2]. . . A[N] by picking some key value in the array as a pivot element.Pivot element is used to rearrange the elements in a array. Pivot element can be the first element of an array and the rest of the elements are moved so that elements on left side of the pivot are lesser than the pivot, whereas those on the right sie are greater than the pivot. Now the pivot element is placed in the correct position. Now the quick sort procedure is applied for left array and right array in a recursive manner.

void qsort (int A[ ] , int left, int right)
{
int i,j, temp, pivot;
if(left{
pivot = left;
i = left + 1;
j = right;
while(i{
while(A[pivot]>=A[j])
i++;
while(A[pivot]j--;
if(i{
temp=A[j];
A[i]=A[j];
A[j]=temp;
}
}
temp = A[pivot];
A[pivot] = A[j];
A[j]=temp;
qsort(A,left,j-1);
qsort(A,j+1,right);
}
}

Example: Consider an unsorted array as follows40         20         70          14          60           61            97          30Here pivot = 40

40      20      70      14      60      61      97      30

40      20      70      14      60      61      97      30


40      20      30      14      60      61      97      70

Pass 1:

14      20      30      40      60      61      97      70

Now the pivot element reached its correct position. The elements lesser than pivot {14     20       30} is considered as left sub array. The elements than the pivot { 60     61     97     70} is considered as right sub array. Then the Qsort procedure is applied recursively for both these arrays.

Analysis of Quick Sort

Worst Case Analysis                 - O(N2)
Best Case Analysis                   - O (N log N)
Average Case Analysis              - O (N log N)

Advantages of Quick Sort

It is faster than other O(N log N) algorithms.
It has better cache performance.

Limitations

It requires extra memory space.
It requires more processing time.

Merge Sort Part- 3 REFERENCE : PANIMALAR ENGINEERING COLLEGE NOTES

The most common algorithm used is the merge sort. This algorithm follows divide and conquer strategy. In dividing phase the problem is divided into smaller problem and solved recursively.In conquering phase, the partitioned array is merged together recursively. Merge sort is applied to the first half and second half of the array. This gives two sorted halves which can then be recursively merged together using the merging algorithm.
The basic merging algorithm takes two input arrays A and B and an output array C. The first element of A array and B array are compared, then the smaller element is stored in the output array C and the corresponding pointer is increment. When either input array is exhausted the remainder of the other array is copied to an output array C.

void MSort (ElementType A[ ] , ElementType TmpArray[ ] , int left, int right)
{
int center;
if(left{
center = (left + right) / 2;
msort(A, TmpArray, left,center);
msort(A,TmpArray, center+1,right);
merge(A, TmpArray, left, center+1, right);
}
}

void merge(int A[ ], int TmpArray[ ], int lpos, int rpos, int rightend)
{
int i, num, leftend, tmpos;
leftend = rpos - 1;
tmpos = lpos;
num = rightend - lpos + 1;
while(lpos<=leftend) &&(rpos<=rightend)
if(A[lpos]<=A[rpos])
TmpArray[tmpos++]=A[lpos++];
else
TmpArray[tmpos++]=A[rpos++];
while(lpos<=leftend)
TmpArray[tmpos++]=A[lpos++];
while(rpos<=rightend)
TmpArray[tmpos++] = A[rpos++];
for(i=0;i<=num; i++, rightend--)
A[rightend]=TmpArray[rightend];
}

void MergeSort(ElementType A[ ], int N)
{
ElementType TmpArray[MAX];
MSort (A,TmpArray,0,N-1)
}

The merge sort algorithm is therefore easy to describe. If N-1, there is only one element to sort and the answer is at hand. Otherwise, recursively merge sort the first half and second half. This gives two sorted halves, which can then be merged together using merging algorithm.

For example to sort the eight element array 24, 23, 26, 1, 2, 27, 38, 15. We recursively sort the first four and the last four elements, obtaining 1, 13, 14, 26, 2, 15, 27, 38. Then we merge the two halves as above, obtaining the final list 1, 2, 13, 15, 24, 26, 27, 38.


Analysis of Merge Sort

                   Worst Case Analysis       --  O(NlogN)
                    Best Case Analysis         -- O(NlogN)
                    Average Case Analysis   -- O(NlogN)

Advantages of Merge Sort
It is efficient for sorting large number of elements.
It is simple than Heap sort.
It has better cache performance.
It has the advantages of worst case O(NlogN) running time.

Limitations

It requires more memory space.
It requires more processing time.

Saturday, November 8, 2014

Data Structures ---- Sorting (Part - 2 Shell Sort)

Shell Sort

reference: PANIMALAR ENGINEERING COLLEGE NOTES
                 Shell sort was invented by Donald Shell. It improves upon bubble sort and insertion sort by moving out of order elements more than one position at a time.
                 In this sort the whole array is first fragment into K segments, where K is preferably a prime number. After first pass, the whole array is partially sorted. In the next pass, the value of K is reduced which increases the size of the segment and reduces the number of segments.
                 The next K value is chosen as relatively prime to its previous value. The process is repeated until k=1 at which the array is sorted. The insertion sort is applied to each segment, so each successive segment is partially sorted.The shell sort is also called as Diminishing Increment Sort, because the value of K decreases continuously.

Algorithm

void ShellSort (ElementType A[ ], int N)
{
int i,j,Increment;
ElementType temp;
for(Increment = N/2; Increment>0; Increment = Increment/2)
for(i=Increment;i{
temp=A[i];
for(j=i;j>=Increment;j=j-Increment)
if(tempA[j] = A[j- Increment];
else
break;
A[j] = temp;
}
}

Example

Consider an Unsorted array

81      94       11         96        12       35        17        95        28         58

Here N = 10, the first Pass as K = 5 (10/2)


After First Pass

35        17          11           28           12            81             94            95           96           58

In second pass, K is reduced to 3


After Second Pass

28        12         11           35           17                81               58            95             96            94

In third pass, K is reduced to 1


The final sorted array is

11           12          17          28          35            58            81           94            95           96

Analysis of Shell Sort

Worst Case Analysis                          - O(N2)
Best Case Analysis                             - O(N log N)
Average Case Analysis                       - O(N2)

Advantages of Shell Sort

It is one of the fastest algorithm for sorting small number of elements.

It requires relatively small amounts of memory.

(contd)

Friday, November 7, 2014

Data Structures --- Sorting (PART-1 INTRO + INSERTION SORT) REFERENCE: PANIMALAR ENGINEERING COLLEGE NOTES

A sorting algorithm is an algorithm that puts element of a list in a certain order (ascending or descending).

Sorting Algorithm are often classified by :

  • Computational complexity (worst, Average, Best cases) in the term of size of the list n.
                                             Best case     : O(nlogn)
                                              Worst case  : O(n2)
                                             Average case : O(n)

  • Memory utilizations
  • Number of comparisons
  • Method applied like Insertion, exchange, selection, merging etc.
Sorting techniques are categorized into

                                               Internal Sorting
                                               External Sorting
Internal Sorting takes place in the main memory of a computer

Example : Insertion sort, Bubble sort, Shell sort, Quick sort, Heap sort, Merge sort, Radix(Bucket) sort.

External Sorting takes place in the secondary memory of a computer.

Example: Multiway Merge, Poluphase Merge, Replacement Selection, 2-way Merge

INSERTION SORT

Insertion sorts work by taking elements from the list one by one and inserting them into their current position into a new sorted list. Insertion sort consists of N-1 passes, where N is the number of elements to be sorted.

In the insertion sort the element in the position P is saved in tmp and all larger elements prior to position P are moved one spot to the right. The tmp is placed in the correct spot.

Algorithm

void InsertionSort (ElementType A[], int B)
{
int j,P;
ElementType tmp;
for(P=i;P
{
Tmp = A[P];
for(j = P; j>0 && A[j-1]>temp; j--)
A[j] = A[j-1];
A[j] = temp;
}
}

Example

Consider an unsorted array as follows:

34    8   64    51     32      21                                      where (N = 6)


Original
34
8
64
51
32
21
Positions Moved
Pass = 1
8
34
64
51
32
21
1
Pass = 2
8
34
64
51
32
21
0
Pass = 3
8
34
51
64
32
21
1
Pass = 4
8
32
34
51
64
21
3
Pass = 5
8
21
32
34
51
64
4

The final Sorted array : 8     21        32        34        51        64       

Analysis of Insertion Sort

Worst Case Analysis               -- O(N2)
Best Case Analysis                 -- O(N)
Average Case Analysis           -- O(N2)

Limitations of Insertion Sort

It is relatively efficient for small lists and mostly sorted lists.

It is expensive because of shifting all following elements one by one.
                                                                                                                                         (Contd.....)