[algogeeks] Cliched 'k' largest elements in billion numbers: Heaps or median-of-medians?

2011-12-11 Thread bharath sriram
Hey group, This is kind of a cliched question but given a file with billion numbers and the task is to compute 'k' largest numbers from this file, what approach is preferred? 1) Using heaps 2) Using Median-of-median algorithm. Have read few links which prefer heaps but clearly median of median al

Re: [algogeeks] Re: Linear time Binary tree re-construction

2011-11-27 Thread bharath sriram
The in-order and pre-order traversal are already given. So, there is no way to do what you are saying if I understand you completely. On Sun, Nov 27, 2011 at 8:19 AM, Ankuj Gupta wrote: > Hint : try with prestoring the preorder traversal element position in > inorder traversal before constructin

Re: [algogeeks] Finding the repeated element

2011-11-26 Thread bharath sriram
*Assumptions*: - All positive elements in the array - All elements in array are in range 0 to (n-1) [ n - # of elements] 1) Scan the array. For every element A[i], negate the value stored in A[A[i]]. 2) If you encounter an element already negated, then that represents the duplicate element. On T

Re: [algogeeks] Amazon - Coding Round-2 Qn

2011-09-04 Thread Bharath Sriram
Can anyone please explain the logic instead of the actual code? Sent from iPhone. On Aug 31, 2011, at 4:16 AM, aditya kumar wrote: > > @rohit : else return (check(tree->left) || check(tree->right)); should be > else return (check(tree->left) && check(tree->right)); > we need both

Re: [algogeeks]

2011-08-30 Thread bharath sriram
Sukran, There's a thread I started recently which asks about binary tree isomorphism. But to sum it all up here, isomorphism refers to "same structure". Though "isomorphism" is used pretty flexibly w.r.t to binary trees, here's what I have read from different sources. - 2 binary trees are isomorp

Re: [algogeeks] Re: 2 Binary trees are isomorphic?

2011-08-29 Thread bharath sriram
Would this work: boolean IsQuasiIsomorphic(Node x, Node y) { if (x == null && y == null) return true // both null if (x == null || y == null) return false // exactly one null //Else, the left sub-tree of tree 1 is isomorphic to the left or right subtree of tree 2 return ( ( IsQ

[algogeeks] 100th Fibonacci number using LL

2011-07-31 Thread bharath sriram
Since both the "normal" recursive (stack overflow) and non-recursive (data type overflow) versions fails, is there a way one can use linked lists to solve this problem? Bharath. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to thi

[algogeeks] Word count using linked lists

2011-07-30 Thread bharath sriram
The subject has the problem description. What are some efficient ways of doing this. As always, the approach description is more useful than the actual code itself. Thanks! Bharath. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to

[algogeeks] Recursive version of reversing linked list

2011-07-30 Thread bharath sriram
Can anyone give the recursive version of reversing a linked list. Please post the reverse function code snippet and not the entire .c file since it just hampers readability. Bharath. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to

Re: [algogeeks] Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-16 Thread Sriram gupta
Use Max - heap of size K. On Wed, Mar 16, 2011 at 10:36 AM, DIPANKAR DUTTA wrote: > use heap tree to slove this.. > plz see careercup post.. > > > On Wed, Mar 16, 2011 at 10:31 AM, Ankit Sinha wrote: > >> Asked in Amazon interview.. >> >> Find the first K smallest element from 1 million sized a

[algogeeks] Passing array to servlets

2010-11-08 Thread Sriram Kumar
I need to pass an array of values from html(preferably Javascript) to servlets... Plz give me the coding I need to use... -- 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 unsu

[algogeeks] Invitation to connect on LinkedIn

2009-11-15 Thread Sriram Narasimhan
LinkedIn Sriram Narasimhan requested to add you as a connection on LinkedIn: -- Phani, I'd like to add you to my professional network on LinkedIn. - Sriram Accept invitation from Sriram Narasimhan http://www.linkedin.

[algogeeks] Academic Developers Conference

2008-01-11 Thread Sriram Narasimhan
*Microsoft Student Partners, Chennai & CNUGStudent.Net* *Present* *ACADEMIC DEVELOPER CONFERENCE* *ADC 2008* *http://cnugstudent.net www.student-partners.com* * * * * Hi All, Microsoft Student Partners of Chennai and the CNUG Student Chapter are proud to present the Academic

[algogeeks] Re: a book for data structures

2006-07-24 Thread Sriram Narasimhan
Hi gupta, you can use Data structures and algorithms by mark allan weiss for learning DATA structures...   All the best.   Sriram.N  On 7/24/06, gupta <[EMAIL PROTECTED]> wrote: hai frnz...this is gupta, student of iitm doing masters in non csc background. iam very new for this group.

[algogeeks] Re: help

2006-07-24 Thread Sriram Narasimhan
Hi     there are plenty of websites that fetch you data and i feel that everything is just a click away.So just choose books if you want else just start learning via tutorials.   All the best.   Sriram.N  On 7/9/06, hosseingt <[EMAIL PROTECTED]> wrote: hii'm a begginer.can anyone guide me how to s

[algogeeks] Re: Algorithm for sorting 7 elements

2006-06-12 Thread Sriram narasimhan
Hi     The best algorithm which you can use which has minimal space and time complexity is RADIX SORT...But one doubt do you really specify that every column has one element in it? Anyway you can process your array using RADIX SORT..   Sriram.N  On 6/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wr

[algogeeks] Re: Call For Participation: WORLDCOMP'06 (Computer Science & Computer Engineering), June 26-29, 2006, Las Vegas, US

2006-06-08 Thread Sriram narasimhan
Dear sir, I m Sriram doing my first year ENGG at Hindustan college of Engg,chennai,India. Actually im interested in attending the WORLDCOMP'06 but due to the semester examinations i would not be attending the programme.Thanks a lot for your invitation.I look forward to atten

[algogeeks] doubt

2006-06-07 Thread Sriram narasimhan
hi everyone,   1.Can topological sorting be stated as an application of depth first search(DFS)...   2.What is inorder predecessor?how wil i find it???   pls reply   Sriram --~--~-~--~~~---~--~~ You received this message because

[algogeeks] Re: Sorting algorithms

2006-06-07 Thread Sriram narasimhan
hi ankur,  Thanks for sending me the link but the greedy algorthms are not opening...wat should i do now...   Sriram     On 6/7/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: hey sriram i got this animated greedy for u .may be u can try it out ...the link: http://oopw

[algogeeks] Sorting algorithms

2006-06-06 Thread Sriram narasimhan
hi guys,    can anyone mail me the sorting algorithms and other greedy algorithms in animated format...i want it vey badly so as to study for the univ examination...pls mail me...   Sriram.N --~--~-~--~~~---~--~~ You received this message because you are sub

[algogeeks] Re: Writing C program without main()

2006-05-27 Thread Sriram narasimhan
Hi arunachalam    The program you have suggested is not working...can you tel me any other way...   Sriram  On 5/27/06, Arunachalam <[EMAIL PROTECTED]> wrote: How about this program?   #include #define FULL ma##in int FULL (){    printf("hello world");    r

[algogeeks] Re: Lower number

2006-05-26 Thread Sriram narasimhan
Sort the elements initially and then you can logically solve it..i don kno the logic..but do mail me if you get a logic.pls help me i m beginnin to learn computers...   Sriram.N  On 5/19/06, Terry <[EMAIL PROTECTED]> wrote: Hi,If i have an array like {1,4, 10, 15 , 20 , 30 }  of size n , now if iwa

[algogeeks] doubt boss...

2006-05-26 Thread Sriram narasimhan
hi guys,     i wrote a program for arrays and i declared only a[3]. but my array accepts a[5]=10; statements and other statements...how is that possible..arrays are considered as continuous memory of same datatype isnt it...but the array a[3] becomes discontinuous...   wat could be the pos

[algogeeks] Re: Doubt in DS

2006-05-26 Thread Sriram narasimhan
/06, A S Grewal <[EMAIL PROTECTED]> wrote: Hi Sriram,Pop by definition must clear the last inserted value from the memory.So yes, you should be able to overwrite in that space. Ajeet --~--~-~--~~~---~--~~ You received this message because you are subscribed

[algogeeks] Doubt in DS

2006-05-25 Thread Sriram narasimhan
hi guys, When we use the pop function in stacks are the values deleted from the memory or not...that means we must be able to ovewrite in that spaces right...Can anyone clear my doubt...   Sriram --~--~-~--~~~---~--~~ You received this message because

[algogeeks] Re: Writing C program without main()

2006-05-25 Thread Sriram narasimhan
hi arul,    i think you can write a program in c without main().The main fn is used to start the program so if you could direct the compiler how to proceed about then you can definitely write the program.   sriram  On 5/14/06, Arulanandan P <[EMAIL PROTECTED]> wrote: hi ,     Can a

[algogeeks] Re: Algorithm for time-slot allocation

2006-05-07 Thread Sriram narasimhan
queues are inmplimented on the firstcome first served The principle for queues is FIFO ie first in first out... mail me u r comments..   Sriram  On 5/7/06, akshay ranjan <[EMAIL PROTECTED]> wrote: Are the queues being implemented on first come first serve basis or is thre some priorit

[algogeeks] Re: Algorithm for time-slot allocation

2006-05-07 Thread Sriram narasimhan
sorry adak...but i want all you guys to help me out in learning computers...sorry pls reply me...   Sriram  On 5/7/06, adak <[EMAIL PROTECTED]> wrote: Welcome to you both. Sriram, it's VERY discourteous to post anunrelated reply to Anish's post, just above. Either don't do

[algogeeks] Re: Algorithm for time-slot allocation

2006-05-06 Thread Sriram narasimhan
Hi anish     i m sriram...i m also new to this group doing my firstyear engineering.i m interested in learning more on computerspls help me to learn more and pls teach me the logics and other stuffs which are necessary for me...introduce me to your friends also... thankyou   Sriram.N

[algogeeks] Re: How to Sort a Stack in ascending order

2006-05-05 Thread Sriram narasimhan
i dont think it is specific for array implimentation of stacks.   Sriram.  On 5/6/06, akshay ranjan <[EMAIL PROTECTED]> wrote: isn't this specific for array implementation of stack onlyits written in the original ques that no assumptions about the implementation are to be mad

[algogeeks] Re: How to Sort a Stack in ascending order

2006-05-05 Thread sriram
hi geeks... my query is 1. if the user presses 1,0 should be printed and if the user presses 0,1 should be printed. 2. no usage of conditional statements. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm