Kamis, 24 November 2011

Bruno Mars - The Lazy

Today I don't feel like doing anything
I just wanna lay in my bed
Don't feel like picking up my phone
So leave a message at the tone
'Cause today I swear I'm not doing anything

I'm gonna kick my feet up
Then stare at the fan

Turn the TV on, throw my hand in my pants
Nobody's gonna tell me I can't
<span class="fullpost">
I'll be lounging on the couch,
Just chillin' in my snuggie
Click to MTV, so they can teach me how to dougie
'Cause in my castle I'm the freaking man
Oh, oh

Yes I said it
I said it
I said it 'cause I can

Today I don’t feel like doing anything
I just wanna lay in my bed
Don’t feel like picking up my phone
So leave a message at the tone
'Cause today I swear I'm not doing anything
Nothing at all

Tomorrow I'll wake up, do some P90X
Meet a really nice girl, have some really nice sex
And she's gonna scream out: 'This is Great'
(Oh my god, this is great)
Yeah

I might mess around, get my college degree
I bet my old man will be so proud of me
But sorry pops, you'll just have to wait
Oh, oh

Yes I said it
I said it
I said it 'cause I can

Today I don’t feel like doing anything
I just wanna lay in my bed
Don’t feel like picking up my phone
So leave a message at the tone
'Cause today I swear I'm not doing anything

No, I ain't gonna comb my hair
'Cause I ain't going anywhere
No, no, no, no, no, no, no, no, no, oh

I'll just strut in my birthday suit
And let everything hang loose
Yeah, yeah, yeah, yeah, yeah, yeah, yeah, yeah, yeah-eah

Oh
Today I don’t feel like doing anything
I just wanna lay in my bed
Don’t feel like picking up my phone
So leave a message at the tone
'Cause today I swear I'm not doing anything

Nothing at all
Nothing at all
Nothing at all



Bad Meets Evil Feat. Bruno Mars - Lighter

[Chorus]
This ones for you and me
Living out our dreams
We are right where we should be
With my arms out wide
I open my eyes
And now
All I wanna see
Is a sky full of lighters
A sky full of lighters

[Eminem]
By the time you hear this I will have already spiraled up
I would never do nothin to let you cowards fuck my world up
If I was you I would duck or get struck like lightning fighters
Keep fighting
Put your lighters up
Point em’ skyward UH!
Had a dream I was king
I woke up
Still king
This rap game’s nipples is mine
For the milking
Till nobody else even fuckin feels me
Till it kills me
I swear to god I’ll be the fucking illest in the music
There is
Or there ever will be
Disagree? Feel free, but from now on I’m refusing, to ever give up,
Only thing I ever gave up is using
No more excuses
Excuse me if my head’s too big for this building
And pardon me if I’m a cocky prick
But you cocks are slick
Poppin shit on how you flipped your life around
Crock of shit
Who you dicks tryna’ kid?
Flip dick you did opposite
You stayed the same
Cause cock backwards is still cock you prick
I love it when I tell’em shove it
Cause it wasn’t that
Long ago
When Marshall sat
Flustered, lack lustered
Cause he couldn’t cut
Mustered
Muster up
Nothin
Brain fuzzy
Cause he’s buzzing
Woke up from that buzz and now you wonder
Why he does it how he does
Wasn’t cause he had
Buzzards circlin’ round his head
Waitin for him to drop dead, was it?
Or was it cause some bitches wrote him off
Little hussy ass fusses
Fuck it
Guess it doesn’t matter now does it?
What difference it make
Whats it take?
To get it through you thick skulls that this ain’t
Some bullshit
People don’t usually come back this way
From a place that was as dark as I was
And just to get to this place
Some of these words be like a switchblades to a hater’s rib cage
And let it be known that from this day forward
I wanna just say thanks
Cause your hate is what gave me the strength
So let them bics raise
Cause I came at 5’9″
But I feel like I’m 6’8″

[Chorus]
This ones for you and me
Living out our dreams
Where are right where we should be
With my arms out wide
I open my eyes
And now
All I wanna see
Is a sky full of lighters
A sky full of lighters

[Royce Da 5’9"]
By the time you hear this I probably already be outie
I advance like going from toting iron to goin
And buying 4 or 5 of the homies, to iron man outie
My daddy told me, slow down boy you’re going to blow it
And I ain’t gotta stop to be the minute to tell shady I love the same way that he did Dr. Dre on the chronic
Tell’em how real he is
Or how high I am
Or how I would kill him, for him to know it
I cry when he tears
My daddy gotta bad back
So its only right that I write
Till he can march right in to that post office and tell’em to hang it up
Now his careers Lebron’s jersey in twenty years
I stop when I’m at the very top
You shitted on me on your way up
It’s bout to be a scary drop
Cause what goes up
Must come down
You goin down
I’m somethin you don’t wanna see
Like a hairy box
Every hour
Happy hour now
Life is wacky now
Used to have to eat the cat to get the pussy
Now I’m just a cat’s meow
Owwww
I’m classic now
Always down for the catch-way
Like Pacquiao
Yall are doomed
I remember when T-Pain ain’t wanna work with me
My car starts itself
Parks itself
And auto-tunes
Cause now I’m in the Astin
I went from having my city locked up
To getting treated like Kwame Kilpatrick
And now I’m fantastic
Compared to a weed high
And yall’ niggas the sky sippin like bitches
On a radio and TV
See me, we fly
Y’all buggin out like Wendy Williams
Starin’ at a bee hive
And how real is that?
I remember signing my first deal
Now I’m the second best
I can deal with that
Now Bruno can show his ass
Without the MTV awards gag

[Bridge]
You and I
Know what it’s like
To be kicked down
Forced to fight
But tonight
We’re alright
So hold up your lights
Let it shine
Cause..

[Chorus]
This ones for you and me
Living out our dreams
We are right where we should be
With my arms out wide
I open my eyes
And now
All I wanna see
Is a sky full of lighters
A sky full of lighters

LMFO - Party Rock Anthem

PARTY ROCK
YEA
Whoa!
LET'S GO!
Party rock is in the house tonight
Everybody just have a good time
And we gonna make you lose your mind
Everybody just have a good time

Party rock is in the house tonight
Everybody just have a good time
And we gonna make you lose your mind
We just wanna see ya!

Shake that!

In the club party rock, lookin' for your girl
She on my jock (huh) non stop when we in the spot
Booty move away like she on the block
What the track I got to know
Tight jeans tattoo cause I'm rock and roll
Half black half white domino
Gain the money Oprah Doe!

Yo!
I'm running through these hoes like drano
I got that devilish flow rock and roll no halo
We party rock yea! that's the crew that I'm repping
On the rise to the top no led in our zeppelin
Hey!

Party rock is in the house tonight
Everybody just have a good time
And we gonna make you lose your mind
Everybody just have a good time

Let's go
Party rock is in the house tonight
Everybody just have a good time
And we gonna make you lose your mind

We just wanna see you!

Shake that!

Every day I'm shuffling
Shuffling shuffling

Step up fast and be the first girl to make me throw this cash
We get money don't be mad now stop hating is bad

One more shot for us
(Another round)
Please fill up my cup
(Don't mess around)
We just wanna see
(You shake it now)
Now you wanna be
(You're naked now)

Get up get down put your hands up to the sound [x3]
Put your hands up to the sound [x2]
Get up [x9]
Put your hands up to the sound, to the sound
Put your hands up! [x4]

Party rock is in the house tonight (Put your hands up!)
Everybody just have a good time (Put your hands up!)
And we gonna make you lose your mind (Put your hands up!)
Everybody just have a good good good time

Oh! Oh! (Put your hands up)
Oh! Oh! Time to fill it now!
Oh! Oh! (Put your hands up)
Oh! Oh! (Put your hands up)

Shake that!
Every day I'm shuf-f-f-ling

Put your Put your
Put your Put your (Yeah Yeah)
Put your Put your (Whoa!)
Put your Put your
Put your hands up
Your hands up
Put your hands up


I feel like I just seen the sun for the first time
You make my life bright cause you shine
It's me and you baby, it's our time
I'm living my dream, girl cause you mine
You got me skippin' down the street
And singin' love songs all out of key
I didn't smoke nothin' but I feel so high
And I know why
It's a love thing, it's got to be
Your heart's all locked and I got the key
It feels like I just won the lottery
'Cause I got my girl and she got me

You my new obsession
All I want to do
You my new obsession, girl
I feel on top of the world with you baby
I want to dance and party tonight
I feel on top of the world with my lady
I'm gonna rock your body all night
She makes me wanna sing

La, la la la [x8]

Oh, I can't get you out my mind
Everything you do is feelin' right
Remember that way you caught my eye?
I remember that way you was walkin' by
Ooh girl, watch out now
You looked at me, turned around and smiled
Gave me eyes, my heart went wild
Hypnotized, this love starts now
And how do I know you're real?
It really doesn't matter, it's the way I feel
You make me feel super like the man of steel
Got me goin' stupid, pickin' daffodils

You my new obsession
All I want to do
You my new obsession, girl
I feel on top of the world with you baby
I want to dance and party tonight
I feel on top of the world with my lady
I'm gonna rock your body all night
She makes me wanna sing

La, la la la... [x14]

You my new obsession [x5]

All I want to do
You my new obsession, girl
I feel on top of the world with you baby
I want to dance

Dance... [etc.]

I feel on top of the world with you baby
I want to dance and party tonight
I feel on top of the world with my lady
I'm gonna rock your body all night

Rihanna feat. Calvin Harris - We Found Love

Yellow diamonds in the light
Now we’re standing side by side
As your shadow crosses mine
What it takes to come alive

It’s the way I’m feeling I just can’t deny
But I’ve gotta let it go

We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place
Shine a light through an open door
Love a life I will divide
Turn away 'cause I need you more
Feel the heartbeat in my mind

It’s the way I’m feeling I just can’t deny
But I’ve gotta let it go

We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place

Yellow diamonds in the light
Now we’re standing side by side
As your shadow crosses mine

We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place

We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place
We found love in a hopeless place



"A Year Without Rain"

Can you feel me
When I think about you
With every breath I take
Every minute
No matter what I do
My world is an empty place

Like I've been wandering the desert
For a thousand days (oh)
Don't know if it's a mirage
But I always see your face, Baby

[Chorus:]
I'm missing you so much
Can't help it, I'm in love
A day without you is like a year without rain
I need you by my side
Don't know how I'll survive
A day without you is like a year without rain

The stars are burning
I hear your voice in my mind (in my mind)
Can't you hear me calling?
My heart is yearning
Like the ocean that's running dry
Catch me, I'm falling

It's like the ground is crumbling underneath my feet
Won't you save me?
There's gonna be a monsoon
When you get back to me (oh, baby)

[Chorus]

So let this drought come to an end
And make this desert flower again
I need you here
I can't explain
But a day without you
Is like a year without rain (oh)

[Chorus]

Last Friday Night (T.G.I.F.) - Katy Parry

There's a stranger in my bed,
There's a pounding in my head
Glitter all over the room
Pink flamingos in the pool
I smell like a minibar
DJ's passed out in the yard
Barbie's on the barbeque
Is this a hickie or a bruise?
Pictures of last night

Ended up online
I'm screwed
Oh well
It's a blacked out blur
But I'm pretty sure it ruled
Damn

Last Friday night
Yeah, we danced on tabletops
And we took too many shots
Think we kissed but I forgot

Last Friday night
Yeah, we maxed our credit cards
And got kicked out of the bar
So we hit the boulevard

Last Friday night
We went streaking in the park
Skinny dipping in the dark
Then had a ménage à trois
Last Friday night
Yeah I think we broke the law
Always say we're gonna stop
Whoa-oh-oah

This Friday night
Do it all again
This Friday night
Do it all again

Trying to connect the dots
Don't know what to tell my boss
Think the city towed my car
Chandelier is on the floor
Ripped my favorite party dress
Warrant's out for my arrest
Think I need a ginger ale
That was such an epic fail

Pictures of last night
Ended up online
I'm screwed
Oh well
It's a blacked out blur
But I'm pretty sure it ruled
Damn

Last Friday night
Yeah, we danced on table tops
And we took too many shots
Think we kissed but I forgot

Last Friday night
Yeah, we maxed our credit cards
And got kicked out of the bar
So we hit the boulevards

Last Friday night
We went streaking in the park
Skinny dipping int he dark
Then had a ménage à trois

Last Friday night
Yeah I think we broke the law
Always say we're gonna stop
Oh whoa oh

This Friday night
Do it all again
Do it all again
This Friday night
Do it all again
Do it all again
This Friday night

T.G.I.F.
T.G.I.F.
T.G.I.F.
T.G.I.F.
T.G.I.F.
T.G.I.F.

Last Friday night
Yeah, we danced on table tops
And we took too many shots
Think we kissed but I forgot

Last Friday night
Yeah, we maxed our credit cards
And got kicked out of the bar
So we hit the boulevard

Last Friday night
We went streaking in the park
Skinny dipping in the dark
Then had a ménage à trois

Last Friday night
Yeah I think we broke the law
Always say we're gonna stop
Oh-whoa-oh
This Friday night
Do it all again

Move Like Jagger - Maroon5

Oh, yeah
Oh!

[Verse 1:]
Just shoot for the stars
If it feels right
And aim for my heart
If you feel like
And take me away and make it OK
I swear I'll behave

You wanted control
So we waited
I put on a show
Now I make it


You say I'm a kid
My ego is big
I don't give a shit
And it goes like this

[Chorus:]
Take me by the tongue
And I'll know you
Kiss me 'til you're drunk
And I'll show you

All the moves like Jagger
I've got the moves like Jagger
I've got the moves like Jagger

I don't need to try to control you
Look into my eyes and I'll own you

With them moves like Jagger
I've got the moves like Jagger
I've got the moves like Jagger

[Verse 2:]
Maybe it's hard
When you feel like you're broken and scarred
Nothing feels right
But when you're with me
I'll make you believe
That I've got the key

Oh
So get in the car
We can ride it
Wherever you want
Get inside it
And you want to steer
But I'm shifting gears
I'll take it from here (Oh! Yeah yeah!)
And it goes like this (Uh)

[Chorus:]
Take me by the tongue
And I'll know you (Uh)
Kiss me 'til you're drunk
And I'll show you

All the moves like Jagger
I've got the moves like Jagger
I've got the moves like Jagger

I don't need to try to control you (Oh, yeah)
Look into my eyes and I'll own you

With them moves like Jagger
I've got the moves like Jagger (Yeah yeah)
I've got the moves like Jagger

[Bridge:]
You wanna know how to make me smile
Take control, own me just for the night
And if I share my secret
You're gonna have to keep it
Nobody else can see this

So watch and learn
I won't show you twice
Head to toe, oooh baby rub me right
But if I share my secret
You're gonna have to keep it
Nobody else can see this (Ay! Ay! Ay! Aaay!)

And it goes like this

[Chorus:]
Take me by the tongue (Take me by the tongue)
And I'll know you
Kiss me 'til you're drunk
And I'll show you (Yeah yeah yeah!)

All the moves like Jagger
I've got the moves like Jagger
I've got the moves like Jagger
(Oh, yeah)
I don't need to try to control you
Look into my eyes and I'll own you

With them moves like Jagger
I've got the moves like Jagger
I've got the moves like Jagger


Rabu, 23 November 2011

Contoh Program Pohon

 Silahkan dicoba
#include <iostream>
#include <deque>
#include <climits>
using namespace std;

struct Tree
{
char data;
Tree *left;
Tree *right;
Tree *parent;
};

Tree* lookUp(struct Tree *node, char key)
{
if(node == NULL) return node;

if(node->data == key) return node;
else {
if(node->data < key)
return lookUp(node->right, key) ;
else
return lookUp(node->left, key);
}
}

Tree* leftMost(struct Tree *node)
{
if(node == NULL) return NULL;
while(node->left != NULL)
node = node->left;
return node;
}

struct Tree *newTreeNode(int data)
{
Tree *node = new Tree;
node->data = data;
node->left = NULL;
node->right = NULL;
node->parent = NULL;

return node;
}

struct Tree* insertTreeNode(struct Tree *node, int data)
{
static Tree *p;
Tree *retNode;

if(node != NULL) p = node;

if(node == NULL) {
retNode = newTreeNode(data);
retNode->parent = p;
return retNode;
}
if(data <= node->data ) {
p = node;
node->left = insertTreeNode(node->left,data);
}
else {
p = node;
node->right = insertTreeNode(node->right,data);
}
return node;
}

void isBST(struct Tree *node)
{
static int lastData = INT_MIN;
if(node == NULL) return;

isBST(node->left);

/* check if the given tree is BST */
if(lastData < node->data)
lastData = node->data;
else {
cout << "Not a BST" << endl;
return;
}

isBST(node->right);
return;
}

int treeSize(struct Tree *node)
{
if(node == NULL) return 0;
else
return treeSize(node->left) + 1 + treeSize(node->right);
}

int maxDepth(struct Tree *node)
{
if(node == NULL) return 0;

int leftDepth = maxDepth(node->left);
int rightDepth = maxDepth(node->right);

return leftDepth > rightDepth ?
leftDepth + 1 : rightDepth + 1;
}

int minDepth(struct Tree *node)
{
if(node == NULL) return 0;

int leftDepth = minDepth(node->left);
int rightDepth = minDepth(node->right);

return leftDepth < rightDepth ?
leftDepth + 1 : rightDepth + 1;
}

bool isBalanced(struct Tree *node)
{
if(maxDepth(node)-minDepth(node) <= 1)
return true;
else
return false;
}

/* Tree Minimum */
Tree* minTree(struct Tree *node)
{
if(node == NULL) return NULL;
while(node->left)
node = node -> left;
return node;
}

/* Tree Maximum */
Tree* maxTree(struct Tree *node)
{
while(node->right)
node = node -> right;
return node;
}

/* In Order Successor - a node which has the next higher key */
Tree *succesorInOrder(struct Tree *node)
{
/* if the node has right child, seccessor is Tree-Minimum */
if(node->right != NULL) return minTree(node->right);

Tree *y = node->parent;
while(y != NULL && node == y->right) {
node = y;
y = y->parent;
}
return y;
}

/* In Order Predecessor - a node which has the next lower key */
Tree *predecessorInOrder(struct Tree *node)
{
/* if the node has left child, predecessor is Tree-Maximum */
if(node->left != NULL) return maxTree(node->left);

Tree *y = node->parent;
/* if it does not have a left child,
predecessor is its first left ancestor */
while(y != NULL && node == y->left) {
node = y;
y = y->parent;
}
return y;
}

Tree *lowestCommonAncestor(Tree *root, Tree *p, Tree *q)
{
Tree *left, *right;
if(root == NULL) return NULL;
if(root->left == p || root->left == q
|| root->right == p || root->right == q) return root;
else {
left = lowestCommonAncestor(root->left,p,q);
right = lowestCommonAncestor(root->right, p,q);
if(left && right)
return root;
else
return (left) ? left : right;
}
}

void clear(struct Tree *node)
{
if(node != NULL) {
clear(node->left);
clear(node->right);
delete node;
}
}
/* print tree in order */
/* 1. Traverse the left subtree.
2. Visit the root.
3. Traverse the right subtree.
*/

void printTreeInOrder(struct Tree *node)
{
static int lastData = INT_MIN;
if(node == NULL) return;

printTreeInOrder(node->left);
cout << node->data << " ";
printTreeInOrder(node->right);
}

/* print tree in postorder*/
/* 1. Traverse the left subtree.
2. Traverse the right subtree.
3. Visit the root.
*/
void printTreePostOrder(struct Tree *node)
{
if(node == NULL) return;

printTreePostOrder(node->left);
printTreePostOrder(node->right);
cout << node->data << " ";
}

/* print in preorder */
/* 1. Visit the root.
2. Traverse the left subtree.
3. Traverse the right subtree.
*/
void printTreePreOrder(struct Tree *node)
{
if(node == NULL) return;

cout << node->data << " ";
printTreePreOrder(node->left);
printTreePreOrder(node->right);
}

/* printing array */
void printThisPath(int path[], int n)
{
for(int i = 0; i < n; i++)
cout << (char)path[i] << " ";
cout << endl;
}

/* recursion routine to find path */
void pathFinder(struct Tree *node, int path[], int pathLength)
{
if(node == NULL) return;
path[pathLength++] = node->data;

/* Leaf node is the end of a path.
So, let's print the path */
if(node->left == NULL && node->right == NULL)
printThisPath(path, pathLength);
else {
pathFinder(node->left, path, pathLength);
pathFinder(node->right, path, pathLength);
}
}

/*printing all paths :
Given a binary tree, print out all of its root-to-leaf
paths, one per line. Uses a recursive helper to do the work. */

void printAllPaths(struct Tree *root)
{
int path[100];
pathFinder(root,path,0);
}

bool matchTree(Tree *r1, Tree *r2)
{
/* Nothing left in the subtree */
if(r1 == NULL && r2 == NULL)
return true;
/* Big tree empty and subtree not found */
if(r1 == NULL || r2 == NULL)
return false;
/* Not matching */
if(r1->data != r2->data)
return false;
return (matchTree(r1->left, r2->left) &&
matchTree(r1->right, r2->right));
}

bool subTree(Tree *r1, Tree *r2)
{
/*Big tree empty and subtree not found */
if(r1 == NULL)
return false;
if(r1->data == r2->data)
if(matchTree(r1, r2)) return true;
return (subTree(r1->left, r2) || subTree(r1->right, r2));
}

bool isSubTree(Tree *r1, Tree *r2)
{
/* Empty tree is subtree */
if(r2 == NULL)
return true;
else
return subTree(r1, r2);
}

/* change a tree so that the roles of the left
and right hand pointers are swapped at every node */
void mirror(Tree *r)
{
if(r == NULL) return;

Tree *tmp;
mirror(r->left);
mirror(r->right);

/* swap pointers */
tmp = r->right;
r->right = r->left;
r->left = tmp;
}

/* create a new tree from a sorted array */
Tree *addToBST(char arr[], int start, int end)
{
if(end < start) return NULL;
int mid = (start + end)/2;

Tree *r = new Tree;
r->data = arr[mid];
r->left = addToBST(arr, start, mid-1);
r->right = addToBST(arr, mid+1, end);
return r;
}

Tree *createMinimalBST(char arr[], int size)
{
return addToBST(arr,0,size-1);
}

/* Breadth first traversal using queue */
void BreadthFirstTraversal(Tree *root)
{
if (root == NULL) return;
deque <Tree *> queue;
queue.push_back(root);

while (!queue.empty()) {
Tree *p = queue.front();
cout << p->data << " ";
queue.pop_front();

if (p->left != NULL)
queue.push_back(p->left);
if (p->right != NULL)
queue.push_back(p->right);
}
cout << endl;
}

/* find n-th max node from a tree */
void NthMax(struct Tree* t)
{
static int n_th_max = 5;
static int num = 0;
if(t == NULL) return;
NthMax(t->right);
num++;
if(num == n_th_max)
cout << n_th_max << "-th maximum data is " << t->data << endl;
NthMax(t->left);
}

/* Converting a BST into an Array */
void TreeToArray(struct Tree *node, int a[]){
static int pos = 0;

if(node){
TreeToArray(node->left,a);
a[pos++] = node->data;
TreeToArray(node->right,a);
}
}

int main(int argc, char **argv)
{
char ch, ch1, ch2;
Tree *found;
Tree *succ;
Tree *pred;
Tree *ancestor;
char charArr[9]
= {'A','B','C','D','E','F','G','H','I'};

Tree *root = newTreeNode('F');
insertTreeNode(root,'B');
insertTreeNode(root,'A');
insertTreeNode(root,'D');
insertTreeNode(root,'C');
insertTreeNode(root,'E');
insertTreeNode(root,'G');
insertTreeNode(root,'I');
insertTreeNode(root,'H');

/* is the tree BST? */
isBST(root);

/* size of tree */
cout << "size = " << treeSize(root) << endl;

/* max depth */
cout << "max depth = " << maxDepth(root) << endl;

/* min depth */
cout << "min depth = " << minDepth(root) << endl;

/* balanced tree? */
if(isBalanced(root))
cout << "This tree is balanced!\n";
else
cout << "This tree is not balanced!\n";

/* min value of the tree*/
if(root)
cout << "Min value = " << minTree(root)->data << endl;

/* max value of the tree*/
if(root)
cout << "Max value = " << maxTree(root)->data << endl;

ch = 'B';
found = lookUp(root,ch);
if(found) {
cout << "Min value of subtree " << ch << " as a root is "
<< minTree(found)->data << endl;
cout << "Max value of subtree " << ch << " as a root is "
<< maxTree(found)->data << endl;
}

ch = 'B';
found = lookUp(root,ch);
if(found) {
succ = succesorInOrder(found);
if(succ)
cout << "In Order Successor of " << ch << " is "
<< succesorInOrder(found)->data << endl;
else
cout << "In Order Successor of " << ch << " is None\n";
}

ch = 'E';
found = lookUp(root,ch);
if(found) {
succ = succesorInOrder(found);
if(succ)
cout << "In Order Successor of " << ch << " is "
<< succesorInOrder(found)->data << endl;
else
cout << "In Order Successor of " << ch << " is None\n";
}

ch = 'I';
found = lookUp(root,ch);
if(found) {
succ = succesorInOrder(found);
if(succ)
cout << "In Order Successor of " << ch << " is "
<< succesorInOrder(found)->data << endl;
else
cout << "In Order Successor of " << ch << " is None\n";
}

ch = 'B';
found = lookUp(root,ch);
if(found) {
pred = predecessorInOrder(found);
if(pred)
cout << "In Order Predecessor of " << ch << " is "
<< predecessorInOrder(found)->data << endl;
else
cout << "In Order Predecessor of " << ch << " is None\n";
}

ch = 'E';
found = lookUp(root,ch);
if(found) {
pred = predecessorInOrder(found);
if(pred)
cout << "In Order Predecessor of " << ch << " is "
<< predecessorInOrder(found)->data << endl;
else
cout << "In Order Predecessor of " << ch << " is None\n";
}

ch = 'I';
found = lookUp(root,ch);
if(found) {
pred = predecessorInOrder(found);
if(pred)
cout << "In Order Predecessor of " << ch << " is "
<< predecessorInOrder(found)->data << endl;
else
cout << "In Order Predecessor of " << ch << " is None\n";
}

/* Lowest Common Ancestor */
ch1 = 'A';
ch2 = 'C';
ancestor =
lowestCommonAncestor(root,
lookUp(root,ch1), lookUp(root,ch2));
if(ancestor)
cout << "The lowest common ancestor of " << ch1 << " and "
<< ch2 << " is " << ancestor->data << endl;

ch1 = 'E';
ch2 = 'H';
ancestor =
lowestCommonAncestor(root,
lookUp(root,ch1), lookUp(root,ch2));
if(ancestor)
cout << "The lowest common ancestor of " << ch1 << " and "
<< ch2 << " is " << ancestor->data << endl;

/* print tree in order */
cout << "increasing sort order\n";
printTreeInOrder(root);
cout << endl;

/* print tree in postorder*/
cout << "post order \n";
printTreePostOrder(root);
cout << endl;

/* print tree in preorder*/
cout << "pre order \n";
printTreePreOrder(root);
cout << endl;

/* lookUp */
ch = 'D';
found = lookUp(root,ch);
if(found)
cout << found->data << " is in the tree\n";
else
cout << ch << " is not in the tree\n";

/* lookUp */
ch = 'M';
found = lookUp(root,ch);
if(found)
cout << found->data << " is in the tree\n";
else
cout << ch << " is not in the tree\n";

/* printing all paths :
Given a binary tree, print out all of its root-to-leaf
paths, one per line. Uses a recursive helper to do the work. */
cout << "printing paths ..." << endl;
printAllPaths(root);

/* find n-th maximum node */
NthMax(root);


/* convert the tree into an array */
int treeSz = treeSize(root);
int *array = new int[treeSz];
TreeToArray(root,array);
cout << "New array: ";
for (int i = 0; i < treeSz; i++)
cout << (char)array[i] << ' ';
cout << endl;
delete [] array;

/* subtree */
Tree *root2 = newTreeNode('D');
insertTreeNode(root2,'C');
insertTreeNode(root2,'E');
cout << "1-2 subtree: " << isSubTree(root, root2) << endl;

Tree *root3 = newTreeNode('B');
insertTreeNode(root3,'A');
insertTreeNode(root3,'D');
insertTreeNode(root3,'C');
insertTreeNode(root3,'E');
cout << "1-3 subtree: " << isSubTree(root, root3) << endl;

Tree *root4 = newTreeNode('B');
insertTreeNode(root4,'D');
insertTreeNode(root4,'C');
insertTreeNode(root4,'E');
cout << "1-4 subtree: " << isSubTree(root, root4) << endl;

cout << "2-3 subtree: " << isSubTree(root2, root3) << endl;
cout << "3-2 subtree: " << isSubTree(root3, root2) << endl;

/* swap left and right */
mirror(root);

/* deleting a tree */
clear(root);

/* make a new tree with minimal depth */
Tree *newRoot = createMinimalBST(charArr,9);

/* Traversing level-order.
We visit every node on a level before going to a lower level.
This is also called Breadth-first traversal.*/
cout << "printing with Breadth-first traversal" << endl;
BreadthFirstTraversal(newRoot);

return 0;
}