00.
Ex: N=6
K: 1 3 2 6 4
Sol:
1 3 4 pole1
6 2 Pole2
Thanks
Pankaj
--
Regards,
Pankaj Kumar Joshi
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails
an
email to algogeeks+unsubscr...@googlegroups.com.
--
Regards,
Pankaj Kumar Joshi
--
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
to algogeeks+unsubscr
will be
{10,30,55}
and if k is 4
than
{5, 10, 30 , 55)
On Thu, Oct 24, 2013 at 6:20 PM, Saurabh Paliwal
saurabh.paliwa...@gmail.com wrote:
You must be mistaken in the definition of heaps, or maybe the question,
look at the updated question I put up there.
On Thu, Oct 24, 2013 at 5:48 PM, pankaj
is checked by condition, not by Min-heap,
but min heap is used for storing the largest elements.
So it is preferable DS,
On Thu, Oct 24, 2013 at 8:35 PM, atul anand atul.87fri...@gmail.com wrote:
@pankaj : how can you maintain increasing sub-sequence using
heapyour soln is for finding finding K
should be using max-heap not min-heap.
check your algo for :-
1,2,5,10,100,30,8,555
let me know if it work fine.If it is working fine then i need more
clarity of your algo
On 10/24/13, pankaj joshi joshi10...@gmail.com wrote:
@Saurabh:
As per the question the elements of sub-sequence
take care of space also.
K=N=109
1=K=1
Regards,
Pankaj Kumar Joshi
--
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
to algogeeks+unsubscr...@googlegroups.com.
.
To unsubscribe from this group and stop receiving emails from it, send an
email to algogeeks+unsubscr...@googlegroups.com.
--
Regards,
Pankaj Kumar Joshi
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To unsubscribe from this group and stop
://groups.google.com/groups/opt_out.
--
Regards,
Pankaj Kumar Joshi
--
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
to algogeeks+unsubscr...@googlegroups.com.
For more
Sir, I have sent you my CV on vivekr...@gmail.com. Hope you got that
On Friday, November 23, 2012 9:29:29 PM UTC+5:30, Vivek Ramamurthy wrote:
Hi,
Amazon is hiring people for software development projects undergoing at
Blore, Hyd and Chennai divisions.There are openings for Software
same question as above with one more task is given
4) FindAnyElement()
which will return any element present in that structure with O(1).
for given all 4 task
Please suggest which Data Structure is better now...?
Best Regards,
Pankaj Agarwal
--
You received this message because you
for any value of x.
--
Pankaj
On Wed, Nov 30, 2011 at 12:45 PM, atul anand atul.87fri...@gmail.comwrote:
@nitin : as mentioned in the subject , its for Apple
BTW @siddharth , i did not understand your question . little more
explanation please.
On Mon, Nov 28, 2011 at 7:14 PM, Nitin Garg
hii
Any help or suggestions is greatly welcome for AMDOCS interview..i
have gone through the archives but it was not much helpful.
thanks in advance.
Pankaj Saikia
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group
-
P(i) P(i-1) for all i = k
To prove
P(k+1) P(k)
Proof
P(k+1) - P(k) = (P(k) - P(k-6))/6 0
--
Pankaj Agarwal
Communication and Computer Engineering
LNMIIT,jaipur
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
can any one help me why am i getting runtime error in the program.
my program is
def call(a,b):
print(((pow(a,b))%10));
def main():
n=input();
for x in range(n):
import sys
a,b = map(long,sys.stdin.readline().split());
---
pankaj kumar wants to stay in better touch using some of Google's coolest new
products.
If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-fec58d8386-f16dcef73c-qIhM6BVo3OJNdgYKy2viERCQNpE
You'll
if doubly link list then it is possible to insert a new node before the
current pointer.
--
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
5)program will compile and ans is
2 3 5 6
--
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.
what's ans
--
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
I have been trying to find it on net in *pdf* format but unsuccessful.
Online bookstore link will do with reasonable rate :)
or If anyone can share the pdf link.
Cheers
Pankaj
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
There are two cases: First if we get even number in first roll.
So P(A)= 1/2
And if We get odd number in second roll, then we need keep rolling untill we
find another odd number.
So, (1/2)*[1/2] + 1/2*1/2*1/2 upto infinity.
On Sat, Aug 6, 2011 at 8:46 PM, Nitin Gupta
Sorry, I mis understood the ques.
On Sat, Aug 6, 2011 at 8:56 PM, Pankaj jatka.oppimi...@gmail.com wrote:
There are two cases: First if we get even number in first roll.
So P(A)= 1/2
And if We get odd number in second roll, then we need keep rolling untill
we find another odd number.
So, (1
first one is right and second is wrong.because dp will store address of
pointer and here you are storing address of int array.
--
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
head-x=100 is not right
if you will first declare
head=new list;
head-x=100;
will be right.
--
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
int b[26]={0};
vectorcharc;
for(i=0;a[i];i++)
{
if(!b[(a[i]-65)])
{
b[(a[i]-65)]++;
c.push_back(a[i]);
}
}
for(i=0;ic.size();i++)
coutc[i];
}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
when you encounter the letter for first time then simply increment array
having index=(ASCII value-65)
and put that in vector next time when you will encounter the same variable
again then condition will fail hence no change in content of vector
hence in the end simply print the vector
--
You
coming for which branch??
--
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,
http://ideone.com/FtfQO
On Thu, Aug 4, 2011 at 2:54 AM, Victor Manuel Grijalva Altamirano
kavic1.mar...@gmail.com wrote:
Hi, i don't know how to use stringstream of STL, if i have the string
a=helloawordagoodabye, i need the next list:
hello
word good
bye
check that for each 'a' i need
int a[N^2]={0},i,j;
for(i=0;iN^2;i++)
{
cinj;
a[j]++;
}
for(i=0;iN^2;i++)
{
if(a[i]!=0)
{
while(a[i]--)
{
couti\t;
}
}
--
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
what was cutoff cgpa for amazon??
--
pankaj kumar
--
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
Even in array best case can be O(n). Why use stack?
On Wed, Jul 27, 2011 at 12:14 PM, salvador_cerinza
vishwakarma.ii...@gmail.com wrote:
Best case : O(n)
Worst case : O(n^2)
can be done using stack.
Thinking of better solution. .
On Wed, Jul 27, 2011 at 11:50 AM, ankit sambyal
, 2011 at 12:16 PM, Pankaj jatka.oppimi...@gmail.comwrote:
Even in array best case can be O(n). Why use stack?
On Wed, Jul 27, 2011 at 12:14 PM, salvador_cerinza
vishwakarma.ii...@gmail.com wrote:
Best case : O(n)
Worst case : O(n^2)
can be done using stack.
Thinking of better solution
6.if step 4 is true , the push val in stack S and all elements which were
popped in the order they were popped except the last matched candidate
element.
Yeah..dis algo is not very efficient..
On Wed, Jul 27, 2011 at 12:20 PM, Pankaj jatka.oppimi...@gmail.comwrote:
Can you please elaborate
Will not it depend on whether the machine is big or little endian?
On Mon, Jul 25, 2011 at 11:50 AM, rajeev bharshetty rajeevr...@gmail.comwrote:
257 is stored as
B A
0001 0001
So iptr if int* will be pointing to this
You have a Log file that stores the users id, time(irrelevant), and
webpage visited. Find the most common three-sequence webpage visited by
the users. For example, you have a log file
joe, 12:30pm,home
joe, 12:31pm,about
joe, 12:32pm,career
james, 12:35pm, home
james, 12:36pm, cart
james,
Can you please tell us from where we can find such questions?
On Sat, Jul 23, 2011 at 4:21 PM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:
Nice question Kamakshi. The person above has given almost a perfect answer.
For example i=3, we will pop the elements one by one from the top of the
1st
+1.
The new group should only contain stuff related to C output and error
detection and ques like that.
Puzzles I think can be discussed here. wattsay?
On Sat, Jul 23, 2011 at 10:44 PM, saurabh singh saurab...@gmail.com wrote:
Anyways just share the link on the group.I am pretty sure the
N people are standing in a circle ,they start shooting the person standing
*next to their neighbour.*If they start firing in this way , determine who
will be alive after this sequence??
Just for confirming, if only 2 person are left, then out of guilt of killing
other's does the person who has
Vaibhav
What do you thing the complexity of your algo is. And once you hit an
duplicate, from where will you start again?
On Fri, Jul 22, 2011 at 7:21 PM, vaibhavmitta...@gmail.com wrote:
String is abcded
l =0, h = 0
i = 1, l = 0, h = 1, max = 1, A[a]=1
i = 2, l = 0, h = 2, max = 2, A[b] = 2
of a better
solution then please reply.
Cheers
Pankaj
On Fri, Jul 22, 2011 at 7:37 PM, Pankaj jatka.oppimi...@gmail.com wrote:
Vaibhav
What do you thing the complexity of your algo is. And once you hit an
duplicate, from where will you start again?
On Fri, Jul 22, 2011 at 7:21 PM
In my latest interview I encountered the following puzzle.
There are 100 prisoners in the prison. All of them have either black or
white cap.
Jailer has asked them to stand in the queue such that nth guy can see caps
of all the guys standing ahead of him, but he can not see his own cap.
It
Skipp Riddle,
Yes.
100th prisoner will risk his life. Similar puzzle was discuss recently. Does
anyone remember the name or thread?
~
Pankaj
On Fri, Jul 22, 2011 at 7:55 PM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote:
Worst case 99 get released.
Is that correct..?
--
You received
.
On , Pankaj jatka.oppimi...@gmail.com wrote:
VaibhavWhat do you think the complexity of your algo is. And once you hit
an duplicate, from where will you start again?
Try for this example
abcdeaifjlbmnodpq.
It will be still O(26*n) as at max, we would have to start from each
letter and go
Vaibhav Mittal
Computer Science
Netaji Subhas Institute Of Technology
Delhi.
On , Pankaj jatka.oppimi...@gmail.com wrote:
abcdeaifjlbmnodpq
For this once you encounter a at 6th position, You can update your
max.Now You will have to do following operation.
First clear all the hash.
2. You
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 chetankapoor...@gmail.comwrote:
josehus problem???
On Fri, Jul 22, 2011 at 7:57 PM, Pankaj jatka.oppimi...@gmail.com wrote:
Skipp Riddle,
Yes
Of Technology
Delhi.
On , Pankaj jatka.oppimi...@gmail.com wrote:
Vaibhav, Ok write your code and paste on ideone. It should be easy and
quick to code :)
On Fri, Jul 22, 2011 at 7:59 PM, vaibhavmitta...@gmail.com wrote:
U hv got my algo completely wrong. Gimme a smaller
Just like you do for int *
int *p=(int *) malloc(sizeof(int));
double *ptr_lf = (double *) malloc(sizeof(double));
On Sat, Jul 23, 2011 at 12:32 AM, hurtlocker bhavesh24...@rediffmail.comwrote:
how to allocate memory for a double pointer ..??
--
You received this message because you are
double **p= (double **) malloc(sizeof(double *));
On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal agr.bhav...@gmail.comwrote:
double pointer mean like **p
hoe to allocate memory for this
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
https://ideone.com/tr3Q7
On Sat, Jul 23, 2011 at 12:42 AM, Pankaj jatka.oppimi...@gmail.com wrote:
double **p= (double **) malloc(sizeof(double *));
On Sat, Jul 23, 2011 at 12:40 AM, Bhavesh agrawal
agr.bhav...@gmail.comwrote:
double pointer mean like **p
hoe to allocate memory
If you know circular list, what is avoiding you from maintaining a tail
pointer.
You just need to tweak insert and delete function a little bit for corner
cases.
On Sat, Jul 23, 2011 at 12:50 AM, rShetty rajeevr...@gmail.com wrote:
Algorithm Please ... Thank You
On Jul 23, 12:17 am, vaibhav
int. And assigning the
address of each array to memory allocated above.
Please let me know if I am wrong.
On Sat, Jul 23, 2011 at 12:59 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
@rakib:can u please explain ur answer
On Sat, Jul 23, 2011 at 12:48 AM, Pankaj jatka.oppimi
then be the
insertion of a node be done in constant time without traversing the
list ??
On Jul 23, 12:26 am, Pankaj jatka.oppimi...@gmail.com wrote:
If you know circular list, what is avoiding you from maintaining a tail
pointer.
You just need to tweak insert and delete function a little bit
For linklist? How
On Sat, Jul 23, 2011 at 1:23 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
use counting sort..
On Sat, Jul 23, 2011 at 1:22 AM, rShetty rajeevr...@gmail.com wrote:
How to sort Linked lists in O(n) time ??
Give the algorithm or the explanation or clue to tackle the
int n,temp,pow2=1;
cinn;
temp=n;
while(temp){
if(temp%2==) n-=pow2;
pow2*=2;
temp=temp/2;
}
On Thu, Jul 21, 2011 at 2:08 PM, Vivek Srivastava
srivastava.vivek1...@gmail.com wrote:
I forgot to mention that you have to program the problem in any language of
your choice.But C will be
Ingore the above code. It is wrong.
On Thu, Jul 21, 2011 at 2:39 PM, Pankaj jatka.oppimi...@gmail.com wrote:
int n,temp,pow2=1;
cinn;
temp=n;
while(temp){
if(temp%2==) n-=pow2;
pow2*=2;
temp=temp/2;
}
On Thu, Jul 21, 2011 at 2:08 PM, Vivek Srivastava
srivastava.vivek1
http://www.codechef.com/FEB10/problems/M5/
On Wed, Jul 20, 2011 at 5:35 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
@Dumanshu..i am not partitioning them into just two queues...
Moreover I just gave a raw idea...and yeah the complexity is in the order
of n^2 only.
There are many
Given an array with + and - numbers, including zero, Write an algorithm to
find all the possible sub arrays which sum up to zero.
For example, if given array is
20 , -9 , 3 , 1, 5 , 0, -6 , 9
Then possible sub arrays are:
-9, 3, 1, 5
0
1, 5, 0, -6
--
You received this message because you are
I think sunny meant that in IA-64 the pointer is of size 8 but here we are
assigning it to int *p. So, the segfault can occur.
On Wed, Jul 20, 2011 at 6:52 PM, Sandeep Jain sandeep6...@gmail.com wrote:
@Sunny: I couldn't understand how size of int int* matter here??
Regards,
Sandeep Jain
One a not so standard way of doing that is while creating the link list,
keep an extra pointer in the node to point to the jump location.
Just hold the previous node in a temp say address of 2 node and when i/p
reaches 4, point the jumper pointer to 4 and make 4 the next jumper pointer.
On
*Contiguous elements*
On Thu, Jul 21, 2011 at 12:12 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
for the above example,there are more possible sub arrays like
-9,9
-9,0,9
On Thu, Jul 21, 2011 at 12:06 AM, sagar pareek sagarpar...@gmail.comwrote:
@ankur
pls explain through an
best approach for such problems is try to solve for very small numbers
then do DP for solve large numbers. as follows
single digit = 7,8,9 answer = 3 [i am taking 7 inclussive]
double digit= 7*2 = 14. now smallest number can be.
59=1
68, 69 = 2
77 78, 79,=3
86, 87, 88, 89=4
95,96,97,98,99 =5
3
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 at
http://groups.google.com/group/algogeeks?hl=en.
--
Pankaj Agarwal
i hope statement is-
i am telling lie if i don't get a gold coin.
clear me if i am wrong
On Mon, Mar 7, 2011 at 5:59 PM, amit singh amit.lu...@gmail.com wrote:
i will get a gold coin or i will not get a coin
On Mon, Mar 7, 2011 at 1:41 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Get
Hello,
we like to invite you all to participate in Online Programming Contest
organized as a part of Daksh 2011, an international level Technical
festival of SASTRA University, Thanjavur, Tamilnadu
We have two competitions:
1) DOPE
Dope is a 6 hour ACM ICPC style algorithmic competition with team
Hi ,
here goes the code..
let's say you have an array of n numbers.Here n could be 1,2,3..
it goes as follows:
function bubblesort (A : list[1..n]) {
var int i, j;
for i from n downto 1 {
for j from 1 to i-1 {
if (A[j] A[j+1])
swap(A[j],
64 matches
Mail list logo