[algogeeks] Experience

2011-09-26 Thread rShetty
Experiences, Technical and HR Questions and more of RVCE Information
Science students in Campus Placements 2011.

https://docs.google.com/document/d/1k5O1ijA-4M5pwxcvMhOYMFtWnJVoV5PM7aoF987SLhU/edit?hl=en_US

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] IP Address

2011-09-05 Thread rShetty
Which is the data Structure used to store the IP addresses in a
network ?
Please Elaborate?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Hexadecimal to Decimal

2011-09-01 Thread rShetty
Given a Hexadecimal value as a string, give a C Code to convert it
into decimal value?
If 0xff then output should be 255.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] String Reverse

2011-08-29 Thread rShetty
Give an algorithm/C Code to reverse a string using a recursive
function without swapping or using any extra memory?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Doubt !!!!!!

2011-08-14 Thread rShetty
Please explain this ...

#include
int main()
{
 int *p[10];
 printf("%d",sizeof(*p));
 return 0;
}

Output is 4

For this program 

#include
int main()
{
 int *p[10][20];
 printf("%d",sizeof(*p));
 return 0;
}

Output is 80 (10*20*sizeof(int))

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Tree Objective Quiz

2011-08-11 Thread rShetty
This question is already discussed,please search the group before
asking questions ..

https://groups.google.com/group/algogeeks/browse_thread/thread/2597c9730a43977b

Thank you

On Aug 11, 10:46 pm, Mani Bharathi  wrote:
> A complete n- array tree in which each node has n children or no children,
> let i be the number of internal nodes and L be the number of leaves in a
> complete n- array tree. If L=41 and i=10 what is the value of n.
>
> a. 3    b. 6   c. 4

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Trees

2011-08-11 Thread rShetty
 A complete n- array tree in which each node has n children or no
children, let i be the number of internal nodes and L be the number of
leaves in a complete n- array tree. If L=41 and i=10 what is the value
of n.

a. 3b. 6   c. 4


How to solve such problems??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Hash

2011-08-11 Thread rShetty
A hash table can store a maximum of 10 records, currently there are
records in location 1, 3,4,7,8,9,10. The probability of a new record
going into location 2, with hash functions resolving collisions by
linear probing is
a. 0.1b. 0.6  c. 0.2  d. 0.5

I think the answer is 0.6
What do you think?
Correct me If I am Wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Normalised !!

2011-08-07 Thread rShetty
How is floating number 5.375 represented in memory . What is the
normalised form of the number 5.375 .
The normalised form of 5.375 is

0100  1010 1100  

How it is done.Explanation?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: address calculation

2011-08-06 Thread rShetty
@all : I Think the output depends on whether it is row major or column
major representation in memory .
 Does he row major or column major representations matter
in calculations above???

On Aug 6, 11:49 pm, aditi garg  wrote:
> oh @ akshay y ru doing 10x4??? 10 is the no of rows not the columns so it
> shud be 15x3+4...and by multiplying by 4(in 10x4) ur taking it to the 5th
> row ie A[4][4] its only A[3][4]...
> i hope its clear now
>
> On Sun, Aug 7, 2011 at 12:14 AM, akshay khatri 
> wrote:
>
>
>
>
>
>
>
>
>
>
>
> > On 6 August 2011 23:56, aditi garg  wrote:
>
> >> @akshay: what i meant ws suppose the array strted from  in
> >> decimal...so A[3][4] wud be at 0049 and B[3][4] will be at 0196
> >> convert dese 2 values to hex it gives 31 and C4 respectively...now base
> >> address is 1000 and 2000 instead if  so add the base address and u get
> >> the ans 1031 and 20C4...i hope its clear now...
>
> > I still don't get how you got the figures of 49 and 196
>
> > I calculated as follows
> > A[3][4] = 10x4 + 4 = 44 bytes
> > B[3][4] = (10x4 + 4 )x4 = 176
>
> >> On Sat, Aug 6, 2011 at 11:49 PM, akshay khatri  >> > wrote:
>
> >>> On 6 August 2011 23:40, aditi garg  wrote:
>
>  A[3][4] wud be in the 4th row...so strtung address of 4th row wud be
>  46..and thn 4th element wud be at 49...similarly fr B 180 fr the frst 3 
>  rows
>  + 16 fr the 4th elemnet so 196
>
> >>> How does it start from 46 and 180 ?
> >>> as per my knowledge, 0x1000 = 4096 and 0x2000 is 8192
>
>   On Sat, Aug 6, 2011 at 11:37 PM, akshay khatri <
>  akshaykhatri...@gmail.com> wrote:
>
> > how is that 49 bytes and 196 bytes
> > shouldn't it be 44 and 176 bytes respectively
>
> > On 6 August 2011 23:26, Ram Chauhan  wrote:
>
> >> 1049 and 1098
>
> >> On Sat, Aug 6, 2011 at 11:09 PM, aditi garg <
> >> aditi.garg.6...@gmail.com> wrote:
>
> >>> CHAR A[10][15] AND INT B[10][15] IS DEFINED
> >>> WHAT'S THE ADDRESS OF A[3][4] AND B[3][4]
> >>> IF ADDRESS OF A IS OX1000 AND B IS 0X2000
>
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google
> >> Groups "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google
> > Groups "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
>  --
>  Aditi Garg
>  Undergraduate Student
>  Electronics & Communication Divison
>  NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
>  Sector 3, Dwarka
>  New Delhi
>
>   --
>  You received this message because you are subscribed to the Google
>  Groups "Algorithm Geeks" group.
>  To post to this group, send email to algogeeks@googlegroups.com.
>  To unsubscribe from this group, send email to
>  algogeeks+unsubscr...@googlegroups.com.
>  For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >> --
> >> Aditi Garg
> >> Undergraduate Student
> >> Electronics & Communication Divison
> >> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> >> Sector 3, Dwarka
> >> New Delhi
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@go

[algogeeks] Circle

2011-08-05 Thread rShetty
Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without
making use of any floating point
computations at all.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Reverse Bits

2011-08-05 Thread rShetty
This is the code to reverse the bits in an unsigned integer .
Could anyone please explain the logic of this approach ? Thank You !!

#define reverse(x) \
(x=x>>16|(0x&x)<<16, \
x=(0xff00ff00&x)>>8|(0x00ff00ff&x)<<8, \
x=(0xf0f0f0f0&x)>>4|(0x0f0f0f0f&x)<<4, \
x=(0x&x)>>2|(0x&x)<<2, \
x=(0x&x)>>1|(0x&x)<<1)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] MS

2011-08-05 Thread rShetty
You're given an array containing both positive and negative integers
and required to find the sub-
array with the largest sum (O(N) a la KBL). Write a routine in C for
the above

Is this problem as simple as just adding the positive numbers with the
subarray with largest sum being the set of positive numbers in the
array .
Or is there any complications , please explain

Thankyou

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Malloc()

2011-08-02 Thread rShetty
Could anyone provide an algorithm/code and explanation for
implementation of malloc() in C .

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: FB intern

2011-07-30 Thread rShetty
@amol and saurabh : How exactly is that formula derived for this
problem ?
I need to know the method to evaluate such problems in the future .
Thank you

On Jul 30, 1:13 pm, saurabh singh  wrote:
> Thanx mate...You rock.:)
>
>
>
>
>
>
>
>
>
> On Sat, Jul 30, 2011 at 1:40 PM, Amol Sharma  wrote:
> > i think saurabh you wanted to say this --
>
> > x^n=pow(x^n/2)*pow(x^n/2)*(x^(*n*mod2))
> > --
>
> > Amol Sharma
> > Third Year Student
> > Computer Science and Engineering
> > MNNIT Allahabad
>
> > On Sat, Jul 30, 2011 at 1:10 PM, Ankur Khurana 
> > wrote:
>
> >> use divide and conquer  . logm complexity . . .
>
> >> On Sat, Jul 30, 2011 at 1:09 PM, saurabh singh wrote:
>
> >>> o(log n)
> >>> x^n=pow(x^n/2)*pow(x^n/2)*(x^mod2)
>
> >>> the base case pow(x,1)=x  pow(x,0)=1
>
> >>> On Sat, Jul 30, 2011 at 1:02 PM, arvind kumar wrote:
>
>  Find the least time complexity algorithm(most efficient algo) to find
>  x^m(x to the power of m)..Facebok intern interview question!
>
>  --
>  You received this message because you are subscribed to the Google
>  Groups "Algorithm Geeks" group.
>  To post to this group, send email to algogeeks@googlegroups.com.
>  To unsubscribe from this group, send email to
>  algogeeks+unsubscr...@googlegroups.com.
>  For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
> >>> --
> >>> Saurabh Singh
> >>> B.Tech (Computer Science)
> >>> MNNIT ALLAHABAD
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >> --
> >> Ankur Khurana
> >> Computer Science
> >> Netaji Subhas Institute Of Technology
> >> Delhi.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Small Doubt

2011-07-27 Thread rShetty
Usually when I declare a variable it will be stored in memory location
with some address .
Such as  consider I declare int x=10 , it will stored in some address
1003 (say).
Now my question is can I control the address being assigned to a
variable in C . Say, I want to store x in address in 4000 and not in
1003 defined by the compiler .(Usually this can be done in assembly).
Can I do that ? Correct me If i am wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: write an scanf that reads only a to z charchter.............

2011-07-26 Thread rShetty
scanf("%[^a-z]",z);

On Jul 27, 12:13 am, TUSHAR  wrote:
> write an scanf that reads only a to z charchter.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Closest as Possible

2011-07-26 Thread rShetty
Problem statement goes as :

Consider square root of integers form 1 to 100. Now partition the
square roots of integers as being from 1 to 50 and 51 to 100.
Now find the sum in the two partitions which is as close as possible
or minimum?
Give the algorithm ?? and das structures to be used??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] atoi()

2011-07-23 Thread rShetty
Give an algorithm to implement an atoi() function ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Sorting in O(n)

2011-07-22 Thread rShetty
How to sort Linked lists in O(n) time ??
Give the algorithm or the explanation or clue to tackle the problem

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Circular list

2011-07-22 Thread rShetty
SO what about If my Linked list is a sorted list and the new node I
wanna insert must maintain that sorted nature , So can then be the
insertion of a node be done in constant time without traversing the
list ??

On Jul 23, 12:26 am, Pankaj  wrote:
> If you know circular list, what is avoiding you from maintaining a tail
> pointer.
> You just need to tweak insert and delete function a little bit for corner
> cases.
>
>
>
>
>
>
>
> On Sat, Jul 23, 2011 at 12:50 AM, rShetty  wrote:
> > Algorithm Please ... Thank You
>
> > On Jul 23, 12:17 am, vaibhav shukla  wrote:
> > > maintain just a tail pointer
>
> > > On Sat, Jul 23, 2011 at 12:45 AM, rShetty  wrote:
> > > > Come Up with an Algorithm to implement the insertion of a node in
> > > > circular linked list without actually traversing the list ?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Algorithm Geeks" group.
> > > > To post to this group, send email to algogeeks@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > algogeeks+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/algogeeks?hl=en.
>
> > > --
> > >   best wishes!!
> > >     Vaibhav
> > >       MCA
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Circular list

2011-07-22 Thread rShetty
So we should maintain a tail pointer and add nodes next to the tail
pointer ??? Right ???

On Jul 23, 12:26 am, Pankaj  wrote:
> If you know circular list, what is avoiding you from maintaining a tail
> pointer.
> You just need to tweak insert and delete function a little bit for corner
> cases.
>
>
>
>
>
>
>
> On Sat, Jul 23, 2011 at 12:50 AM, rShetty  wrote:
> > Algorithm Please ... Thank You
>
> > On Jul 23, 12:17 am, vaibhav shukla  wrote:
> > > maintain just a tail pointer
>
> > > On Sat, Jul 23, 2011 at 12:45 AM, rShetty  wrote:
> > > > Come Up with an Algorithm to implement the insertion of a node in
> > > > circular linked list without actually traversing the list ?
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Algorithm Geeks" group.
> > > > To post to this group, send email to algogeeks@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > algogeeks+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/algogeeks?hl=en.
>
> > > --
> > >   best wishes!!
> > >     Vaibhav
> > >       MCA
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Circular list

2011-07-22 Thread rShetty
Algorithm Please ... Thank You

On Jul 23, 12:17 am, vaibhav shukla  wrote:
> maintain just a tail pointer
>
> On Sat, Jul 23, 2011 at 12:45 AM, rShetty  wrote:
> > Come Up with an Algorithm to implement the insertion of a node in
> > circular linked list without actually traversing the list ?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
>   best wishes!!
>     Vaibhav
>       MCA

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Circular list

2011-07-22 Thread rShetty
Come Up with an Algorithm to implement the insertion of a node in
circular linked list without actually traversing the list ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Printf evaluation

2011-07-22 Thread rShetty
#include

 int main()
 {

int i=1;
printf("%d%d%d%d",++i,++i,++i,i++);

 return 0;

}

Explain how it will be evaluated ?? and the output obtained ..

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Multiply 2 nos...

2011-07-21 Thread rShetty
@ankit Could you please explain your code and the logic behind ...
Thank You

On Jul 21, 6:22 pm, ankit sambyal  wrote:
> int add(int x, int y)
> {
>    int c;
>    while(y)
>    {
>        c = x & y;
>        x ^= y;
>        y = c << 1;
>    }
>    return(x);}
>
> int mult(int x, int y)
> {
>    int p = 0, s = y;
>    if(y < 0) y = add(~y,1);
>    while(y)
>    {
>        if(y & 1) p = add(x, p);
>        x <<= 1;
>        y >>= 1;
>    }
>    if(s < 0) p = add(~p,1);
>    return(p);
>
>
>
>
>
>
>
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: How can we find size of system stack in C

2011-07-21 Thread rShetty
You can try recursively calling main() function and keep a count and
then find the count value just before the stack overflow condition.
Then multiply count with the size of the  memory used in one recursive
call . Guys does this work ???

On Jul 21, 7:04 pm, Deoki Nandan  wrote:
> --
> **With Regards
> Deoki Nandan Vishwakarma
>
> *
> *

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Printf ...

2011-07-14 Thread rShetty
#include
int main()
{
 char str[] = "Zingle Bell Zingle Bell";
 printf("%.#s %.2s\n",str,str);
 return 0;
}

I need the help to figure out the output of the program and please
expalin the behaviour of the printf statement here ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Output ( File Handling)

2011-07-14 Thread rShetty
// File Handling
#include
#include
int main()
{
 unsigned char ch; // I think there is problem somewhere in this
line ! Help !!
 FILE *fp;
 fp = fopen("abc","r");
 if(fp==NULL)
 {
  printf("Unable to Open");
  exit(1);
 }
 while((ch = getc(fp)!=EOF))
  printf("%c",ch);
 fclose(fp);
 printf("\n",ch);
 return 0;
}

abc contains some text such as "Kicit 44-1 Gokul;peth\0 nagpur"

What should be the output of the program ??
Explain the solution !!

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] MS Interview

2011-07-12 Thread rShetty
Given a very big file of words, a word in each line, sort the words .
Please provide the algorithm and explanation .

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Bit Twiddles

2011-07-11 Thread rShetty
Some more Explanation of the working would be helpful

Thank You ..

On Jul 11, 11:11 pm, Dave  wrote:
> Assuming that the integer is 32 bits, this is pretty good:
>
> x = (x & 0x) +  ((x >> 1) & 0x);
> x = (x & 0x) +  ((x >> 2) & 0x);
> x = (x & 0x0F0F0F0F) +  ((x >> 4) & 0x0F0F0F0F);
> x = (x & 0x00FF00FF) +  ((x >> 8) & 0x00FF00FF);
> x = (x & 0x) +  ((x >> 16) & 0x);
>
> Notice that the hex constants are respectively alternate bits,
> alternate pairs of bits, alternate groups of four bits, alternate
> bytes, and the low-order half of the int.
>
> The first statement determines the number of one-bits in each pair of
> bits. The second statement adds adjacent pairs of bits to get the
> number of bits in each group of four bits. Then these are added to get
> the number of bits in each byte, short int, and finally in the whole
> int.
>
> Dave
>
> On Jul 11, 12:44 pm, rShetty  wrote:
>
>
>
>
>
>
>
> > What is the most efficient algorithm to count the number of bits in an
> > unsigned integer ?
> > Explain your approach to the problem ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Bit Twiddles

2011-07-11 Thread rShetty
What is the most efficient algorithm to count the number of bits in an
unsigned integer ?
Explain your approach to the problem ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Precedence of operators

2011-07-10 Thread rShetty
Got it Thanks .

On Jul 10, 10:40 pm, vaibhav shukla  wrote:
> associativity comes into play when operators are of same precedence.
>
> On Sun, Jul 10, 2011 at 11:08 PM, vaibhav shukla 
> wrote:
>
>
>
>
>
>
>
>
>
> > && has higher precedence than ||
> >  the expression is evaluated as
> > z=j || ( k && i );
> > hence the output i.e 1 ;)
>
> > On Sun, Jul 10, 2011 at 11:06 PM, rShetty  wrote:
>
> >> #include
> >> int main()
> >> {
> >>  int i=0,j=1,k=1,z=0;
> >>  z = j || k  && i ;
> >>  printf("%d",z);
> >>  return 0;
> >> }
>
> >> The output is 1 for the above program .
>
> >> But according to associativity of logical operators , the evaluation
> >> should be from left to right , But is it taking from right to left ?
> >> What is the exact concept for the program behavior above?
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> > --
> >   best wishes!!
> > Vaibhav Shukla
> >     DU-MCA
>
> --
>   best wishes!!
> Vaibhav Shukla
>     DU-MCA

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Precedence of operators

2011-07-10 Thread rShetty
#include
int main()
{
 int i=0,j=1,k=1,z=0;
 z = j || k  && i ;
 printf("%d",z);
 return 0;
}

The output is 1 for the above program .

But according to associativity of logical operators , the evaluation
should be from left to right , But is it taking from right to left ?
What is the exact concept for the program behavior above?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Explanation

2011-07-07 Thread rShetty
#include
#include
int main()
{
 char str[]="This is rajeev\n";
 char str1[10];
 memset(str,'0',4);
 printf("%s",str);
 memcpy(str1,str,10);
 printf("\n this is string 1\n");
 printf("%s\n",str1);
 return 0;
}

Output is :

 is rajeev

 this is string 1
 is ra is rajeev


it copies 10 characters from str to str1 so the printing  is ra is
Ok what abt the repeating result?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Test Cases

2011-07-01 Thread rShetty
#include


int findMax(int *arr , int len)
{
 int i;
 int max = arr[0];
 for(i=0;i=max)
   max= arr[i];
  }
  printf("%d\n",max);
return max;
}


int findMin(int *arr ,int len)
{
 int min,i;
 for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Cisco Question

2011-06-27 Thread rShetty
@Dave Thank You very much :)

On Jun 27, 8:48 pm, piyush kapoor  wrote:
> thanks a lot for the wonderful explanation :-)
>
>
>
>
>
>
>
>
>
> On Mon, Jun 27, 2011 at 7:17 PM, Dave  wrote:
> > @Rajeev and Piyush: Numbering the bits from the right starting with 0
> > as usual, you see that you need to move the even-numbered bits one bit
> > to the left and the odd-numbered bits one bit to the right. You could
> > do this one bit-pair at a time, but it would be more efficient if you
> > could do all pairs simultaneously. So how can you pick out all of the
> > even-numbered bits at the same time? By using the logical and of the
> > data with a mask that has 0s in the odd bit positions and 1s in the
> > even bit positions. I.e., anding x with 01010101 in binary, which is
> > 0x55 in hexadecimal. Once you have isolated the even numbered bits,
> > you shift them left one place. The result is (x & 0x55) << 1.
> > Similarly, you want to isolate the odd-numbered bits and shift them
> > right one place. You could do that by anding with the mask 10101010
> > (binary) = 0xAA, and then shifting right: (x & 0xAA) >> 1. This
> > introduces another constant, which might not be as efficient as
> > reusing the previous constant 0x55, which can be done by shifting
> > right first and then anding: (x >> 1) & 0x55. Now that we have the two
> > sets of bits in the correct positions, we simply need to combine them,
> > and the logical or operator does that just fine. The overall result is
> > (x & 0x55) << 1) | ((x >> 1) & 0x55).
>
> > Dave
>
> > On Jun 27, 7:53 am, piyush kapoor  wrote:
> > > Yep,I also want to know the same..
>
> > > On Mon, Jun 27, 2011 at 6:23 PM, rajeev bharshetty  > >wrote:
>
> > > > @ Dave How to think about the answer to the above question . I mean How
> > do
> > > > I tackle such problems ?
>
> > > > On Mon, Jun 27, 2011 at 6:17 PM, Dave  wrote:
>
> > > >> y = ((x & 0x55) << 1) | ((x >> 1) & 0x55).
>
> > > >> Note, 0x55 = 01010101 in binary.
>
> > > >> Dave
>
> > > >> On Jun 27, 7:18 am, rShetty  wrote:
> > > >> > Given a byte, write a code to swap every two bits. [Using bit
> > > >> > operators]
>
> > > >> >  Eg: Input: 10 01 11 01 Output: 01 10 11 10
>
> > > >> --
> > > >> You received this message because you are subscribed to the Google
> > Groups
> > > >> "Algorithm Geeks" group.
> > > >> To post to this group, send email to algogeeks@googlegroups.com.
> > > >> To unsubscribe from this group, send email to
> > > >> algogeeks+unsubscr...@googlegroups.com.
> > > >> For more options, visit this group at
> > > >>http://groups.google.com/group/algogeeks?hl=en.
>
> > > >  --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Algorithm Geeks" group.
> > > > To post to this group, send email to algogeeks@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > algogeeks+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/algogeeks?hl=en.
>
> > > --
> > > *Regards,*
> > > *Piyush Kapoor,*
> > > *CSE-IT-BHU*- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *CSE-IT-BHU*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Reverse

2011-06-27 Thread rShetty
Reversing a String without using a temporary variable ?


Rajeev N B

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Cisco Question

2011-06-27 Thread rShetty
Given a byte, write a code to swap every two bits. [Using bit
operators]

 Eg: Input: 10 01 11 01 Output: 01 10 11 10

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Office Suite

2011-06-25 Thread rShetty
Suggest the most efficient Data Structures and algorithms to implement
Undo and Redo operations in any of the Office Suites ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: can void pointer be incremented

2011-06-24 Thread rShetty
http://techbrother.blogspot.com/2007/11/incrementing-void-pointer.html

Regards

Rajeev N B

On Jun 24, 6:29 pm, RITESH SRIVASTAV  wrote:
> C standard doesn't say anything about void pointer increment.
> If you will do sizeof(void) ,I guess your gcc compiler will give you 1
> as output.
> In C, for compatibility with the old implementation (where void * were
> used in place of char * and vice-versa)
> doing this will not result in error on some compilers.
> Result is undefined and you should avoid depending upon them.
>
> On Jun 24, 6:01 pm, himanshu kansal 
> wrote:
>
>
>
>
>
>
>
> > one more...gcc allows void ptr to be assigned to and frm any type of ptr w/o
> > any cast
> > bt vc gvs an error and requires an explicit cast...
> > whots d specifications abt ds as conforming to c standards..
> > On Fri, Jun 24, 2011 at 6:25 PM, himanshu kansal <
>
> > himanshukansal...@gmail.com> wrote:
> > > can v increment d void pointer
> > > its perfectly valid on gcc
> > > bt it gives me an error on vc
> > > so is it allowed by c standard or its an extension provided by gnu???
>
> > --
>
> >       Regards
> > Himanshu Kansal
> >   Msc Comp. sc.
> > (University of Delhi)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Algorithmic Pioneers

2011-06-24 Thread rShetty
I Have Updated :)

On Jun 24, 11:45 am, radha krishnan 
wrote:
> Include Euler !!!
>
> On Fri, Jun 24, 2011 at 12:11 PM, Vishnutej Mylavarapu <
>
>
>
>
>
>
>
> mylavarapu.vishnu...@gmail.com> wrote:
> > You can add AC Rush too..
>
> > On Fri, Jun 24, 2011 at 11:27 AM, rajeev bharshetty 
> > wrote:
>
> >> @ankit Thanks for the suggestion , I ahve Updated to include petr
> >> Mitrichev :)
>
> >> On Fri, Jun 24, 2011 at 11:19 AM, ankit sablok wrote:
>
> >>> very nice man nice collection add Petr Mitrichev to this collection
>
> >>> On Fri, Jun 24, 2011 at 11:14 AM, rShetty  wrote:
>
> >>>> Collection of Algorithmic Pioneers can be Found here
>
> >>>>http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-an...
>
> >>>> Suggestion for addition of more Pioneers are welcome .
>
> >>>> --
> >>>> You received this message because you are subscribed to the Google
> >>>> Groups "Algorithm Geeks" group.
> >>>> To post to this group, send email to algogeeks@googlegroups.com.
> >>>> To unsubscribe from this group, send email to
> >>>> algogeeks+unsubscr...@googlegroups.com.
> >>>> For more options, visit this group at
> >>>>http://groups.google.com/group/algogeeks?hl=en.
>
> >>>  --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/algogeeks?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/algogeeks?hl=en.
>
> > --
>
> > *-Vishnutej Mylavarapu.*
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Algorithmic Pioneers

2011-06-23 Thread rShetty
Collection of Algorithmic Pioneers can be Found here

http://openprobe.blogspot.com/2011/06/pioneers-in-algorithm-deisgn-and.html

Suggestion for addition of more Pioneers are welcome .

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.