vikaskupushkar
BAN USER
- 1of 1 vote
Answersgiven a range of number 1 through N, where N >=3. you have to take an array of length 2N and place each number ( from the range 1 to N) twice. such a that the distance between two indexes of a number is equal to the number. example
- vikaskupushkar in India
N=3
( 3, 1, 2, 1, 3, 2 )
I know we can Use Backtracking but is there any other solution.| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm - -1of 1 vote
Answersyou are given an array or length 1million and rang of value from 0-m ... count the number of accurance of each number.
- vikaskupushkar in India for SRPG
#2 the same array as above. find out the distance between min and max.
#3 write a malloc function.
and some theoretical Qs on routing Table.
There was one stupid guys who asked me given a binary tree and a depth of the tree print all the nodes in that tree on that depth.
when i used inserted a NULL node in my code he said it wont work as the value of NULL is 0 its not a pointer.... bla boa.... i was shocked that a guy who has code to take 3rd round of interview is saying these kind of thing :D..... there was one more thing that he said that in 'C' u cant declare a variable after the initial declaration in func tion body I said yes we should not but Now a days c compilers like gcc etc allows it ... god know he ever used gcc or not but he denied it 3 time..... really bad experience| Report Duplicate | Flag | PURGE
Alcatel Lucent Software Engineer / Developer Algorithm - 0of 2 votes
AnswersHow can you tell if your system is little endian or big endian?
- vikaskupushkar in United States| Report Duplicate | Flag | PURGE
Qualcomm Developer Program Engineer Computer Architecture & Low Level
take one variable with value 1.. shift it by 2 if it comes greater than 1 that lil endian if comes 0 then big.. if it comes 1 than check your shifting is wrong ;)
- vikaskupushkar March 06, 2013
Lil endia-> MSB to LSB are kept at high to lower memory address
- vikaskupushkar March 13, 2013big endian-> MSB to LSB are kept at lower to higher address location
Let's say a=0xAB FE CD FF
1002 | 1003 | 1004 | 1005
----------------------------------------------------------------------------
Big Endian FF CD FE AB
Lil Endian AB FE CD FF
-----------------------------------------------------------------------------
Endian means the byte ordering;
$ echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6 is the command to knw endianness of system
If it gives 0 then big if 1 then lil