Does anybody know's Why the Value is like this So... Seems simple but when
I decoded it.. its very interesting... U all should look into this simple
question which can reveal some internal manipulation.
Good One !!!
BR,
Prem
On Thu, Jun 7, 2012 at 1:13 AM, Garima Mishra garima9...@gmail.com
Is there any online compiler which gives output for both little/big endian
machines ?
or it is fine to convert value from one form to another using a small c
program ?
On Thu, Jun 7, 2012 at 1:13 AM, Garima Mishra garima9...@gmail.com wrote:
556 if the machine is little endian
258 if machine
please share the link.
thanks
Rajesh
On Thu, Jun 7, 2012 at 1:44 AM, Prakhar Jain jprakha...@gmail.com wrote:
@abhishek...Plz share the link here.Thanks
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
@prem, i don't get it.could you please elaborate the interesting part of
this solution ?
On Thu, Jun 7, 2012 at 11:39 AM, Abhishek Sharma abhi120...@gmail.comwrote:
Is there any online compiler which gives output for both little/big endian
machines ?
or it is fine to convert value from one
Try decode how the final value of 556 or 228 end up there.. it alwayz
compiles to those values .. try finding how compiler end up to these
values..
On Thu, Jun 7, 2012 at 12:53 PM, Abhishek Sharma abhi120...@gmail.comwrote:
@prem, i don't get it.could you please elaborate the interesting part
oh ,now i see. 300 = 000100101100
first 8 bits = 0001
last 8 bits = 00101100
in case of big-endian machine, when we assign 2 to next location, last 8
bits become 0010 (2 in decimal), first 8 bits remain same.
in case of little-endian machine, when we assign 2 to next location, last 8
i=300 // binary = 0001 00101100
// in case of little Endien
it will be saved like this :-
0001
00101100
//suppose int = 2 bytes and char = 1 byte
char *ptr = i; // take care it *char *ptr* not *int* **ptr*so what
will happen
*ptr will be pointing to 00101100
*++ptr // now ptr is
@Abhishek : correct
On Thu, Jun 7, 2012 at 1:03 PM, Abhishek Sharma abhi120...@gmail.comwrote:
oh ,now i see. 300 = 000100101100
first 8 bits = 0001
last 8 bits = 00101100
in case of big-endian machine, when we assign 2 to next location, last 8
bits become 0010 (2 in
#includestiod.h
int main(void)
{
int i=0xff00ff11;
printf(%x\n, i);
i = htonl(i);
printf(%x\n, i);
}
I feel endianness better explained by this code
In networking domain , this has importance . This code segment is used when
a data is planning to send a big endian machine from a
Well Thanks Rajni but I don't see any BETTER EXPLANATION of endianess here
, as you are completely relying on library function like htonl() to provide
data manipulation for you. The use case mentioned is absolutely valid and
very promising although.
Yeah both guys are on the spot .. :)
Br,
Prem
What are the specs of the car. Can you please give the answer to the
following clarifying questions:
- How much distance is it suppose to travel without the driver?
- Is it suppose to run on smooth roads only or can it also run on roads
with jumps on it? On what type of road is the car most
Same endian concepts comes into picture but some 1 explain why obj.ch[0] =
-1 not 255 ??
Code -
#include stdio.h
int main()
{
union s
{
int i;
char ch[2];
};
union s obj;
obj.i=255;
printf(%d %d %d\n,obj.i,obj.ch[0],obj.ch[1]);
}
--
You
A: 556
--
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
Guys is this book useful for cracking interviews??
On Mon, Jun 4, 2012 at 1:31 AM, Dhaval Moliya moliyadha...@gmail.comwrote:
If any one have algorithms for interviews by adnan aziz ebook... Please
mail ...
Thanks
--
You received this message because you are subscribed to the Google Groups
yes,it is helpful,but read it only if u have fully understood Introduction
to algorithms or if u have strong foundation of algorithms/data structures
On Thu, Jun 7, 2012 at 12:37 PM, BUBUN SHEKHAR dce.stu...@gmail.com wrote:
Guys is this book useful for cracking interviews??
On Mon, Jun 4,
Hahaha.. Xcellent question Dude.. People Who Know can easily explain.. So
for who don't here it is..
It has nothing to do with Endianess Mr.Yogesh.. Actually the bit patter
happens to be reside such that ob.ch[0] fills with all ones ..
Now as we knw the sign bit concept , here compilers goes mad
http://users.ece.utexas.edu/~adnan/afi-samples.pdf
is dis wat u al r lukin 4??
On Thu, Jun 7, 2012 at 3:01 PM, Abhishek Sharma abhi120...@gmail.comwrote:
yes,it is helpful,but read it only if u have fully understood
Introduction to algorithms or if u have strong foundation of
algorithms/data
cracking interviews is what Microsoft suggests. I'm not sure about the
other one.
On Thu, Jun 7, 2012 at 2:58 PM, sengar.mahi sengar.m...@gmail.com wrote:
http://users.ece.utexas.edu/~adnan/afi-samples.pdf
is dis wat u al r lukin 4??
On Thu, Jun 7, 2012 at 3:01 PM, Abhishek Sharma
Sign bit.
well i forgot abt that. Bro still nly 1 bit s taken for sign so nly 1 '1' s
taken as determining sign to be negative. Still we have 7 1's in hand.
Wat abt that ?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
please share the link !!
On Thu, Jun 7, 2012 at 3:01 PM, Abhishek Sharma abhi120...@gmail.comwrote:
yes,it is helpful,but read it only if u have fully understood
Introduction to algorithms or if u have strong foundation of
algorithms/data structures
On Thu, Jun 7, 2012 at 12:37 PM, BUBUN
please send me the download link @hi.ashish...@gmail.com.
..Thanks
On Thu, Jun 7, 2012 at 3:28 PM, sengar.mahi sengar.m...@gmail.com wrote:
http://users.ece.utexas.edu/~adnan/afi-samples.pdf
is dis wat u al r lukin 4??
On Thu, Jun 7, 2012 at 3:01 PM, Abhishek Sharma
First read a file of English words, one word per line, and then
another file, with a set of (possibly space separated) letters,
one set per line.
For each set in file 2, write out all valid anagrams of those
letters, from the words given in file 1.
For instance, if the letters in some
@yogeesh :
here is the reason why you are getting ch[0] = -1...bcozz
in your code.
#include stdio.h
int main()
{
union s
{
int i;
char ch[2]; // this is signed
};
}
char ch[2] is declared as signed oneso when compiler see that ch[]
is
The problem u are referencing is different one.. here u can move in all 4
directions!
On Wednesday, 6 June 2012 18:43:15 UTC+5:30, Dheeraj wrote:
http://www.geeksforgeeks.org/archives/14943
On Mon, Jun 4, 2012 at 7:57 PM, Decipher ankurseth...@gmail.com wrote:
@Victor - Someone had asked
The following is a simple C program which tries to multiply an integer by 5
using the bitwise operations. But it doesn't do so. Explain the reason for
the wrong behavior of the program.
#include stdio.h
#define PrintInt(expr) printf(%s : %d\n,#expr,(expr))
*int* FiveTimes(*int* a)
{
Good Question ,eagerly waiting for some good explanation to this one !!!
On Fri, Jun 8, 2012 at 5:46 AM, Mad Coder imamadco...@gmail.com wrote:
The following is a simple C program which tries to multiply an integer by
5 using the bitwise operations. But it doesn't do so. Explain the reason
one left shift is equivalent to multiplying with 2.Two left is equivalent
to multiplying with 2^2. and so on. so i left shift means multiplying with
2^i.
In your program you did left shift with 2.so it is equivalent to
multiplying with 4. so when input is 1 function will return 4*1+1=5. when
@Mahendra: for ur above code with t=(a2)+a o/p will be 5,10, 15 as i
explained above. without bracket answer will be 8 , 32 and 96 because +
precedence is higher than .
On Fri, Jun 8, 2012 at 7:31 AM, Mahendra Sengar sengar.m...@gmail.comwrote:
Cracked it...i guess precedence of + is more than
The idea here is that there will be parts of the stream which actually
should not be compressed. For example abcdef as well as aa do not need any
compression. We need to compress only if 3 characters match because for
compressing two chars we will take up 2 chars so no compression benefit (:
So
@victor: But if K = 1000, then the largest N you have to deal with is 4,
since 4^4 1000 but 5^5 1000. So your code looks like this:
int IsNtoNEqualK( int N, int K)
{
return (N==1)(K==1) || (N==2)(K==4) || (N==3){K==27) ||
(N==4)(K==256);
}
On Thursday, June 7, 2012 5:14:00 PM UTC-5,
30 matches
Mail list logo