Re: [algogeeks] swap objects without temp variable

2012-11-04 Thread atul anand
a=a^b;
b=a^b;
a=a^b;

need to check if a and b are equal or not , bcozz a^a =0

On Mon, Nov 5, 2012 at 2:02 AM, manish  wrote:

> Swapping two objects (not integers/chars),without using temp...?
> my solution is using xor operation..is that right and ny other solutions ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/OxVSnZ1QjzMJ.
> 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.



Re: [algogeeks] OS question..

2012-11-04 Thread Hanlei Qin
I think the answer to Q1 may "Yes".
Cause the virtual memory of program is limited, they need logically
contiguous memory, and have limit from OS and processor(32-bit, or
64-bit) yet.
I have no idea about Q2.


On Mon, Nov 5, 2012 at 4:30 AM, manish  wrote:
> Q1.  If we have infinite memory, then do we still be needing paging?
> Q2. Given only 8bits registers, you have to find average of 4 bit registers
> values without using any operation involving 16 bit calculations.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/iUT57I-DOHoJ.
> 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.



Re: [algogeeks] Re: swap objects without temp variable

2012-11-04 Thread Ashok Varma
Try this: a = a + b - (b = a); //single line code to swap



On Mon, Nov 5, 2012 at 4:53 AM, Dave  wrote:

> @Manish: Sure.
>
> a = a + b;
> b = a - b;
> a = a - b;
>
> In 2-s complement arithmetic, it works even if a + b overflows.
>
> Dave
>
> On Sunday, November 4, 2012 2:32:43 PM UTC-6, manish wrote:
>
>> Swapping two objects (not integers/chars),without using temp...?
>> my solution is using xor operation..is that right and ny other solutions ?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/nc5h3uIL65AJ.
>
> 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: swap objects without temp variable

2012-11-04 Thread Dave
@Manish: Sure. 
 
a = a + b; 
b = a - b; 
a = a - b;
 
In 2-s complement arithmetic, it works even if a + b overflows.
 
Dave

On Sunday, November 4, 2012 2:32:43 PM UTC-6, manish wrote:

> Swapping two objects (not integers/chars),without using temp...?
> my solution is using xor operation..is that right and ny other solutions ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/nc5h3uIL65AJ.
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] swap objects without temp variable

2012-11-04 Thread manish
Swapping two objects (not integers/chars),without using temp...?
my solution is using xor operation..is that right and ny other solutions ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/OxVSnZ1QjzMJ.
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] OS question..

2012-11-04 Thread manish
Q1.  If we have infinite memory, then do we still be needing paging?
Q2. Given only 8bits registers, you have to find average of 4 bit registers 
values without using any operation involving 16 bit calculations.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/iUT57I-DOHoJ.
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] Make File

2012-11-04 Thread Ashok Varma
Friends, Please clarify this.
What is a Make file ? & What is its use ?

-- 
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.