)) + bitCount(n) + n + 1;
}
On Thursday, June 20, 2013 11:03:35 PM UTC-4, shubham saini wrote:
How to count no of set bits for all numbers from 1 to n for a given n...
i knew brute force any better solution ??
--
You received this message because you are subscribed to the Google Groups
How to count no of set bits for all numbers from 1 to n for a given n...
i knew brute force any better solution ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email
#includeiostream
using namespace std;
class Test
{
private:
int x;
int y;
public:
Test(int x = 0, int y = 0) { this-x = x; this-y = y; }
void setX(int a) { x = a; }
void setY(int b) { y = b; }
void destroy() { delete this;
coutx=this-x,y= this-y;
}
void print() { cout x =
Rope Data Structure is best suited for text editors.
On Sat, May 25, 2013 at 10:24 PM, Nishant Pandey
nishant.bits.me...@gmail.com wrote:
In one of the interview it was asked, can some one suggest good DS for
this.
Thanks
--
You received this message because you are subscribed to the
to the Google Groups
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an
email to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
You
There are 8 coins in a bag .
3 coin weights x kg
3 coins weights y kg
2 coins weights z kg
2 coins weights w kg
You have to separate them into separate heaps according to
their weights in minimum comparisons using weighing balance.
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
You
2 coins weights z kg
2 coins weights w kg
You have to separate them into separate heaps according to
their weights in minimum comparisons using weighing balance.
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
You received this message because you are subscribed to the Google
code snippet:
*int main()
{
printf (%d\n,(float)((int)(3.5/2)));
return 0;
}*
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from
totally different format. If you have -Wall turned on, you should see
a warning.
Yanan Cao
On Thu, Feb 28, 2013 at 1:41 PM, Shubham Sandeep
s.shubhamsand...@gmail.com wrote:
code snippet:
*int main()
{
printf (%d\n,(float)((int)(3.5/2)));
return 0;
}*
--
Regards,
SHUBHAM SANDEEP
...@gmail.comwrote:
You are initialising random memory address with 0, which OS doesn't
allow.
On 12/17/12, Shubham Sandeep s.shubhamsand...@gmail.com wrote:
how does this code achieve SIGSEGV
code:
*p;main(){*p=0;}
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD
how does this code achieve SIGSEGV
code:
*p;main(){*p=0;}
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
but not both
Ans. (e)
E option should be or 113
am i ryt???
A- b or c.
if A-Bthen B-fg and Delse if A-C ,then c-eh and c-d
am i ryt
--
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
but not both
Ans. (e)
E option should be or 113
am i ryt???
A- b or c.
if A-Bthen B-fg and Delse if A-C ,then c-eh and c-d
am i ryt
--
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
://nicolas-lara.blogspot.in/2009/01/permutations.html
On Friday, December 14, 2012 11:56:16 AM UTC+5:30, tapan rathi wrote:
For a given number, find the next greatest number which is just greater
than previous one and made up of same digits.
--
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
34 40 45 50 60 70
Thank you
Shubham
--
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/-/XXMvBSg0t08J.
To post to this group, send email to algogeeks
#includestdio.h
main()
{
printf
(
\%\d\
,
12
)
;
printf
(
\%\
d\
,
12
)
;
}
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
Has anyone appeared for oracle recentlyplz tell the pattern of the paper
--
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/-/IhEwqKaWLmAJ.
To post to this
#includestdio.h
main()
{
int a[] = {0,1,2,3,4};
int *p[] = {a,a+1,a+2,a+3,a+4};
int **pp= p;
printf(%d, %d, %d , *pp-a, pp-p, **pp);
pp++;
pp++;;
++pp;
*++pp;
printf(%d, %d, %d , pp-p, *pp-a, **pp);
}
output:0 ,0 ,0 ,4 ,4 ,4
--
You received this message
@guneesh your code fails to keep order b/w 3 and 4 in the above example
On Fri, Jun 15, 2012 at 2:40 PM, Guneesh Paul Singh gunees...@gmail.comwrote:
void change(int a[],int n)
{
int i,j;
i=0;
j=1;
while(injn)
{
if(ji)
j=i+1;
else
wat constraints does dis bring in the question... Also the books are
arranged in a certain order and this order must never be changed.
does this imply --- a student gets only consecutivly numbered book
if not then
sort the array B in decreasing order in Onlogn
take another array S of k
im assuming it be a square matrix
then kth smallest element will be in a first k*k sub matrix.
jst look for smallest element in the diagonal of this matrix.
it will give the kth smallest element .
On Mon, Oct 10, 2011 at 4:45 AM, Ankur Garg ankurga...@gmail.com wrote:
Given a 2D matrix which
can anybody tell me about INFOEDGE working culture?
--
Shubham bansal
contact no. 7206338328
NIT Kurukshetra
Computer Engineering
(Final year)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks
sum=((a^b) || ((ab)1));
--
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/-/47RmEJcjv6kJ.
To post to this group, send email to algogeeks@googlegroups.com.
To
((a^b) | ((ab)1))
sorry tht was bitwise or..by mistak i hd wrote logicl or
SHUBHAM BANSAL
COMP DEPT..
NIT KKr
On Sun, Aug 21, 2011 at 9:30 AM, Sanjay Rajpal srn...@gmail.com wrote:
Yes if a or b are non zero, the result is always 1.
Sanju
:)
On Sat, Aug 20, 2011 at 8:57 PM, Naman Mahor
Hi,
we can show that
(x/3) = (x/2) - (x/4) + (x/8) - (x/16) + infinity
Proof:
let s1 = (x/2)+(x/8)+(x/32)+...infinity = (x/2)/(1-(1/4)) [Geometric
Progression , common Ratio(r) = 1/4]
s2 = (x/4)+(x/16)+(x/64)+...infinity = (x/4)/(1-(1/4)) [Geometric
Progression , common Ratio(r) =
for the cows ques ... you all are forgetting to add the orginal starting cow
...
thus the answer should be *233*
On Sun, Jul 31, 2011 at 1:30 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:
Oops. My bad. Rabbits produce every month too.
I overlooked that.
On Sun, Jul 31, 2011 at 1:24 PM,
if OS installed is of 32 bit ... then compiler will work as working on a 32
bit architecture ... and give the results accordingly ...
@aditi :: i am not so sure abt your stateent regarding the size of pointer
and an int being th same ... could you plzz quote the reference for the same
...
On
use a doubly linked list ... with a field node *min.
weneva you insert an element ... check for the value of min at the head ...
if the new inserted node has less value ... then set the min field to point
to itself else copy the min field of te previous head.
insertion and deletion is easy
its a *doubly* linked list ...
you can easily do the job ...
On Sun, Jul 31, 2011 at 2:23 PM, siva viknesh sivavikne...@gmail.comwrote:
using LL u cant delete in O(1) ... u have to traverse from head
On Jul 31, 1:47 pm, Shubham Maheshwari shubham@gmail.com wrote:
use a doubly linked
you mean circular linked list ...!!!
in case of stack ... we cn do it via SSL ...
for a queue implementation ... we will ned circular, or doubly for deletion
in O(1).
On Sun, Jul 31, 2011 at 2:38 PM, naveen ms naveenms...@gmail.com wrote:
@shubham...i have a doubt.can't the same be done
color and intensity are2 different things ...
do you mean to find pixels with same intensity ...!!
and wat is meant by can be reached ...!!
On Sun, Jul 31, 2011 at 2:40 PM, sivaviknesh s sivavikne...@gmail.comwrote:
*Given an nxn screen, Each pixel is represented by intensity values.
Given a
, ISE
PESIT , Bangalore*
On Sun, Jul 31, 2011 at 2:08 AM, naveen ms naveenms...@gmail.com wrote:
@shubham...i have a doubt.can't the same be done with singly linked list??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
take countr to be a static variable ... that shud do the job ...!!
btw ...if thats nt the case ... thn i m nt pretty sure wat u are asking to
be done ...
On Sun, Jul 31, 2011 at 2:12 AM, Rahul Mittal rahulmitta...@gmail.comwrote:
help me with this
we need to find out how many times a function
the operation is nt extract min ... its *find* min ...
On Sun, Jul 31, 2011 at 3:02 PM, Abhishek Gupta gupta.abh...@gmail.comwrote:
@shubham maheshawari
deletion can't be performed in O(1).
after extracting the min element, we need to find the next minimum element,
and worst case
http://ideone.com/IZKyN
could you plzz explain this to me ...!!
anyone ...
On Sun, Jul 31, 2011 at 1:56 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
@sanchit:no,not at all :)
On Sun, Jul 31, 2011 at 1:55 AM, Sanchit Manchanda
sanchit...@gmail.comwrote:
@kamakshi- sorry if you felt
and finding the
minimum element all have O(1) time.
so after deleting the minimum element, where will you point min pointer?
Sorry if i m wrong
On Sun, Jul 31, 2011 at 3:11 PM, Shubham Maheshwari shubham@gmail.com
wrote:
the operation is nt extract min ... its *find* min ...
On Sun
hey sylvester,
just clarify the problem ..
Is it such that in forming the group some people can be left out
or
the sum of the number of people in both partitions is equal to the total
number of people
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
A man leaves his office daily at 07:00 PM. His driver arrives with the car
from home to his office at sharp 07:00 PM. So he doesn't need to wait for
any transport medium as soon he is free from his work. But today he finished
his work early and left the office at 05:30 PM. As his driver was not
That's what i was provided with in the interview. Somehow i know the answer,
but don't know how?
with the data provided above, you have to calculate the time it takes the
man to reach the office from his home on car.
--
You received this message because you are subscribed to the Google Groups
answer is:
1 hr 20 mins.
But i don't know how to arrive at the solution.
help anyone..
--
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/-/-QFXfKOMKfIJ.
To
x = 0;
while( n ){
x = 1;
x = x | ( n 1);
n = 1;
}
return x;
On Fri, Jul 22, 2011 at 1:31 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
sorry guys.. dont check the above siolution.. its wrong...!!!
misread it..
On 7/22/11, Puneet Gautam puneet.nsi...@gmail.com wrote:
check this out:
thnx ...
:D
On Fri, Jul 22, 2011 at 9:19 PM, sagar pareek sagarpar...@gmail.com wrote:
gr8 shubham
On Fri, Jul 22, 2011 at 1:42 PM, Shubham Maheshwari shubham@gmail.com
wrote:
x = 0;
while( n ){
x = 1;
x = x | ( n 1);
n = 1;
}
return x;
On Fri, Jul 22, 2011 at 1:31 PM
could some1 plz post the xplainations ...
On Fri, Jul 22, 2011 at 8:04 PM, Pankaj jatka.oppimi...@gmail.com wrote:
Chetan,
No. How could you relate this problem with that? Do you find something
similar?
~
Pankaj
On Fri, Jul 22, 2011 at 8:01 PM, chetan kapoor
how are you gonna do it if the originl strng contains repeated letters ...
On Fri, Jul 22, 2011 at 3:33 PM, shady sinv...@gmail.com wrote:
what algorithm, print it subsequently
is there any ?
On Fri, Jul 22, 2011 at 3:24 PM, DeeJJ..! suryaprakash...@gmail.comwrote:
@sunny...yaa..but
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.
--
Shubham Maheshwari
ShubZz
O.o o.O
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.
--
Shubham Maheshwari
ShubZz
O.o o.O
enJoY ...!!!
--
You received this message
can we do anything else .. othr than hash tables ...
On Tue, Jul 19, 2011 at 1:05 AM, Saket Choudhary sake...@gmail.com wrote:
Have a hash Table. Read the elements and push it to the hash table. If it
alraedy exists you are done.
On 19 July 2011 01:02, Shubham Maheshwari shubham.veloc
in a
unless b.include?(m)
bm
else
puts m
break
end
end
On 19 July 2011 01:05, Saket Choudhary sake...@gmail.com wrote:
Have a hash Table. Read the elements and push it to the hash table. If it
alraedy exists you are done.
On 19 July 2011 01:02, Shubham Maheshwari
this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
Shubham Maheshwari
ShubZz
O.o o.O
enJoY ...!!!
--
You received this message because you are subscribed to the Google Groups
Algorithm
i wasnt sure abt the first part of it.
the one with multiple initializations ...
:P
On Sun, Jul 17, 2011 at 3:09 AM, sagar pareek sagarpar...@gmail.com wrote:
Well shubham if you know about the unions very well then why u asked this
question?
On Sun, Jul 17, 2011 at 2:27 AM, Shubham
://groups.google.com/group/algogeeks?hl=en.
--
Shubham Maheshwari
ShubZz
O.o o.O
enJoY ...!!!
--
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
.
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.
--
Shubham Maheshwari
ShubZz
O.o o.O
enJoY
union Data Type
What is the output of the following program? Why?
#include
main() {
typedef union {
int a;
char b[10];
float c;
}
Union;
Union x,y = {100};
x.a = 50;
strcpy(x.b,hello);
x.c = 21.50;
printf(Union x : %d %s %f n,x.a,x.b,x.c);
printf(Union y : %d %s %f n,y.a,y.b,y.c);
}
--
Shubham
you mean to say .. the ques is wrong ... or what ...!!
On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek sagarpar...@gmail.com wrote:
I think you must first read about unions and the differences between union
and structures :)
On Sun, Jul 17, 2011 at 1:48 AM, Shubham Maheshwari
shubham.veloc
of 100.
On Sun, Jul 17, 2011 at 1:58 AM, Shubham Maheshwari
shubham.veloc...@gmail.com wrote:
you mean to say .. the ques is wrong ... or what ...!!
On Sun, Jul 17, 2011 at 1:54 AM, sagar pareek sagarpar...@gmail.comwrote:
I think you must first read about unions and the differences
whose next digit doesnot exist should be placed before the other
number.
step 3:
concatenate these numbers.
e.g.
(0,1,10,100) sorting it gives: 1,10,100,0 = 1101000
(97,8,9) sorting gives: 9,97,8 = 9978
correct me if i'm wrong.
Shubham
--
You received this message because you
check this one out:
#includeiostream
#includecstdio
#includevector
#includecstring
using namespace std;
int check_palin(string str,int *start)
{
int pos=-1,ret,size=str.size()-1;
char last_char=str[size];
while(possize)
{
ret=0;int i;
pos=str.find(last_char,pos+1);
Hello Geeks,
Suppose we have a 2-d array arr[1000][1000] capable of storing 10^6
elements in it. Input is supplied one row at a time. Then what is the
best possible way to read this much data in the least amount of time
as scanf() or cin takes a lot of time?
--
You received this message because
Hi there,
Please help me reveal the suitable logic behind this problem.
For a set of inputs, outputs are given. You are to guess the logic.
problem can be seen at-
http://www.spoj.pl/problems/HARDP/
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
You have N marbles and K slots. You have to follow the below mentioned
rules :
1. You can put in a marble or take out a marble from slot numbered
1 at any time.
2. You can put in a marble or take out a marble from slot numbered
i only if there exists a marble at the slot i - 1.
3. The
if (u r calling dp of spoj as basic)
{
i would say u are a champ already ;
}
else
{
do practise more on spoj
}
--
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
wch college u are in ?
--
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,
thats cool i am from uptu google didnt visit here so no idea :D :D
--
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
u can see topcoder and codechef tutorials may help
--
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 to
64 matches
Mail list logo