Change a tree so that the roles of the left and right pointers are swapped at every node 

Data Strucutres
Linked Lists
Binary Trees
Expression Converstion's
Infix To Postfix
Infix To Prefix
Postfix To Prefix
Postfix To Infix
Postfix Expression Evaluation
Home............
Linked List
Binary Trees
Arrays
Stacks
Queues
Graphs
Searching Methods
Sorting Methods

 

Interview Puzzles
GDI+
Ado.Net Tutorial
Asp.Net Tutorial
Lectures videos
Winform Tutorial
C#.Net Tutorial
Programming Tips And Tricks
Visual C++ Tutorial
Ado.net Tutorial
ActiveX Controls Tutorial
ATL COM Tutorial
COM Tutorial
Managed C++The Buddha And His Dhamma
Bea WebLogic Interviews
TCL Programming FAQ's
Computer Science Notes
Discrete Mathematics notes
Database Management System(DBMS) Faqs
Professional Practices Faqs
Lotus Notes Faqs
Beautiful advertisements
Programming interview Questions and answers Blog List
Human Resource Tips
Tips for Windows XP Systems
Tips for Internet and Computer users
Tips for better e-mail etiquette
JavaScript Faq's
VB Script FAQ's
HTML Faq's
Perl Scripting FAQ's
Winrunner Faq'sLinux FAQ's
CCNA cisco Certification
Data WareHousing Interview
Microsoft SharePoint Interview
C++ Interview
Siebel Customer Relationship Management FAQ's
C Programming Language- Step by step learning
Unix FAQ'sSample Source Code for all languages
Various Technical and academic certifications

Source Code

Certifications

Misceleneous technical Faq's

VC++  Blog

Data structures Blog

.Net Blog

C#.Net Blog

VB.Net Blog

ASP.Net Blog

ADO.Net Blog

Winform Blog

WCF / WPF Blog

Job Openings

Operating Systems Faqs

Sybase Faq's

Download free e-books

All scripting Faq's

Oracle Faq's

All technical Faq's

Hasya-Vyang hindi kavite

HR, Car, Finance Faq's

Finance and Investment Faq's

All Freshers Resources

All Placement Papers

QA and testing Faq's

Sql Server Faq's

Mainframes Faq's

Java Faq's

Sap Faq's

Jokes & Fun


Click here to enter your page's footer (optional).

 

Linked list problems............................................
Reversing a linked list. Solutions...
Sorted Insertion of a node into linked list. Solution...
Deletion of node from linked list. Solution...
Finding Nth element in a Linked List. Solution...
Binary search method. Solution...
Generate mirror image tree of given tree. Solution...

/*
Change a tree so that the roles of the
left and right pointers are swapped at every node.
So the tree...
*/
void mirror(struct node* node) {     

        if (node==NULL)  {
             return;
        }
        else { 

             struct node* temp;  

             // do the subtrees
             mirror(node->left);
             mirror(node->right);       

            // swap the pointers in this node
           temp = node->left;
           node->left = node->right;
           node->right = temp;
      }
}