Here you will find more than 50000 job interview questions

Job Questions Search Engine


Sponsored Links

Advantages and disadvantages of B-star trees over Binary trees?

August 5, 2010 by bigboss · Leave a Comment
Filed under: Algorithm Interview Questions 

One of the basic question algorithm and data structure problem which is asked in the algorithm questions.  B-star trees have better data structure and are faster in search than Binary trees, but it is more complex than simple binary tree and very hard to maination the B-star treee data structure.

Write a C program to compute the depth of a binary tree?

July 1, 2010 by bigboss · Comments Off
Filed under: Binary Tree Interview Questions 

maxDepth function would take root node as the input  and return the depth of the tree. Its the recursive programming solution to find the depth of the tree

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

Write a program to create mirror of a binary tree

July 1, 2010 by bigboss · Comments Off
Filed under: Binary Tree Interview Questions 

Binary Tree Job Interview Questions

This resursive C code will create a new binary tree which would be the mirror copy of the previous binary tree.
mynode *copy(mynode *root)
{
mynode *temp;

if(root==NULL)return(NULL);

temp = (mynode *) malloc(sizeof(mynode));
temp->value = root->value;

temp->left = copy(root->right);
temp->right = copy(root->left);

return(temp);
}

This code will will only print the mirror of the tree

  • Categories

    |
  • Tags

    ADO.NET Questions Algorithm Questions ASP.NET Questions auto_ptr Binary tree questions C++ Constructor Interview Questions C++ Questions CISCO Exams Questions Common Interview Questions Core Java Interview Questions Csharp Questions datastructure questions Delphi 6 find command gdb interview questions grep interview questions IBM certification exams questions Infosys Puzzles Java Struts Linked List Problem Linux Command Questions List Manager Interview Questions Markov Algorithm memory leakage mysql Interview Questions Normalization Oracle Application Developer Certification Exam Interview Questions Oracle Questions Perl Questions PHP Questions Pointers Interview Questions PostgreSQL Database Questions pthread interview questions Smart Pointer Solaris Interview Questions SQL SERVER Interview Questions STL STL Map Symbian OS Tricky Interview Questions Unix Interview Questions unix shell Vector Windows OS Questions