please put some other questions of informatica pleaseit will be
helpful.
On Sep 11, 11:25 am, Vijay Khandar wrote:
> property of stack is last in first out
>
> On Sun, Sep 11, 2011 at 11:52 AM, UTKARSH SRIVASTAV
>
>
>
>
>
>
> > wrote:
> > hi i think we have to maintain the property o
property of stack is last in first out
On Sun, Sep 11, 2011 at 11:52 AM, UTKARSH SRIVASTAV wrote:
> hi i think we have to maintain the property of stack that is first come
> first out this can be made only when there is linked list maintain with
> property of stack and it will grow in run t
hi i think we have to maintain the property of stack that is first come
first out this can be made only when there is linked list maintain with
property of stack and it will grow in run time
On Sun, Sep 11, 2011 at 11:43 AM, Vijay Khandar wrote:
> Can u explain how? linked list
>
> On Sun, S
Can u explain how? linked list
On Sun, Sep 11, 2011 at 11:22 AM, Neha Singh wrote:
> Linked List
>
> --
> 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 t
linked list
On Sun, Sep 11, 2011 at 11:22 AM, Neha Singh wrote:
> Linked List
>
> --
> 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 ema
@victor: Can u provide the algo ??
--
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 mor
Plz anyone write program in C++ and C of searching,inserting and
deleting node in or from a B-tree...
Vijay..
--
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 uns
Use of binary tree.. which has node(value,count)
count -number of elements having having element = value...
With regards,
Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com
On Sun, Sep 11, 2011 at 10:32 AM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:
> What would be the
Linked List
--
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 g
if you don't know the size of stack and it grows during run time then which
data structure will you prefer for stack and why?
1. BST
2. Linked list
3. Arrays
4. Hash Tables
Asked in written test of informatica
--
Regards
Ravi Maggon
Final Year, B.E. CSE
Thapar University
--
You received this
seed fill or flood fill is a technique to fill polygon of arbitrary
boundaries ..by selecting a point or a seed in the polygon and
recursively calling the function to fill the polygon
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to
I dont know. I got this question from Facebook interview page. So posted it
here..
On Sun, Sep 11, 2011 at 10:51 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:
> what is seed fill algorithm?
>
> On Sun, Sep 11, 2011 at 10:45 AM, Ishan Aggarwal <
> ishan.aggarwal.1...@gmail.com> wro
what is seed fill algorithm?
On Sun, Sep 11, 2011 at 10:45 AM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:
> 1.)
> how would you detect mouth in a picture
>
> 2.)
> write iterative version of seed fill algorithm
>
> --
> Kind Regards
> Ishan Aggarwal
> [image: Aricent Group]
> Presiden
will u pls provide the answer for 2nd questionfinding the closest pair
of points...
On Sun, Sep 11, 2011 at 4:48 AM, KK wrote:
> MS visited out col with 2 profiles...
> written test:
> 3 different papers:
> 1 one all objectives
> 2nd 2 subjective problems... 1 ws to find the closest pair of
1.)
how would you detect mouth in a picture
2.)
write iterative version of seed fill algorithm
--
Kind Regards
Ishan Aggarwal
[image: Aricent Group]
Presidency Tower-A, M.G.Road,Sector-14
Gurgaon,Haryana.122015 INDIA
Phone : +91-9654602663
ishan2.aggar...@aricent.com
--
You received this mess
What would be the complexity in that case ??
On Sun, Sep 11, 2011 at 10:29 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:
> @brijesh:
> if we don't want to print .. and want to eliminate duplicates ...then ?
> means..want to store in some place which doesn't have any duplicate f
what is M?
On Sat, Sep 10, 2011 at 8:10 PM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:
> 1.)
>
> there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so
> on..
> It looks something like this
> 1
> 2 3
> 4 5 6
> every cup has capacity C. you pour L liters of water f
@brijesh:
if we don't want to print .. and want to eliminate duplicates ...then ?
means..want to store in some place which doesn't have any duplicate for
further purpose ...
On Sun, Sep 11, 2011 at 12:08 AM, Brijesh wrote:
> Watch this video for the concepts of hashing..
> http://www.youtube.com
Whatever changes have been made in array in first step 1 will be continue
to 2nd step(reverse the n-k elements)
With regards,
Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com
On Sun, Sep 11, 2011 at 9:51 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:
> @prave
first do swap like this
if k=3
do 3 tym swap
let start: 1 element from front...its index
let end: 3rd last elemtn index...k lement from last
swap first wiht 3rd last
2nd with second last
3 wiht last
now we have list as:-14 2 4 5 3 23 9 7 6
now set ;4th element from last i.e k+1 from front
swap thes
@praveen:
will u pls explain the second step ... i didn't understand ..
On Sat, Sep 10, 2011 at 8:09 PM, praveen raj wrote:
> @amrit... +1 ..
>
>
> With regards,
>
> Praveen Raj
> DCE-IT 3rd yr
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks
level order and spiral traversing
On Sat, Sep 10, 2011 at 9:27 PM, sukran dhawan wrote:
> level order traversal
>
> On Sat, Sep 10, 2011 at 10:48 AM, ravi maggon wrote:
>
>> give some traversal other then pre,in and post order to print all elements
>> of tree?
>> Asked in informatica interview.
>
The problem can be reduce to find the submatrix with the max area...for that
there is a algorithm in o(n*n*n*n) or o(n*n*n), try with DP.
2011/9/10 Neha Singh
> Given a matrix containing only 1s and 0s. Find the largest sub matrix
> containing only 1s(not necessarily a square sub matrix)
MS visited out col with 2 profiles...
written test:
3 different papers:
1 one all objectives
2nd 2 subjective problems... 1 ws to find the closest pair of
points... and other was to find the bugs and provide the test cases
for the already provided string copying code...
then it was followed by 4 c
what questions are asked in first round of tejas network
--
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...
grep is actually implemented using a suffix tree
--
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...@googleg
And please read my previous post again...
i wrote "stupid question"not "u r stupid"...
On Sun, Sep 11, 2011 at 4:24 AM, sagar pareek wrote:
> @Ayush
> I m sorry ... my intention was not to hurt you.
>
>
> On Sat, Sep 10, 2011 at 11:32 PM, shady wrote:
>
>> easy dude, no one's making fun
@Ayush
I m sorry ... my intention was not to hurt you.
On Sat, Sep 10, 2011 at 11:32 PM, shady wrote:
> easy dude, no one's making fun of you. Who knows you solve this problem in
> future and become a millionaire ?
>
> Just keep posting and contributing to group :)
>
>
> On Sat, Sep 10, 2011
Replying to my own posting: I messed up the while statements. The code
should be
int gcd( int a, int b) // a > 0 and b > 0 is assumed
{
int i, k=0;
i = a | b;
while( ! i & 1 )
{
i >>= 1;
++k;
}
a >>= k;
b >>= k;
while( ! a & 1 ) a >>= 1;
while(
main()
{
int tmp;
for(i=0;i<9;i++)
{
tmp=fork();
if(tmp>0)
break;
printf("Hello");
}
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To
Head First Design Patterns
On Sep 10, 2:12 pm, Brijesh wrote:
> Guys please suggest me any good book for object oriented programming..which
> have lots of example of good design pattern.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To po
http://stackoverflow.com/questions/6967853/dynamic-programming-can-interval-of-even-1s-and-0s-be-found-in-linear-time
On Sun, Sep 11, 2011 at 12:10 AM, Neha Singh wrote:
> Can't hv linear solution to this problem. The no. of intervals itself can
> be of the order of O(n^2)
>
> --
> You received t
Guys please suggest me any good book for object oriented programming..which
have lots of example of good design pattern.
--
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/ms
Given a matrix containing only 1s and 0s. Find the largest sub matrix
containing only 1s(not necessarily a square sub matrix)
--
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.c
@Ishan: Here is the algorithm:
If L <= C, then
cup1 = L
cup2 = cup3 = cup4 = cup5 = cup6 = overflow = 0
else if L < 3*C, then
cup1 = C
cup2 = cup3 = (L-C)/2
cup4 = cup5 = cup6 = overflow = 0
else if L < 5*C, then
cup1 = cup2 = cup3 = C
cup4 = cup6 = (L-3*C)/4
cup5 =
Can't hv linear solution to this problem. The no. of intervals itself can be
of the order of O(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 algogeeks@googlegroups.com.
To unsubscribe from this grou
--
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 group at
ht
what is C and M
On Sep 10, 7:40 pm, Ishan Aggarwal
wrote:
> 1.)
>
> there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so
> on..
> It looks something like this
> 1
> 2 3
> 4 5 6
> every cup has capacity C. you pour L liters of water from top . when cup 1
> gets filled , it o
easy dude, no one's making fun of you. Who knows you solve this problem in
future and become a millionaire ?
Just keep posting and contributing to group :)
On Sat, Sep 10, 2011 at 11:06 PM, aayush jain wrote:
> @sagar
> bro i m not intelligent than u so thats why u r making fun of mine..u know
@sagar
bro i m not intelligent than u so thats why u r making fun of mine..u know
one thing
God is not giving equal capability of mind and he has given something
special to everyone that thing surely is not in u...
so think about it before say anythink..
--
You received this message because you a
@Shady: I really haven't studied the complexity of the binary gcd
algorithm. It is well known that the complexity of Euclid's algorithm
is O(log_phi(max(a,b))), where phi is the golden ratio: phi = (1 +
sqrt(5)) / 2, with the worst case being two consecutive Fibonacci
numbers. E.g., Euclid's algori
thanx praveen...
--
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 t
u can use atoi function
On Sat, Sep 10, 2011 at 10:26 PM, shady wrote:
> #include
> #include
>
> main(){
> char *s = "88934\0";
> int sum=0;
> int i=0;
> while(i int value = s[i]-'0';
> sum = 10*sum+value;
> i++;
>
Can anybdy sum up, wats the best approach and under what cicumstances ??
--
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
#include
#include
main(){
char *s = "88934\0";
int sum=0;
int i=0;
while(i wrote:
> Not able to find some good solution for this...
>
>
> On Sat, Sep 10, 2011 at 10:17 PM, shady wrote:
>
>> string manipulation... google it.
>>
>> On Sat, Sep 10, 2011 at 10:06 PM,
@dave no doubt division is costly, but will time complexity change in your
case ?
On Sat, Sep 10, 2011 at 10:25 PM, Neha Singh wrote:
> the time complexity of my approach : O(a*b)^2
> and of the other approach, i guess : O(a) , where a is the larger no.
> correct me if i m wrong
>
> So, complexi
the time complexity of my approach : O(a*b)^2
and of the other approach, i guess : O(a) , where a is the larger no.
correct me if i m wrong
So, complexity wise my approach does not seem to be gud
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" gro
@sukran nope, that won't work.
@neha true
On Sat, Sep 10, 2011 at 10:19 PM, avi0889 wrote:
> adding how...do u mind elaborating a little plz...:)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the w
@Neha: Although some have suggested Euclid's Algorithm without
condition, and some have expressed disgust that you would even ask the
question, it actually is worth discussing. If division is expensive
compared to logical operations, such as in a microcontroller that does
not have a hardware divide
Not able to find some good solution for this...
On Sat, Sep 10, 2011 at 10:17 PM, shady wrote:
> string manipulation... google it.
>
> On Sat, Sep 10, 2011 at 10:06 PM, Ishan Aggarwal <
> ishan.aggarwal.1...@gmail.com> wrote:
>
>>
>>
>> --
>> Kind Regards
>> Ishan Aggarwal
>> [image: Aricent Gro
@sagar hahaha, 101% true
@others
this is a million $ question... all the best.
On Sat, Sep 10, 2011 at 6:19 PM, sagar pareek wrote:
> @aayush
>
> Dude... i dont knw from where did u find such a stupid question...
> Whole cryptography.mean all SSL , RSA , etc etc based on large
> numbers
adding how...do u mind elaborating a little plz...:)
--
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/-/FqHIYXKWamYJ.
To post to this group, send email to algo
string manipulation... google it.
On Sat, Sep 10, 2011 at 10:06 PM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:
>
>
> --
> Kind Regards
> Ishan Aggarwal
> [image: Aricent Group]
> Presidency Tower-A, M.G.Road,Sector-14
> Gurgaon,Haryana.122015 INDIA
> Phone : +91-9654602663
> ishan2.ag
yup, yours(binary gcd) is better.
On Sat, Sep 10, 2011 at 9:34 PM, Neha Singh wrote:
> How abt dis :
>
> The algorithm reduces the problem of finding the GCD by repeatedly applying
> these identities:
> 1. gcd(0, v) = v, because everything divides zero, and v is the largest
> number that divides
O(n log(n))
can we do better ?
On Sat, Sep 10, 2011 at 10:02 PM, sukran dhawan wrote:
> after finding gcd of first two elements use gcd as first no and next array
> element as second no annd call gcd function
> repeat the proc till array exhausts
>
> On Sat, Sep 10, 2011 at 9:39 PM, Neha Singh wr
this problem is more or less same as subset sum problem. So, i guess only
brute force solution ( O(2^n) ) is available. Correct me if i m wrong
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@g
got it
--
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 group
after finding gcd of first two elements use gcd as first no and next array
element as second no annd call gcd function
repeat the proc till array exhausts
On Sat, Sep 10, 2011 at 9:39 PM, Neha Singh wrote:
> @sukran : we hv to find gcd of all the elements of the array, not of 2
> elements.
> Give
sorting and then adding individual elements and then comparing with k
On Sat, Sep 10, 2011 at 9:59 PM, sukran dhawan wrote:
> sorting will help i guess
>
>
> On Sat, Sep 10, 2011 at 9:51 PM, avi0889 wrote:
>
>> how to find if sum of some of the elements of an array equals to k
>>
>> --
>> You re
sorting will help i guess
On Sat, Sep 10, 2011 at 9:51 PM, avi0889 wrote:
> how to find if sum of some of the elements of an array equals to k
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
Hi All, Please answer these questions :-
1.)
A tree is serialized in such a way that all the leaves are market with L and
all the other nodes with N. The tree is serialized keeping the order derived
by a pre-order traversal. Write an algorithm for reconstructing the tree.
Also, suggest a methodolo
how to find if sum of some of the elements of an array equals to k
--
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/-/Lb3JgT4eWDAJ.
To post to this group, send
@sukran : we hv to find gcd of all the elements of the array, not of 2
elements.
Give detailed algo
--
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 grou
How abt dis :
The algorithm reduces the problem of finding the GCD by repeatedly applying
these identities:
1. gcd(0, v) = v, because everything divides zero, and v is the largest
number that divides v. Similarly, gcd(u, 0) = u. gcd(0, 0) is not typically
defined, but it is convenient to set gcd(0
can someone plz provide the solution to it???
On Sat, Sep 10, 2011 at 9:30 PM, sukran dhawan wrote:
> best way it to invoke the function recursively
>
> just like a k-1 ary tree
> correct me if im wrong
>
> On Sat, Sep 10, 2011 at 2:49 PM, Ishan Aggarwal <
> ishan.aggarwal.1...@gmail.com> wrote:
Howz this solution??
void main()
{
int a[10] = {9,3,9,3,9,3,2};
int c[10],i,j,k,co;
k=0;
for(i=0;i<7;i++)
{
co = 0;
for( j = 1+1; j<7; j++)
if( a[i] == a[j])
co++ ;
if( co == 0)
{
c[k++] = a[i];
}
for (i=0;iwrote:
> yes for integer arrays we need to sort o(nlogn) and den compare in o(n)
>
>
>
best way it to invoke the function recursively
just like a k-1 ary tree
correct me if im wrong
On Sat, Sep 10, 2011 at 2:49 PM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:
> What would be the efficient way to code this program.??
>
> Given an array of size n, find all the possible sub
No. I think you should revisit complexity. That's not how it works.
Factoring a million digit number outputs two numbers. It should take
O(1), right? :D
On Sat, Sep 10, 2011 at 11:56 AM, Neha Singh wrote:
> we hv to just fill an array of size n, so complexity should be O(n) in worst
> case
>
> -
level order traversal
On Sat, Sep 10, 2011 at 10:48 AM, ravi maggon wrote:
> give some traversal other then pre,in and post order to print all elements
> of tree?
> Asked in informatica interview.
>
> --
>
> Regards
> Ravi Maggon
> Final Year, B.E. CSE
> Thapar University
>
> --
> You received
we hv to just fill an array of size n, so complexity should be O(n) in worst
case
--
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
yes for integer arrays we need to sort o(nlogn) and den compare in o(n)
On Sat, Sep 10, 2011 at 7:12 PM, Ishan Aggarwal <
ishan.aggarwal.1...@gmail.com> wrote:
> Hi,
>
> Actually I am not good at hash tables. can u plzz suggest me some gud link
> from where I can study hash tables...
> and also t
coming arnd 25th
eligibily : 65%
pay - arnd 8
On Sat, Sep 10, 2011 at 9:23 PM, vivek goel wrote:
> cau u elaborate me.m not getting it...
>
>
> On Sat, Sep 10, 2011 at 9:21 PM, mohit mittal wrote:
>
>> around 25th
>> 65
>> arnd 8
>>
>> --
>> You received this message because you
page size (logical address space) = 512 = 2 power 9
so 9 bits
base address = 10 bits
so combining them 10+ 9 = 19 bits
On Sat, Sep 10, 2011 at 7:18 PM, rohit kumar wrote:
> please explain ...
>
>
> On Sat, Sep 10, 2011 at 5:10 PM, bharatkumar bagana <
> bagana.bharatku...@gmail.com> wrote:
>
>
cau u elaborate me.m not getting it...
On Sat, Sep 10, 2011 at 9:21 PM, mohit mittal wrote:
> around 25th
> 65
> arnd 8
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> http
while(num2 != 0)
{
rem = num1 % num2
num1 = num2
num2 = rem
}
On Sat, Sep 10, 2011 at 8:59 PM, Gaurav Menghani
wrote:
> C'mon
>
> http://en.wikipedia.org/wiki/Greatest_common_divisor
>
> On Sat, Sep 10, 2011 at 11:24 AM, Neha Singh
> wrote:
> >
> > --
> > You received this message because you
around 25th
65
arnd 8
--
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/-/7FtN8hsesrgJ.
To post to this group, send email to algogeeks@googlegroups.com.
To uns
where n is the size of array
On Sat, Sep 10, 2011 at 9:16 PM, sukran dhawan wrote:
>
>
> large1 = a[0];
> large2 = a[1];
>
>
> if(large1 < large2)
> swap(large1,large2)
>
> while(i < n)
> {
> if(a[i] > large1)
>{
> large2 = large1
> large1 = a[i]
> }
> else if(a[i] > large2)
> l
find GCD by eucledian method
LCM = (a * b )/GCD;
On Sat, Sep 10, 2011 at 9:13 PM, Gaurav Menghani
wrote:
> http://tinyurl.com/3hm3gug
>
> On Sat, Sep 10, 2011 at 10:46 AM, Neha Singh
> wrote:
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm
large1 = a[0];
large2 = a[1];
if(large1 < large2)
swap(large1,large2)
while(i < n)
{
if(a[i] > large1)
{
large2 = large1
large1 = a[i]
}
else if(a[i] > large2)
large2 = a[i]
}
// test the case if no of elements is 1 :)
On Sat, Sep 10, 2011 at 8:54 PM, Dave wrote:
> @Abhinav:
http://tinyurl.com/3hm3gug
On Sat, Sep 10, 2011 at 10:46 AM, Neha Singh wrote:
>
> --
> 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 em
Well you can avoid that condition by comparing the number by:
1. Keeping two numbers, largest and second largest.
2. Comparing with the second largest. If it is greater than the second
largest, set second_largest = num. Else continue.
3. If second_largest > largest, swap(largest,second_largest).
O
sort it in quicksort (descending order)...den take arr[1] -->second largest
On Sat, Sep 10, 2011 at 8:34 AM, Akhilesh Vedhera wrote:
> Then the complexity will be nlogn not n and if it is the worst case
> then it would be O(n^2)...
>
> On Sat, Sep 10, 2011 at 8:58 PM, abhinav gupta
> wrote:
Then the complexity will be nlogn not n and if it is the worst case then
it would be O(n^2)...
On Sat, Sep 10, 2011 at 8:58 PM, abhinav gupta wrote:
> Oops ..no u hav to quicksort it.
>
>
> On Sat, Sep 10, 2011 at 8:24 AM, Dave wrote:
>
>> @Abhinav: Does it work correctly on {1, 3, 2}, or, f
On Sat, Sep 10, 2011 at 11:28 AM, teja bala wrote:
> @Gaurav
>
> wat if here is n=1
> den
> W(0)=?
>
> i dint get that
See, when you get to W(0) state, that means, you have created a valid
combination. That means, you have gone through one 'path' through the
various possibilities. That is why W
C'mon
http://en.wikipedia.org/wiki/Greatest_common_divisor
On Sat, Sep 10, 2011 at 11:24 AM, Neha Singh wrote:
>
> --
> 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 uns
Oops ..no u hav to quicksort it.
On Sat, Sep 10, 2011 at 8:24 AM, Dave wrote:
> @Abhinav: Does it work correctly on {1, 3, 2}, or, for that matter, on
> any array where the second largest comes after the largest?
>
> Dave
>
> On Sep 10, 10:16 am, abhinav gupta wrote:
> > temp2 is second largest
@Gaurav
wat if here is n=1
den
W(0)=?
i dint get that
--
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...@g
On Sat, Sep 10, 2011 at 11:22 AM, Neha Singh wrote:
> O(n/a)
For every n, it would add values for W(n-v1), W(n-v2),..., W(n-vm), if
there are m denominations of coins. So the complexity would be O(nm).
Also, this can be implemented in two ways. Top-down (which is what I
mentioned), and Bottom-up.
Euclid's GCD Algorithm:
http://www.cs.berkeley.edu/~vazirani/s99cs170/notes/lec3.pdf
On Sat, Sep 10, 2011 at 8:54 PM, Neha Singh wrote:
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@g
--
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 group at
ht
@Abhinav: Does it work correctly on {1, 3, 2}, or, for that matter, on
any array where the second largest comes after the largest?
Dave
On Sep 10, 10:16 am, abhinav gupta wrote:
> temp2 is second largest element.
>
> On Sat, Sep 10, 2011 at 8:00 AM, abhinav gupta
> wrote:
>
>
>
>
>
> > I can so
O(n/a)
where n is the required sum which is to be created by grouping the coins
and a is the coin of smallest denomination
so, O(n) in the worst case
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algoge
temp2 is second largest element.
On Sat, Sep 10, 2011 at 8:00 AM, abhinav gupta wrote:
> I can solve this problem in O(n)
> i=0;
> temp1=arr[0];
>
> while(i != len)
> {
> if(arr[i] > temp1)
> {
> temp2=temp1;
> temp1=arr[i]
> }
> i++;
> }
>
> On Sat, Sep 10, 2011 at 7:42 AM, Dave wrote:
>
>> @Re
You can use a trivial dynamic programming for this.
Let W(n) be the number of ways to create n rupees,
then W(n) = W(n-1) + W(n-5) + W(n-10) + W(n-25) + W(n-50)
if(n<0) then W(n) = 0
if(n==0) then W(n) = 1
What do you think would be the complexity of this solution?
On Sat, Sep 10, 2011 at 10:57
I can solve this problem in O(n)
i=0;
temp1=arr[0];
while(i != len)
{
if(arr[i] > temp1)
{
temp2=temp1;
temp1=arr[i]
}
i++;
}
On Sat, Sep 10, 2011 at 7:42 AM, Dave wrote:
> @Replying to my own posting: remove the words "one of the numbers that
> lost to", so that the explanation reads
>
> The q
There are set of coins of {50,25,10,5,1} paise in a box.Write a
program to find the number of ways a 1 rupee can be created by
grouping the paise.
post ur code.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this g
--
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 group at
ht
@Replying to my own posting: remove the words "one of the numbers that
lost to", so that the explanation reads
The question should be "How can we find the second largest element in
an array in n + ceiling(log_2(n)) - 2 comparisons?" The answer is to
use a tournament to select the largest number. T
1.)
there is a pyramid with 1 cup at level , 2 at level 2 , 3 at level 3 and so
on..
It looks something like this
1
2 3
4 5 6
every cup has capacity C. you pour L liters of water from top . when cup 1
gets filled , it overflows to cup 2,3 equally, and when they get filled ,
Cup 4 and 6 get water o
@amrit... +1 ..
With regards,
Praveen Raj
DCE-IT 3rd yr
--
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...@go
1 - 100 of 176 matches
Mail list logo