## Insert into a Binary Tree

[wpdm_package id=’1373′] Algorithm: Use the level order traversal or Breadth First Traversal. Insert the element where we find the left/right node as NULL. [sourcecode lang=”cpp”]…

## Checking if a String is Palindrome using Stacks

[wpdm_package id=’1375′] Algorithm: Create a Stack. Till the half of the string length, push the characters of the string into the stack. If it is…

## Middle Element of Linked List

[wpdm_package id=’1377′] Algorithm – Keep two pointer c and m. Always move c pointer at twice the speed of m pointer. If the linked list…

## Breadth First Traversal of a Tree

[wpdm_package id=’1379′] Algorithm: visit the root. While traversing level l, keep all the elements at level l+1 in queue. Go to the next level and…

## Linked List Length Even or Odd

[wpdm_package id=’1386′] [wpdm_package id=’1390′] Algorithm Move the pointer 2 nodes at a time. If it points to a null node means Linked list is of…

## Print Linked List in Reverse order

[wpdm_package id=’1388′] [wpdm_package id=’1390′] [sourcecode lang=”cpp”] int Print_Reverse_LinkedList(intnode *c){ if(c==NULL) return 0; Print_Reverse_LinkedList(c->next); cout<<c->data<<"\t"; return 1; } [/sourcecode]

[wpdm_package id=’1410′] Inserting element at end: [sourcecode lang=”cpp”] void insertAtEnd(int d) { node *current=head; node *temp=new node(d); if(head==NULL) { head=temp; temp->next=temp; } else { for(;current->next!=head;current=current->next);…

## SAP Labs India hires me!!

On September 21, 2013 Some of us attended placement process for SAP Labs India. First round was an on-line test conducted on a website. Online…

## Merge Two Sorted Linked Lists

[wpdm_package id=’1398′] Algorithm: [sourcecode lang=”cpp”] node *MergeList(node *a,node *b) { node *result=NULL; if(a==NULL) return b; if(b==NULL) return a; if(a->data<=b->data) { result=a; result->next=MergeList(a->next,b); } else {…

## Efficient method for Finding Nth element from the end of a Linked List

[wpdm_package id=’1343′] [wpdm_package id=’1345′] Algorithm: Use 2 pointers ptr and newptr. Initially both points to head node of the list. Move ptr ‘n’ times. After…