Mar 31, 2010

Tree b is the subset of Tree a

Given a node of a tree
typedef struct node
{
int info;
struct node *left,*right;
}
node;

Given the function prototype is

 bool isSubset(node *a,node *b);

Write the C code to implement the function.

Counting set bits

Can you suggest the way to count the bits that are set in the number?

Find the maximum of three

Though it may appear very trivial, but what is now so special about finding maximum of 3 numbers is that no comparison or relational operator is to be used. See if you can go for it.

C: What is the use of stderr?

In the C, error or other messages can be displayed by using printf or by using file stdout. Then what is the need of stderr? Why it is so special to display error using stderr file pointer?

Removing ab patterns

Given a string of containing alphabets. Task is to remove ab patterns in linear time using inline algorithm.

e.g. cdaabbcd gives the output cdcd after the execution of the algorithm.

Mar 29, 2010

Rotating triads of a linked list

Given a linked list a>b>c>d>e>f. We need to rotate each triad. e.g. c>b>a>f>e>d. However data is so large that its movement is a costly operation in terms of memory as well as time. Write a C code to preform the task.

Tries

Tries is a data structure used to show some keys in the tree rather than in the string array. List some advantages and how it can be compressed.

Dynamic Link library Problem : Microsoft technical interview question

Consider a DLL containing a substantial number of functions. Few functions from it are shipped. It is given that which function call which one. Design an algorithm to remove unused function from the DLL. Means main objective is to detect unused function.

Mar 28, 2010

Few C puzzles

1. What's the difference between the 
following two C statements?
  const char *p;
  char* const p; 
 
 
2. Write a C function which does the addition of two integers
without using the '+' or '-' operator. 
 
 
3. The following is the macro implementation of the famous, Triple xor
swap.
  #define SWAP(a,b) ((a) ^= (b) ^= (a) ^= (b))

What are the potential problems with the above macro?
 

Welcome to this blog

Hello friends

This is the blog for the fun purpose to discuss technical stuff related to Computer Science. If you have any query/answer, do not hesitate to post here. However, please adhere to the few good rules.
These are
1. Use decent language
2. Do not annoy anyone.
3. Respond properly
4. Do not comment unnecessarily

And it is being loaded