A modification in the above code,
int divide(int a, int b)
{
int temp = 0;
int result = 0;
int mask, i;
printf (a = %d, b = %d\n, a, b);
temp = 0;
for ( i = 30; i = 0; i-- ) {
mask = 1 i;
temp = 1;
@ps: ..:-)
On 5/22/11, Piyush Sinha ecstasy.piy...@gmail.com wrote:
@MONSIEUR..
someone once saidTHE SECRET OF SUCCESS IS TO NEVER REVEAL YOUR
SOURCES... ;)...:P..:P
On 5/22/11, MONSIEUR monsieur@gmail.com wrote:
@piyush: excellent buddybtw what was the initial
here is the working code :
#includestdio.h
8: int dividend, divisor, remainder;
9:
10: /* Division function Computes the quotient and remainder of two numbers
11: using bit shifting */
12: int division(int tempdividend, int tempdivisor) {
13:
14: int quotient = 1;
15:
16: if
*Murder mystery puzzle
*
*
*
**
*Two cops walked into a room with no windows and found a dead man who
obviously hung himself from the ceiling, though they couldn't figure out
how. There was no chair beneath him that he might have jumped off of, or a
table. Just a puddle of water. How'd he do it
*
He must be standing on a ice block. :)
On Mon, May 23, 2011 at 1:57 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Murder mystery puzzle
*
*
*
**
*Two cops walked into a room with no windows and found a dead man who
obviously hung himself from the ceiling, though they couldn't figure out
*Study Online For Diploma
Study at Your Own Time Own Pace Globally Recognized Diploma Courses
http://bit.ly/khS0GB
http://bit.ly/khS0GB
http://bit.ly/khS0GB
*
--
If you would like to get daily pictures
We've started a Google Group to allow our visitors to get daily funny and
Crazy Pictures ,
@tec: the sequence should be like (0,1),(1,1),(1,2),(2,3),(3,5),(5,8)... or
m i wrong?
On Mon, May 23, 2011 at 11:08 AM, Aakash Johari aakashj@gmail.comwrote:
Matrix exponentiation can help i think
On Sun, May 22, 2011 at 10:36 PM, Akshata Sharma
akshatasharm...@gmail.com wrote:
It
for 12 answer will be 36? is it ur 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
I didn't get the question actually. I have copied the post(the
question). but i dont think for 12, 36 can be the answer. We have to
go for the permutation of the telephone number i guess after
substituting for each number the corresponding set of alphabets.
The question given is - Given a
Study Trie Then Apply It..It Will Work
PS: We already have dictionary congaing all the possible words if its
not given then we can make the dictionary then we can find out the
all possible anagram of word in constant time O(K) where K is length
of each anagram of word W.
Hope i m correct
I don't know u will be happy with this or not but let me explain in
simplest way
PS: i haven't used division operator anywhere but i also i haven't
done using Bit Logic which is efficient then this one but below code
work simplest way to understand
This One is the Simply Logical. This will
@akshata,
The (1,1) would be a special case.
for give N=1, but again for N=1, (2,1) also satisfies well.
And the series from then is constructed on the (1,0), (2,1), (3,2) So and
so..
Also if you see in the original problem statement, they mentioned a=b, but
not ab..
this is for the special
There is also another special case.. where N=0, in this case.. its (0,0)
-- 0+0 = 0
--
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
I think Hash-map With Separate Chaining Will be Best Where Key Will
be Name of country value will be pointer to linked list that will
hold all the scene Shooted in that country so hope it pretty clear
that as we shooting scene randomly so whenever new scene Shooted put
into bucket of Hash-map if
the same question i have asked in microsoft interview. (if it is the same
:P)
for 12 perutation are (ad, ae, af, bd, be, bf, cd, ce ,cf);
i have given them 3 solution(recusrsive, stack based) and the last one what
they wanted.
take a tertiary number(n) = 3^(number of digits) in case of 12 it is
@sravanreddy001
suppose u have to calulate A^n u can calculate in O(d^3*log(n));
d is dimesion of matrixl
while (n)
{
if (n1) mul(ans, A, d);
mul(A, A, d);
n =1;
}
--
Anshuman Mishra
IIIT Allahabad
-
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*Please reply at
can you tell me the problem? or link?
On Mon, May 23, 2011 at 6:09 PM, Dumanshu duman...@gmail.com wrote:
In this problem u have to write a code(interested in a C code) which
will cause a segmentation fault. Now the trick is to write the code as
short as possible. Your score is the no. of
Using the asm construct of c..
Though i did this problem in native asm and my solution is 3 char ;)...
The point is you have to know if not proficient with NASM(Net Assembler
used by SPOJ)...
If you need the solution mail me.
--
Saurabh Singh
B.Tech (Computer Science)
MNNIT
http://www.spoj.pl/problems/SIGSEGV/
On Mon, May 23, 2011 at 7:52 PM, kumar anurag anurag.it.jo...@gmail.comwrote:
can you tell me the problem? or link?
On Mon, May 23, 2011 at 6:09 PM, Dumanshu duman...@gmail.com wrote:
In this problem u have to write a code(interested in a C code) which
can you post the problem link?
On Mon, May 23, 2011 at 7:53 PM, saurabh singh saurab...@gmail.com wrote:
Using the asm construct of c..
Though i did this problem in native asm and my solution is 3 char ;)...
The point is you have to know if not proficient with NASM(Net Assembler
@sravanreddy001
by matrix exponential method, we can calculate the nth fibonacci number in
logarithmic time.
On Mon, May 23, 2011 at 7:39 PM, anshu mishra anshumishra6...@gmail.comwrote:
@sravanreddy001
suppose u have to calulate A^n u can calculate in O(d^3*log(n));
d is dimesion of matrixl
@bittu..
Given 2 nos. we need to divide them without performing divison.
*Please give a better solution than subtracting the nos. again and
again.*
The author has specifically mentioned this.
The order of this algo will be log(n) since the numbers are represented in
binary form.
against
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*
Please reply at
@akshata, sravanreddy: yes, for more info regarding matrix expo. you can go
through http://zobayer.blogspot.com/2010/11/matrix-exponentiation.html
On Mon, May 23, 2011 at 7:28 AM, Akshata Sharma
akshatasharm...@gmail.comwrote:
@sravanreddy001
by matrix exponential method, we can calculate the
Extending the above soln:
NUM_PER_DIGIT = 3
char c[][NUM_PER_DIGIT] = {abc,def,...};
char n[] = 2156169 (number is pressed);
int k=7;
for i -- 0 to NUM_PER_DIGIT ^ k
String s=;
for j -- 0 to k
int index = getJthDigitinItotheBaseNumPerDigit(NUM_PER_DIGIT,i,j);
// ie get 1st digit
A Recursive soln:
NUM_PER_DIGIT = 3
char c[][NUM_PER_DIGIT] = {abc,def,...};
char n[] = 2156169 (number is pressed);
int k=7;
char * s = (char *) malloc(sizeof(char) * k);
void printAllCombinations (char c[][], char n[], int k, char *s, int count)
{
if (count = k - 1) {
s[k] = '\0';
small correction
On Mon, May 23, 2011 at 9:46 PM, immanuel kingston
kingston.imman...@gmail.com wrote:
A Recursive soln:
NUM_PER_DIGIT = 3
char c[][NUM_PER_DIGIT] = {abc,def,...};
char n[] = 2156169 (number is pressed);
int k=7;
char * s = (char *) malloc(sizeof(char) * k);
void
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*
*
*Please reply at
Dear Professional,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*
Please reply at
Immanuel,
We can keep c and n arrays as global variable as they are not part of state
of the recursion.
Anuj Agarwal
Engineering is the art of making what you want from things you can get.
On Mon, May 23, 2011 at 10:04 PM, immanuel kingston
kingston.imman...@gmail.com wrote:
small correction
@Anuj, true.This will optimise the solution by reducing the amount of stack
space used for recursion.
NUM_PER_DIGIT = 3
char c[][NUM_PER_DIGIT] = {abc,def,...};
char n[] = 2156169 (number is pressed);
int k=7;
char * s = (char *) malloc(sizeof(char) * k);
void printAllCombinations (int k, char
I want to discuss the solution in C language. I want to test my file
using gcc compiler. For C the best solution is 5 chars. Any ideas
about that??
On May 23, 7:23 pm, saurabh singh saurab...@gmail.com wrote:
Using the asm construct of c..
Though i did this problem in native asm and my
Find whether the binary representation of a number is palindrome or
not. The input begins with integer N.
--
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *
--
You received this message because you are subscribed to
Constraint is no extra space and the complexity should be as efficient
as possible.
On 5/24/11, Piyush Sinha ecstasy.piy...@gmail.com wrote:
Find whether the binary representation of a number is palindrome or
not. The input begins with integer N.
--
*Piyush Sinha*
*IIIT, Allahabad*
If I have a big database of points on the surface of the earth, each
one represented as a latitude and longitude, provide an efficient
algorithm to find the point closest to a requested location. Be sure
to consider angle wrap.
Don
--
You received this message because you are subscribed to the
we can use the following formula to calculate the nth fibonacci no. in O(log
n) time : fib(n)=round((pow(phi,n))/sqrt(5) + 1/2) where phi=(1+sqrt(5))/2;
And by taking care of the special cases and by using the fact that the problem
is just to find the (N+3)th fibonacci number for given N, we
Hello,
Hope you are doing well.
I am a technical recruiter with Panzer Solutions LLC Software Implementing
and IT consulting company located in CT. Please go through the Job
Description and send me your updated resume with contact information.
*Please reply at soh...@panzersolutions.com
*
Title
@Akshata: Actually, you only need to find the n+3rd Fibonacci number,
modulus 17. This saves you from having to deal with big
integers. Something like this should do for the calculation, assuming
that long long int is 64 bits:
long long int n;
int a = 1, b = 2, c;
for(i = 0; i n, i++)
{
Replying to my own posting! Even better, since it replaces the
relatively slow modulus operation with a comparison and subtraction:
long long int n;
int a = 1, b = 2, c;
for(i = 0; i n, i++)
{
c = a + b;
a = b;
b = c 17 ? c : c - 17;
}
// b is the result
Dave
On
@Dave: nice idea.. ll this give AC ?
--
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
See if you want to learn how to compile a c code without main(),then this
can be done by chosing different entry points like _start or _asm and then
compiling it as gcc -O3 -nostartfiles filename..
But since in spoj you cant alter the way gcc compiles(I am not sure i assume
we cant do
42 matches
Mail list logo