A Knowledge Base

This blog site is dedicated for articles on problem solving using C, C++, data structures, algorithms. Besides this few technical articles are also presented.

Apr 20, 2011

construct mirror of a given binary tree

mirror(a)

if(!a)
return 0

mirror(a->left)
mirror(a->right)

swap(a->left, a->right)
Posted by Swetank at 8:16 PM

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Total Pageviews

Search This Blog

Blog Archive

  • ►  2022 (30)
    • ►  May (1)
      • ►  25 May (1)
    • ►  April (3)
      • ►  08 Apr (1)
      • ►  07 Apr (1)
      • ►  03 Apr (1)
    • ►  March (26)
      • ►  19 Mar (2)
      • ►  18 Mar (1)
      • ►  17 Mar (2)
      • ►  16 Mar (2)
      • ►  15 Mar (1)
      • ►  12 Mar (2)
      • ►  10 Mar (1)
      • ►  09 Mar (1)
      • ►  08 Mar (3)
      • ►  07 Mar (8)
      • ►  04 Mar (1)
      • ►  02 Mar (1)
      • ►  01 Mar (1)
  • ►  2017 (10)
    • ►  June (10)
      • ►  26 Jun (2)
      • ►  25 Jun (4)
      • ►  24 Jun (1)
      • ►  23 Jun (1)
      • ►  07 Jun (1)
      • ►  02 Jun (1)
  • ►  2016 (1)
    • ►  July (1)
      • ►  12 Jul (1)
  • ▼  2011 (31)
    • ►  May (1)
      • ►  04 May (1)
    • ▼  April (29)
      • ▼  20 Apr (11)
        • reverse a list recursively and nonrecursively
        • remove a given node from a list
        • construct mirror of a given binary tree
        • check if a tree is a binary search tree (BST)
        • serialize and deserialize a binary tree
        • reverse a binary tree such that the child's left p...
        • print all root to leaf path of a binary tree
        • count unique binary trees those can be formed from...
        • find least common ancestor of a binary tree
        • find the maximum depth of a binary tree
        • find the size of a tree
      • ►  19 Apr (18)
    • ►  February (1)
      • ►  11 Feb (1)

About Me

Swetank
View my complete profile

My Blog List

  • Curiosity of Technology
    Few Strategy Mistakes Companies Make
    12 years ago

Labels

TRIE (1) algorithm (19) array (5) data structure (16) dictionary (1) heapsort (1) inorder (1) kth smallest (1) linked list (3) matrix (1) maximum length of spaces (1) maximum sum sub array (1) mergesort (1) pattern search (3) quicksort (2) random numbers (1) remove duplicates (1) searching (1) sorted insert (1) spiral print (1) string (3) substring (1) traversal (1) word search (1)
Simple theme. Powered by Blogger.