[algogeeks] is given number is lucky..?

2012-08-03 Thread Divesh Dixit
Write a funtion boolean is_lucky(int x ) {} a number is said to lucky http://en.wikipedia.org/wiki/Lucky_numbe... O(n) solution is required...? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. T

[algogeeks] MicroSoft Interview Question-9 February 2011

2011-02-09 Thread Divesh Dixit
1. write a function to convert a decimal no. to Roman no. (10 marks) 2. Design a elevators system for 50 storied hotel. condition are... at least one left should be available on ground flore. Min. time is expected ot reach the any floore... (5 marks) 3. Design all the test case for function

[algogeeks] Re: add two numbers using bitwise operators

2010-12-31 Thread Divesh Dixit
@rajeev it is a Full Adder (digital electronics) .. code.. On Dec 31, 6:05 pm, Manmeet Singh wrote: > Go through gates in Electronics, code will be easy to visualize. > > On Fri, Dec 31, 2010 at 6:33 PM, juver++ wrote: > > Yeah, add bits one by one from right to left, as for ordinary addition of

[algogeeks] Re: puzzle

2010-12-31 Thread Divesh Dixit
@vanadana why are you calculating 3 complete... use minimized distance.. min.{ sqrt(4^2+x^2)+sqrt(3^2+(5-x)^2)}; so final answer is 8.6023144 units.. On Dec 31, 4:30 pm, Vandana Bachani wrote: > The ant needs to cover: 9.403 units. It will need to pass the diagonal of > the side (4 by 5) and go

[algogeeks] C output... ???

2010-12-14 Thread Divesh Dixit
#define SIZE 10 void size(int arr[SIZE]) { printf("size of array is:%d\n",sizeof(arr)); } int main() { int arr[SIZE]; size(arr); return 0; } the out put should be 40 considering 4 byte integer... but out put is only 4... how this is possible...

[algogeeks] Swap the LSB and MSB within themself of given no.

2010-11-20 Thread Divesh Dixit
assuming all are 8bit no. input = 0x46 (0100 0110) output = 0x26 ( 0010 0110 ) input = 0x75 (0111 0101) output = 0xFC (1110 1010 ) Algorithm..??? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to alg

[algogeeks] Re: Algorithm to determine the largest number of envelopes that can be nested inside one another.

2010-09-29 Thread Divesh Dixit
@Sathaian Please explain "Then find the longest increasing sequence of yi's -> nlog(n) " how to find this...?? Ex. (1,2) (2,13) (5,10) (7,9)(9,1) xi are sorted what will be the algo.. next?? On Sep 29, 8:55 am, Sathaiah Dontula wrote: > I think we can do like this, > > 1. Sort all t

[algogeeks] Algorithm to determine the largest number of envelopes that can be nested inside one another.

2010-09-28 Thread Divesh Dixit
You are given an unlimited number of each of n different types of envelopes. The dimensions of envelope type i are xi × yi.(i is in sub script) In nesting envelopes inside one another, you can place envelope A inside envelope B if and only if the dimensions A are strictly smaller than the dimension

[algogeeks] find out the mid point of a single linked list

2010-09-28 Thread Divesh Dixit
Given a singly-linked, find out (just give the basic logic) the mid point of a single linked list in a single parse of the list. Assume the program would be loaded in read-only memory so no manipulation of the list is allowed. -- You received this message because you are subscribed to the Google

[algogeeks] finding largest and second largest elements

2010-09-23 Thread Divesh Dixit
finding largest and second largest elements from a set of n elements by means of Minimum comparison of n+celling(log n) +2 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.

[algogeeks] decimal to binary and binary to decimal.....conversion algorithm

2010-09-23 Thread Divesh Dixit
can some one suggest Algo a> n-bit binary number to decimal; b> n-bit decimal to binary. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group,

[algogeeks] help required...

2010-09-22 Thread Divesh Dixit
Among n people, a celebrity is defined as someone who is known to everyone, but who knows no one. Design and analyze to identify the celebrity, if one exists, by asking only questions of the following form: "Excuse me, do you know person x?" You will get a binary answer for each such question asked

[algogeeks] Print 1 to n one per each line on the standard output

2010-09-22 Thread Divesh Dixit
Write an algorithm that will print 1 to n, one per each line on the standard output, where n is a integer parameter to the algorithm. An algorithm should not use while, for, do-while loops, goto statement, recursion, and switch statement. -- You received this message because you are subscribed to

[algogeeks] Re: Amazon Interview

2010-09-22 Thread Divesh Dixit
These a reverse of binary search 1. iteration would be 1,2,4,8,16,32... 2. ex. array a has the infinity 0's . Let it be n(very large) count=1; for(i=1;i wrote: > A file is given with many 0s stored in continuous way , store it in > another file su

[algogeeks] Re: Linux

2010-09-22 Thread Divesh Dixit
ugh. > > Dave > > On Sep 21, 4:04 pm, Divesh Dixit > wrote: > > > How to get  line no. 5 to line no. 10  only from a file.. using tail > > or head command.? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" g

[algogeeks] Linux

2010-09-21 Thread Divesh Dixit
How to get line no. 5 to line no. 10 only from a file.. using tail or head command.? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email