Re: [algogeeks] second smallest in array

2012-10-24 Thread sangeeta goyal
http://ideone.com/FqnSq see the link for tournament method On Wed, Oct 24, 2012 at 5:12 PM, rahul sharma rahul23111...@gmail.comwrote: for this shall we process all items and parallely calculate first and second max. or tournament methos i best for thsi.. if tournament method is best can

Re: [algogeeks] Re: give the algo or program to find second largest element in a list using tournament method

2012-10-12 Thread sangeeta goyal
can anybody tell why this code is not giving correct output for finding second smallest using tournament method? my approach is same as @Don approach On Wed, Sep 5, 2012 at 12:16 PM, shashi kant shashiski...@gmail.com wrote: Heap's good but the i think problem clearly mentions Tournament sort

Re: [algogeeks] Re: give the algo or program to find second largest element in a list using tournament method

2012-09-04 Thread sangeeta goyal
elements in the multimap with key is the element which has beaten them with key as winner return maximum element stored in multimap On Mon, Sep 3, 2012 at 3:31 PM, sangeeta goyal sangeeta15...@gmail.comwrote: @bharat is it tournament method?? On Mon, Sep 3, 2012 at 2:34 PM, bharat b

Re: [algogeeks] Re: give the algo or program to find second largest element in a list using tournament method

2012-09-04 Thread sangeeta goyal
@Don nice solution using max heap.it is very simpler to understand On Tue, Sep 4, 2012 at 8:54 PM, Don dondod...@gmail.com wrote: Constructing a max-heap is O(n*log n) However, the problem asked for a solution using tournament method. If you ignore that requirement, an O(n) solution is

Re: [algogeeks] Re: give the algo or program to find second largest element in a list using tournament method

2012-09-03 Thread sangeeta goyal
(); element B = elements.dequeue(); if (A.value B.value) swap(A,B); if (A.largestBeaten B.value) A.largestBeaten = B.value; elements.enqueue(A); } return queue.head().largestBeaten; } On Aug 30, 12:53 pm, sangeeta goyal sangeeta15...@gmail.com wrote: @Don can you give

Re: [algogeeks] Re: give the algo or program to find second largest element in a list using tournament method

2012-08-30 Thread sangeeta goyal
of the largest element it has beaten, you'll get the second largest naturally. Don On Aug 29, 9:15 am, Sangeeta sangeeta15...@gmail.com wrote: give the algo or program to find second largest element in a list using tournament method -- You received this message because you are subscribed

[algogeeks] give the algo or program to find second largest element in a list using tournament method

2012-08-29 Thread Sangeeta
give the algo or program to find second largest element in a list using tournament method -- 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/-/F2h8yx2END8J. To

[algogeeks] zig zag problem

2011-12-15 Thread Sangeeta
Problem Statement A sequence of numbers is called a zig-zag sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with fewer than two elements is trivially a

[algogeeks] Dynamic programming problem

2011-12-15 Thread Sangeeta
Given a list of N coins, their values (V1, V2, ... , VN), and the total sum S. Find the minimum number of coins the sum of which is S (we can use as many coins of one type as we want), or report that it's not possible to select coins in such a way that they sum up to S. For a better understanding

Re: [algogeeks] Dynamic programming problem

2011-12-15 Thread sangeeta goyal
; result[k]= result[k] + result[index]; end end print result[S]; On Fri, Dec 16, 2011 at 10:52 AM, Sangeeta sangeeta15...@gmail.comwrote: Given a list of N coins, their values (V1, V2, ... , VN), and the total sum S. Find the minimum number of coins the sum of which is S (we can use

[algogeeks] given a stream of numbers FIND MEDIAN

2011-12-15 Thread Sangeeta
You are given a stream of numbers which can be positive or negative. You are required to provide an operation FIND MEDIAN..which when invoked should be able return the median of the numbers in stream (in sorted order) in O(1) time. -- You received this message because you are subscribed to the

Re: [algogeeks] request of ebook..(Data Structures and algorithms made easy:)

2011-09-26 Thread sangeeta goyal
i also need that book On Mon, Sep 26, 2011 at 6:00 AM, Amit Mittal amit.mitt...@gmail.com wrote: plz send me that book too On Mon, Sep 26, 2011 at 3:28 PM, Ishan Aggarwal ishan.aggarwal.1...@gmail.com wrote: plz send me that book to I also need that book... On Sun, Sep 25,

[algogeeks] identify all the affected nodes in a Graph

2011-09-19 Thread Sangeeta
A graph is given : nodes denoting computers edges denoting connections if one system(node) fails , the other systems(node) may get affected. To identify all the affected nodes, which data structure is used? How do u implement it? -- You received this message because you are subscribed to the

[algogeeks] Stack problem

2011-09-04 Thread Sangeeta
How would you design a stack which,in addition to push and pop,also has a function min which returns the minimum element?push,pop and min should all operate in O(1) time -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

Re: [algogeeks] c doubt

2011-07-14 Thread sangeeta goyal
thnx all...i got it :) On Thu, Jul 14, 2011 at 2:13 AM, Anika Jain anika.jai...@gmail.com wrote: As in base 10 we say 552.5 is same as 5.525 *10^2 , here 2 is the exponent of base 10.. so similarly in binary nos. for base 2 here if i make 101.00110011.. to 1.0100110011.. *2^2 my exponent

[algogeeks] c doubt

2011-07-09 Thread Sangeeta
int main(){ int i; float a=5.2; char *ptr; ptr=(char *)a; for(i=0;i=3;i++) printf(%d ,*ptr++); } output: 102 102 -90 64.explain? -- 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.

[algogeeks] c doubt

2011-07-04 Thread Sangeeta
#Iincludestdio.h #includestring.h main() { char str[]=S\061AB; printf(\n%d,strlen(str)); } output:4 why? -- 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

[algogeeks] Re: c doubt

2011-07-04 Thread Sangeeta
ok,thanx On Jul 4, 12:29 pm, Vishal Thanki vishaltha...@gmail.com wrote: because \061 is considered as a single char in ur string.. On Mon, Jul 4, 2011 at 12:52 PM, Sangeeta sangeeta15...@gmail.com wrote: #Iincludestdio.h #includestring.h main() { char str[]=S\061AB; printf

Re: [algogeeks] c doubt

2011-07-04 Thread sangeeta goyal
PM, Sangeeta sangeeta15...@gmail.com wrote: #includestdio.h #includestring.h void main() { char a[2][5]= { hellodear, hi}; printf(%s%s,a[0],a[1]); } output:hellohi hi explain? -- You received this message because you are subscribed

[algogeeks] write an algo that deletes all negative integers without changing the order of remaining elements of the queue

2011-06-10 Thread Sangeeta
write an algo that deletes all negative integers without changing the order of remaining elements of the queue -- 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