[algogeeks] Interns Required

2017-11-16 Thread Prateek Gupta
details : - Duration available for work. - College and Branch. -- Prateek Gupta MNNIT Allahabad. -- 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

Re: [algogeeks] Design Questions/Answers with UML

2014-06-27 Thread Gaurav Gupta
Hi, I am also looking for same ..please let me know in case you found some good source or good website to get examples of design problesm. Thanks Regards, Gaurav kumar gupta Senior Software Engineer Samsung Research India,Bangalore Contact No:+91-9538147434 Email id: gauravnit...@gmail.com

[algogeeks] Re: Google Interview Question: In how many intervals does a number exists

2013-06-11 Thread Monish Gupta
Adding to the question. See inline. On Sunday, June 9, 2013 12:50:46 PM UTC+5:30, Monish Gupta wrote: There are n Intervals. *1 = n = 1,000,000.* *Limits of interval are within 64 bit signed int.* Given a set of m numbers, tell in how many intervals does each number exists. Example: 4

[algogeeks] Google Interview Question: In how many intervals does a number exists

2013-06-09 Thread Monish Gupta
There are n Intervals. Given a set of m numbers, tell in how many intervals does each number exists. Example: 4 Intervals: [2,3] [3,4] [1,4] [3,10]. Numbers {2,4,11} For 2 - 1 as 2 lies only in 1 interval [2,3] For 4 - 3 as 4 lies in 3 intervals For 11 - 0 as 11 lies in none of the given 4

Re: [algogeeks] How will you implement a stack using a priority queue. Push and pop should be in O(1)

2013-05-27 Thread Monish Gupta
Hi Nishant As per the question, (priority queue) PQ is used to implement stack. With PQ, you cannot do push and pop both in O(1). If you use heap tree(max heap assuming you increase priority for upcoming pushed objects or min-heap otherwise) for PQ, it will take O(log n) for each operation

Re: [algogeeks] least common ancestore bst

2013-05-27 Thread Mangal Dev Gupta
static Node LCA(Node root, int a, int b) { if (root == null) return null; if (root.getData() == a || root.getData() == b) return root; Node root1 = LCA(root.getLeft(), a, b); Node root2 = LCA(root.getRight(), a, b); if (root1 !=

[algogeeks] Re: count number of set bits in an (big) array (Asked in Google interview)

2013-05-27 Thread Monish Gupta
You can use this logic to find number of bits set :- int count = 0; foreach(int x in array){ if(x 0) count--; //for the sign bit will be counted below. while(x){ x = x-1; count++; } } Thanks Monish On Sunday, May 12, 2013 1:05:31 AM UTC+5:30, rahul sharma wrote: I was

Re: [algogeeks] Re: count number of set bits in an (big) array (Asked in Google interview)

2013-05-27 Thread Mangal Dev Gupta
Hi Don, instead of searching 1 at all places we can use this : while(n!=0){ count++; n = n n-1; } On Fri, May 17, 2013 at 6:55 PM, Don dondod...@gmail.com wrote: Counting the set bits in one integer is not the problem which was asked. However, I think that something like this is both

[algogeeks] Re: What data structures will you use to implement a text editor. Size of editor can be changed and you also need to save the styling information for all the text like italic, bold etc.EO

2013-05-27 Thread Monish Gupta
You could also use Fly Weight pattern to implement this. http://en.wikipedia.org/wiki/Flyweight_pattern On Saturday, May 25, 2013 10:24:09 PM UTC+5:30, Nishant Pandey wrote: In one of the interview it was asked, can some one suggest good DS for this. Thanks -- You received this message

Re: [algogeeks] MS written Reasoning question

2013-05-02 Thread ashish gupta
Ans is 1 M.A + 2 B.Tech + 2 MBA + 1 MCA. Explanation: (1) Exactly one must be an MA. (2) Given: 2 b.tech are seleceted and the statement if at least one btech is selected then exactly 2 MBA are selected (vice versa condition) So exactly 2 MBA will be selected. (3) Remaining 1 would be MCA. So

[algogeeks] [Algorithm] Get Target

2013-04-03 Thread prankur gupta
Hi All, Could you help me this question. This was asked at Yelp Interview. Given 6 integers and 1 target value, write a function to get the target value using 6 integers with any on these operations +,*,-,/ Thanks -- PRANKUR GUPTA Masters Student (CSE) State University of New York Stony

Re: [algogeeks] Amazon Dynamic Programming problem

2013-01-12 Thread Raunak Gupta
how is winning going to decided On Sat, Jan 12, 2013 at 6:33 PM, siva sivavikne...@gmail.com wrote: consider there are N balls in a basket. 2 players play the turns alternatively ..AT each turn,the player can take 1 or 2 balls from the basket. the first player starts the game.. Both the

Re: [algogeeks] Re: Minimum sum of Array

2013-01-09 Thread prankur gupta
-- -- -- -- PRANKUR GUPTA Masters Student (CSE) State University of New York Stony Brook University prgu...@cs.stonybrook.edu --

Re: [algogeeks] Re: Amazon interview Question

2012-12-27 Thread Anurag Gupta
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 Anurag Gupta IV Year Computer Engineering Delhi Technological University

Re: [algogeeks] Re: Amazon interview Question

2012-12-21 Thread Anurag Gupta
.However there is no need to sort. 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 Anurag Gupta IV Year Computer Engineering Delhi

Re: [algogeeks] Amazon interview Question

2012-12-16 Thread Anurag Gupta
loop from the end of given number till you get a digit less than the previously scanned digit.Let the index of that number be 'i' . if index = -1,then the given number is the largest one else do the following 1) swap the digit at the index i with the digit just greater than it in the scanned

Re: [algogeeks] os question

2012-12-10 Thread sahil gupta
It's b. Windows follow this Operation. On Fri, Dec 7, 2012 at 4:21 AM, manish narayan.shiv...@gmail.com wrote: Four processes of 1gb,1.2gb,2gb,2gb are there and RAM available is 2gb. We have a time shared system. Which of the following is the most appropriate scheduling algorithm? a. all

Re: [algogeeks] VIDEO STREAMING

2012-11-23 Thread Prateek Gupta
@kartik +1:P :P PS : pardon the pun. On Sat, Nov 24, 2012 at 11:42 AM, Kartik Sachan kartik.sac...@gmail.comwrote: hey anybody has any idea about video streaming using vlcj lib ?? -- *WITH REGARDS, *KARTIK SACHAN B.Tech. Final Year Computer Science And Engineering Motilal

Re: [algogeeks] Re: swap objects without temp variable

2012-11-19 Thread abhinav gupta
and Regards,* Abhinav Kumar Gupta Member Technical Staff | Oracle India Pvt. Lmt. Bangalore (KA) - 560029. +919060407434 | +918123065622 abhinav@gmail.com --

Re: [algogeeks] Re: time complexity of gcd euclid algo(recursive)

2012-11-17 Thread Shruti Gupta
{ while(1) { int c = a % b; if (!c) return b; a = b; b = c; } } The complexity is log(a) + log(b) because each iteration reduces a+b by at least 25%. Don On Nov 13, 5:04 am, Shruti Gupta fundooshr...@gmail.com wrote: hi Can anyone help

[algogeeks] time complexity of gcd euclid algo(recursive)

2012-11-15 Thread Shruti Gupta
hi Can anyone help me find out the time complexity of recursive gcd algorithm (using euclid's algo) i.e. for the following program : int gcd(int n,int m) //given nm { if(n%m==0) return m; else return gcd(m,n%m); } i think the soln is lg(a*b) but have no idea how.. -- You

Re: [algogeeks] BIG O

2012-10-31 Thread jai gupta
is O(long n!) n! is O(n^n) by sterling approximation hence it is O(log n^n) = O(nlogn) On Sun, Oct 28, 2012 at 11:14 PM, Pralay Biswas pralaybiswas2...@gmail.comwrote: @ Siddharth : Well, here is how you may understand it: 1) There is an outer loop that runs n times. (k) 2) Then there is an

Re: [algogeeks] Problem

2012-10-31 Thread prankur gupta
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. -- PRANKUR GUPTA Masters Student (CSE) State University of New York Stony Brook University

Re: [algogeeks] Finite state automata accpt string of length 6

2012-10-27 Thread payal gupta
...@gmail.comwrote: can u please elaborate...i am not able to understand the figure..plz explainit would be of great help On Sat, Oct 27, 2012 at 5:57 AM, payal gupta gpt.pa...@gmail.com wrote: should be 6C3 or 20 perhaps. On Sat, Oct 27, 2012 at 3:29 AM, rahul sharma rahul23111

Re: [algogeeks] Finite state automata accpt string of length 6

2012-10-27 Thread payal gupta
AM, payal gupta gpt.pa...@gmail.comwrote: should be 6C3 or 20 perhaps. On Sat, Oct 27, 2012 at 3:29 AM, rahul sharma rahul23111...@gmail.com wrote: Finite state automata accpt string of length 6 what is total number of strings in set..please find the attahcment -- You received

Re: [algogeeks] INTERVIEW QUESTION

2012-10-27 Thread payal gupta
with the interviewer. On 27 October 2012 07:03, Raghavan its...@gmail.com wrote: By any chance did you read the new blog post by Gayle Laakmaan.. I guess to detect typos we can use some sort of Trie implementation.. On Fri, Oct 26, 2012 at 7:50 PM, payal gupta gpt.pa...@gmail.com wrote: Given

Re: [algogeeks] Finite state automata accpt string of length 6

2012-10-26 Thread payal gupta
should be 6C3 or 20 perhaps. On Sat, Oct 27, 2012 at 3:29 AM, rahul sharma rahul23111...@gmail.comwrote: Finite state automata accpt string of length 6 what is total number of strings in set..please find the attahcment -- You received this message because you are subscribed to the Google

[algogeeks] INTERVIEW QUESTION

2012-10-26 Thread payal gupta
Design the data structures and algorithms to detect typos in a document and then provide suggestions to the user. Thanx in advance, Regards, PAYAL GUPTA, NIT-B. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view

[algogeeks] INTERVIEW QUESTION

2012-10-26 Thread payal gupta
Given a cube with sides length n, write code to print all possible paths from the center to the surface. Thanx in advance. Regards, PAYAL GUPTA, NIT-B. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view

Re: [algogeeks] INTERVIEW QUESTION

2012-10-26 Thread payal gupta
implementation.. On Fri, Oct 26, 2012 at 7:50 PM, payal gupta gpt@gmail.comjavascript: wrote: Given a cube with sides length n, write code to print all possible paths from the center to the surface. Thanx in advance. Regards, PAYAL GUPTA, NIT-B. -- You received

Re: [algogeeks] Fwd: IVY comptech campus visit

2012-10-25 Thread payal gupta
One coding question : find the third largest no in the given array of elements (20 min) 15 mcqs on java and apti each followed by a tech and hr intervw. @ll d bst..:):) Regards, PAYAL GUPTA, NIT-B. On Thu, Oct 25, 2012 at 2:13 PM, sachin singh sachin...@gmail.com wrote: Can anyone tell about

Re: [algogeeks] C o/p adobe

2012-10-24 Thread SHOBHIT GUPTA
http://www.geeksforgeeks.org/archives/840 By default, the declaration and definition of a C function have “extern” prepended with them. It means even though we don’t use extern with the declaration/definition of C functions, it is present there. For example, when we write. int foo(int arg1,

[algogeeks] permutations using a stack

2012-10-21 Thread Shruti Gupta
if n=1,2,3 n we denote Push by P and Pop by X the we can generate following permutations : 1) PPPXXX = 321 2) PPXXPX = 213 3) PXPXPX = 123 4) PXPPXX = 132 5) PPXPXX = 231 conditions : #P's = #X's and At no point, #X's#P's Ques :- Given n elements, find the number of permutations which are

Re: [algogeeks] Java problem

2012-10-18 Thread Shruti Gupta
if u are extending Thread class, then u can simply make a new object of the class(that is extending thread) and you will get new instance for every thread. if u are implementing an interface, then when u create a thread object by Thread t=new Thread(object); and pass a different object

Re: [algogeeks] Directi Campus Placement Test

2012-10-15 Thread sahil gupta
There will be written test followed by technical and telephonic interview. For typical questions you refer to geekforgeeks.org. Sahil Gupta On Sat, Oct 13, 2012 at 12:56 AM, Bharat Singhvi bharatsinghvi.1...@gmail.com wrote: Hi, We have DirectI coming to campus tomorrow. I was wondering

Re: [algogeeks] finding element in array with minimum of comparing

2012-10-12 Thread Mangal Dev Gupta
was not first but somewhere in between, the loop will break there when coming from behind and size will have the index right? Why do we need to store elem in first position according to your code? On Sun, Oct 7, 2012 at 3:01 PM, Mangal Dev Gupta dev@gmail.comwrote: *@Dave while( arr

Re: [algogeeks] finding element in array with minimum of comparing

2012-10-08 Thread Mangal Dev Gupta
*@Dave while( arr[--size] != elem );* *Exception will come when it will encounter a[-1]* *i dont know if this loop will ever end... very poor solution i will say * On Sat, Oct 6, 2012 at 10:00 PM, Umer Farooq the.um...@gmail.com wrote: Well actually, I've just gone through Dave's code

Re: [algogeeks] Print Permutaion of a given String

2012-10-02 Thread Chaitanya Gupta
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. -- Chaitanya Gupta ABV - Indian Institute of Information Technology Management, Gwalior

Re: [algogeeks] longest palindrome in a string size 2*10^4

2012-09-23 Thread SHOBHIT GUPTA
http://www.leetcode.com/2011/11/longest-palindromic-substring-part-ii.html: linear time On Sat, Sep 22, 2012 at 5:33 PM, Aditya Raman adityarareloa...@gmail.comwrote: Hello everybody, I need to find a way of finding the longest palindrome in a very very long string (n=2) . a linear time

[algogeeks] Re: adobe question help

2012-09-13 Thread Navin Gupta
int temp = {[1(j-+1)]i-1}; Here temp is a number with all the bits set between positions i j [both inclusive] temp = ~temp; N = N temp; // here we are clearing all the bits of N from position i to j temp = temp | M; // now we are taking the bit pattern from M into temp

Re: [algogeeks] java question : How can one writes a function in Java that mocks the super() call without using the super keyword?

2012-09-13 Thread Shruti Gupta
if u'r talking about the use of super while calling constructors, u don't need to write anything.. compiler implicitly calls the no-argument constructor of superclass On Wed, Sep 12, 2012 at 10:56 AM, bharat b bagana.bharatku...@gmail.comwrote: -- You received this message because you are

[algogeeks] REARRANGE

2012-09-10 Thread payal gupta
A square picture is cut into 16 squares and they are shuffled. Write a program to rearrange the 16 squares to get the original big square. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Re: probability

2012-09-09 Thread Shruti Gupta
@Sukun: these probabilities should have been given in the questn.. since it's not given and there are 3 possible answers, i considered probability of each one of them to b correct as 1/3 (since there are 3 possible answers and only one answer is correct) On Sun, Sep 9, 2012 at 12:48 AM, Sukun

Re: [algogeeks] Re: probability

2012-09-08 Thread Shruti Gupta
shouldn't it b done like this : P(correct answer when choosing randomly )= P(choosing 0.25)*P(0.25 being correct ans)+ P(choosing 0.60)*P(0.60 being correct ans) + P(choosing 0.50)*P(0.50 being correct ans) = 2/4*1/3 + 1/4*1/3 + 1/4*1/3 [since 3 possible answers, hence prob of an ans

Re: [algogeeks] Accolite placement papers???

2012-09-08 Thread mitaksh gupta
Hey Varun, can you elaborate about the interview process a bit more.. like how many rounds are there.. and what to expect in each round. What to focus on mainly.. It would be of great help. Thanks Mitaksh Gupta On Sat, Sep 8, 2012 at 4:24 PM, varun singh varun2004si...@gmail.comwrote

Re: [algogeeks] Number of arrangements

2012-09-06 Thread Sandeep Gupta
Can you send the link to the question. On Thu, Sep 6, 2012 at 4:35 PM, tendua bharat.kra...@gmail.com wrote: from the six elements, we could choose any three in C(6,3) ways which is 20 and then permute all the three elements so it will be multiplied by 3! which is 6. Hence, 20*6 = 120. We

Re: [algogeeks] Enter in the loop challenge

2012-09-06 Thread SHOBHIT GUPTA
also the keywords like int , long etc cannot be included in macro On Wed, Sep 5, 2012 at 7:01 PM, Shashank Jain shashank29j...@gmail.comwrote: thanks that was a really nice explanation shashank On Wed, Sep 5, 2012 at 6:48 PM, Bala cmb...@gmail.com wrote: Source:

[algogeeks] Anyone Please give the Oracle Tech,Oracle Server, Oracle Finance interview process. What is the pattern of the online test?? It's coming on 9th Sept in NIT DGP. Any help will be greatly ap

2012-09-04 Thread sushant gupta
-- 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/-/e-dcYi1inIUJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this

[algogeeks] Re: max sum b/w 2 leaf nodes in a binary tree

2012-08-28 Thread Navin Gupta
I think the path between two leaves always passes thru root. Now we can keep track of root-to-leaf path whose sum is max and secondMax among all sums. Now between this two leaves path, root is repeated. Hence actual sum is maxsum + secondMaxSum - root-val; This can be done by iterative inorder

Re: [algogeeks] Re: CISCO Written Test ??

2012-08-26 Thread apoorv gupta
. -- * Thanks And Sincere Regards Apoorv Gupta Btech Final Year Computer Science And Engineering MNNIT Allahabad * -- You received this message

Re: [algogeeks] direct i online test

2012-08-24 Thread Anurag Gupta
The complexity of above code is exponential. Here is the simple recurrence for the given problem F(n) = 2*F(n-1) + F(n-2) + F(n-3) for n = 4 where F(1) = 2 F(2) = 5 F(3) = 13 precompute the values and each query will then be O(1) On Thu, Aug 23, 2012 at 8:22

Re: [algogeeks] JAVA PROGRAM ERROR

2012-08-22 Thread SHOBHIT GUPTA
Error : U didnt declare the variable n in stringTimes function . Just replace x with n . U'll get the answer . On Wed, Aug 22, 2012 at 12:41 AM, Rajesh Kumar testalgori...@gmail.comwrote: class StringTimes { public static void main(String args[]) { String str=Hi; long i=2; String get;

Re: [algogeeks] Interesting Question SPOJ

2012-08-17 Thread apoorv gupta
. -- * Thanks And Sincere Regards Apoorv Gupta Btech Final Year Computer Science And Engineering MNNIT Allahabad * -- You received this message

Re: [algogeeks] Interesting Question SPOJ

2012-08-17 Thread apoorv gupta
. -- * Thanks And Sincere Regards Apoorv Gupta Btech Final Year Computer Science And Engineering MNNIT Allahabad * -- You received this message because you

Re: [algogeeks] direct i online test

2012-08-13 Thread SHOBHIT GUPTA
shouldn't be the sum i.e. 4 taken as 1 ? On Mon, Aug 13, 2012 at 11:06 AM, vivek rungta vivekrungt...@gmail.comwrote: if sum is 4 output will be 33 On Mon, Aug 13, 2012 at 10:29 AM, SHOBHIT GUPTA shobhitgupta1...@gmail.com wrote: what will be the output if the sum is 4 ? On Sun, Aug

Re: [algogeeks] direct i online test

2012-08-12 Thread SHOBHIT GUPTA
what will be the output if the sum is 4 ? On Sun, Aug 12, 2012 at 11:22 PM, harsha harshacoo...@gmail.com wrote: A smart 3 year old Sandeep knows counting. But he doesn't know how to read and write properly. He has learnt 1, 2 and 3 but thinks that 4 is another way to write 1. So when given

[algogeeks] INTRVIEW QUESTION

2012-08-11 Thread payal gupta
Given the start and an ending integer as user input, generate all integers with the following property. Example : 123 , 1+2 = 3 , valid number 121224 12+12 = 24 , valid number 1235 1+2 = 3 , 2+3 = 5 , valid number 125 1+2 5 , invalid number -- You received this message because you are

Re: [algogeeks]

2012-08-09 Thread sahil gupta
Please wait for someone to reply. Then ask personally for paper through his or her email id. Stop spaming the group. Sahil Gupta. On Thu, Aug 9, 2012 at 9:56 PM, *$* gopi.komand...@gmail.com wrote: Mail to me also plz On Aug 9, 2012 9:55 PM, rahul sharma rahul23111...@gmail.com wrote: Mail

Re: [algogeeks] DE Shaw written test

2012-08-07 Thread Navin Gupta
@ashgoel :- Thanx for pointing it out, my earlier approach doesn't work. Please check if this works. We can apply this:- For every element, find the highest element to the right of it. For e.g: I/P:- 35 4015 35 10 20 Highest to Right:- 40 3535 20

Re: [algogeeks] DE Shaw written test

2012-08-05 Thread Mukul Gupta
This can be done in O(n) time complexity and O(1) space complexity using dynamic programming.Consider a situation in which I have been given an array of stock values for N days (in your case N=365) which looks like: int a [ ] = { 5, 10, 4, 6, 7 }; Now,use two variables min (which will keep track

Re: [algogeeks] DE Shaw written test

2012-08-05 Thread Mukul Gupta
Thanks for pointing out the mistake.Though my code will correctly calculate the max_profit but I must keep track of the buying_day.I have made some modification in my code.Hope it works fine now. int min = a[0]; // initialized to first element int max_profit = 0; //when you buy and sell on

[algogeeks] Re: coin problem

2012-08-05 Thread Navin Gupta
@Dave , the question clearly says that one group contains 10 heads while the other one contains 10tails. while ur answer gives equal no. of head and tails in each group. On Tuesday, 31 July 2012 17:28:59 UTC+5:30, Dave wrote: @Navin: Divide the coins into two groups of 10, and then flip all

[algogeeks] Re: heap insertion

2012-08-05 Thread Navin Gupta
the heap will be Level 1:- 1 Level 2:- 28 Level 3:- 3 4 10 12 Level 4:-

[algogeeks] longest continuous sequence

2012-08-05 Thread payal gupta
Find the longest subarray which consists of numbers that can be arranged in a continuous sequence. For ex- {4,5,1,5,7,6,8,4,1} output-{5,7,6,8,4}.Find the longest. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on

Re: [algogeeks] Local Minima in Unsorted Array

2012-08-05 Thread payal gupta
this could help although not true for many cases as said above http://ideone.com/w5gjK On Sun, Aug 5, 2012 at 8:40 AM, Ashish Goel ashg...@gmail.com wrote: can you give an example of what do you mean by Local minima? From Dave's example, it looks like the minima of the whole array.. Best

Re: [algogeeks] merging

2012-08-05 Thread payal gupta
int merge(int arr[],int n) { int l=0; int j=(n/3); int k=2*(n/3); int *a=(int*)malloc(sizeof(int)*n); for(int i=0;in/3;i++) { a[l++]=arr[i]; a[l++]=arr[j++]; a[l++]=arr[k++]; } for(int i=0;in;i++) arr[i]=a[i]; free(a); } cud be dun be dun recursively also to minimize d space complexity... On

Re: [algogeeks] merging

2012-08-05 Thread payal gupta
:32 AM, Navin Kumar algorithm.i...@gmail.comwrote: Actually i wanted to do it inplace. Using extra space it is much easier problem. On Mon, Aug 6, 2012 at 12:27 AM, payal gupta gpt.pa...@gmail.comwrote: int merge(int arr[],int n) { int l=0; int j=(n/3); int k=2*(n/3); int *a=(int

[algogeeks] Re: [Amazon]

2012-08-05 Thread Navin Gupta
@ankush, I think the worst case time complexity will be [ (M+N) * L ] this is beacuse, in the worst case all the 2-d arrays can probably contain the element. Now searching the single 2-D array needs O ( M+N ) But since there can be L such 2-D arrays in the worst case, Wors case TC- O[ (M+N) *

[algogeeks] Re: general tree into BST

2012-08-05 Thread Navin Gupta
I think a BST can be itself considered as a general tree. In case, we need to convert a general tree to BST :- The approach is :- 1- convert the general tree into a double linked list inplace - O(n) 2- Now apply merge sort on the doubly linked list - O(n) 2- Now convert the doubly linked list

Re: [algogeeks] Microsoft first round interview question.

2012-08-03 Thread sahil gupta
linked list?? How many pointers each node have?? On Thu, Aug 2, 2012 at 4:26 PM, Amit Basak abas...@gmail.com wrote: Does each node in the list have three pointers? What do you mean by straight doubly link list? Thanks, Amit On Wed, Aug 1, 2012 at 7:25 PM, sahil gupta sahilgupta

[algogeeks] Microsoft first round interview question.

2012-08-02 Thread sahil gupta
There is doubly link list and each node is having another pointer which is points to another doubly link list or points to null. You need make it straight doubly link list. Provide the efficient code. Sahil Gupta -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Directi Written Q 2012

2012-07-31 Thread SHOBHIT GUPTA
wat abt 32 On Mon, Jul 30, 2012 at 4:02 PM, Lucifer sourabhd2...@gmail.com wrote: @ ruru I think we can do it in log(n).. I am not jolting down the code but giving out the idea that would lead to log(n) time.. If we write down all the nos. in the binary format one below the other.. we

Re: [algogeeks] Re: Directi Written Q 2012

2012-07-31 Thread SHOBHIT GUPTA
sory fr prev wrng cmnt On Mon, Jul 30, 2012 at 4:04 PM, SHOBHIT GUPTA shobhitgupta1...@gmail.comwrote: wat abt 32 On Mon, Jul 30, 2012 at 4:02 PM, Lucifer sourabhd2...@gmail.com wrote: @ ruru I think we can do it in log(n).. I am not jolting down the code but giving out the idea

Re: [algogeeks] Re: absolute minimum difference

2012-07-28 Thread SHOBHIT GUPTA
@Arun : sort the array acc to their abs values . On Sat, Jul 28, 2012 at 9:51 AM, Arun Kindra arunkin...@gmail.com wrote: @Dave Sir : Sir if u sort the array(given above) the array would be: -20,-8-2,4,9,10,12,14,17, and according to ur suggestion, the only ans is {9,10}...but one of the ans

Re: [algogeeks] what will be output for this program ?

2012-07-28 Thread SHOBHIT GUPTA
64 32 16 32 16 32 64 32 Wats d prob ? On Fri, Jul 27, 2012 at 6:48 PM, Hraday Sharma hradaysha...@gmail.comwrote: #includestdio.h int main(){ printf(%d %d\n, 321, 320); printf(%d %d\n, 32-1, 32-0); printf(%d %d\n, 321, 320); printf(%d %d\n, 32-1, 32-0); return 0;

Re: [algogeeks] program

2012-07-26 Thread payal gupta
ans.20 On Thu, Jul 26, 2012 at 11:09 PM, Ali Ahmad Ansari ali.ahamad.ans...@gmail.com wrote: Given a number N, generate a sequence S such that S[ 0 ] = N S[ i+1 ] = (3 * S[ i ] + 1) / 2 if S[ i ] is odd, = S[ i ] / 2, if S[ i ] is even, till you reach 1. For example for N = 5, the

Re: [algogeeks] Java recursion Question !!

2012-07-26 Thread payal gupta
perhaps its this quoted line... permu(c,i+1,j); permu(c,i+1,n) On Thu, Jul 26, 2012 at 9:37 PM, teja bala pawanjalsa.t...@gmail.comwrote: // plz anyone tell me whats wrong in this code //o/p should print all possible permutations of string. class swap { char

Re: [algogeeks] heap insertion

2012-07-26 Thread payal gupta
ans:4 On Thu, Jul 26, 2012 at 11:26 PM, Ali Ahmad Ansari ali.ahamad.ans...@gmail.com wrote: Insert the numbers in the sequence 8, 5, 1, 4, 2, 10, 12, 7, 3 into a min-heap. The order of insertion is as given. The insertion happens as described

Re: [algogeeks] [Amazon]

2012-07-24 Thread SHOBHIT GUPTA
Sorry , I've tried but BS will not work here . On Tue, Jul 24, 2012 at 9:17 PM, algo bard algo.b...@gmail.com wrote: @Shobhit: Can you give me a few hints on implementing a BS on the 2D? @neelpulse: That's what I said. A 2D array *might* be a probable candidate. In your example, the first 2d

Re: [algogeeks] [Amazon]

2012-07-20 Thread SHOBHIT GUPTA
@algo bard : Why dont you use binary search in your first step (while comparing first and last element of 2d array) On Fri, Jul 20, 2012 at 4:25 PM, algo bard algo.b...@gmail.com wrote: Compare the element with the first([0][0]) and the last element([n-1][n-1]) of each 2D array to pin down the

Re: [algogeeks] Appropriate data structure

2012-07-15 Thread SHOBHIT GUPTA
agree with naveen On Sun, Jul 15, 2012 at 6:24 PM, Navin Kumar algorithm.i...@gmail.comwrote: I think stack would solve the purpose. please comment. On Sun, Jul 15, 2012 at 5:42 PM, enchantress elaenjoy...@gmail.comwrote: It says K days if you keep heap the order of values gets disturbed.

Re: [algogeeks] find the submatrix with largest sum

2012-07-14 Thread payal gupta
# On Fri, Jul 13, 2012 at 6:30 PM, payal gupta gpt.pa...@gmail.com wrote: given a n*n matrix of positive and negative integers ,find the submatrix with the largest sum -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion

[algogeeks] Re: Directi Interview Ques

2012-07-14 Thread Navin Gupta
As the final array contains element in stable-order, at any time we have 3 options for choosing the elements from A B. 1- A[i] A[i+1] 2- A[i] B[I] 3- B[i] B[i+1] we will choose that pair whose product is maximum. For ex:- A-2,1,3 B-3,7,9 C- 3,7,2,9,1,3 Its a linear time solution with

Re: [algogeeks] Directi Interview Ques

2012-07-13 Thread payal gupta
i guess this algo would work... 1.scan the two array a and b from the end say the indexs be i j respectively for the two arrays 2.compare the elements a[i] with b[j] if a[i]b[j] include b[j] j-- else if a[i]b[j] then include a[i] j-- else if recursively findin reducing which

[algogeeks] find the submatrix with largest sum

2012-07-13 Thread payal gupta
given a n*n matrix of positive and negative integers ,find the submatrix with the largest sum -- 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/-/4V_eLYu5KA0J.

Re: [algogeeks] Re: Amazon Interview Question

2012-07-13 Thread Shruti Gupta
@jatin: even i think it will b more than O(n).. infact it will be O(n-square) in the worst case as if each hit is spurious(until the last element of course) we will have to traverse the array for each spurious hit.. thus giving the worst case time of O(n-square) On Fri, Jul 13, 2012 at 8:29 PM,

Re: [algogeeks] seperate diff types of coins

2012-07-10 Thread payal gupta
weighing Groups 2nd total weights is y units Second weighing. Lastly one more weighing among a unit and b unit coins.---3 rd weighing So minimum 3 weighing is required. On Tue, Jul 10, 2012 at 11:03 AM, payal gupta gpt.pa...@gmail.com wrote: You have 8 coins. 3 of them

Re: [algogeeks] Re: seperate diff types of coins

2012-07-10 Thread payal gupta
,it isnt the cumulative sum of the coins as u considered ,thats what i got from the question.. Correct me if i'm wrong. Could it be done it done in lesser than 8 weighings?? Regards, PAYAL GUPTA. On 7/10/12, Dave dave_and_da...@juno.com wrote: @Gupta: You haven't defined the problem sufficiently

[algogeeks] seperate diff types of coins

2012-07-09 Thread payal gupta
You have 8 coins. 3 of them weigh x units, 3 y units, 1 a units and 1 b units. They are all mixed and look identical. What are the minimum no of weighings reqd to seperate the for types of coins??? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] C o/p

2012-07-08 Thread mitaksh gupta
the o/p will be 2 not 1 because of the post-increment operator. On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote: int i=5; i=++i/i++; print i; i=1 how? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] MS Design Ques

2012-07-05 Thread payal gupta
thnx...4 d rply.. Regards, PAYAL GUPTA, NIT-B. On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra anshumishra6...@gmail.comwrote: First define all the basic operation you can apply on two numbers. Binary operation : +, -, *, /, %, optional((and), |(or), ^(xor)) Unary operation

[algogeeks] MS Design Ques

2012-07-01 Thread payal gupta
design a BIG_INT library... Regards, PAYAL GUPTA, NIT-B. -- 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/-/EHIiPPFJ4t0J. To post to this group, send email

[algogeeks] Re: Microsoft Interview Question

2012-06-30 Thread Navin Gupta
. Navin Kumar Gupta Final Year, B.Tech (Hons.) Computer Science Engg. National Institute of Technology,Jamshedpur Mob - (+91) 8285303045 On Friday, 29 June 2012 22:28:15 UTC+5:30, Dave wrote: @Navin: Try this with {1,-1,2}. current points to the 1 and end points to the 2. Since 1 is positive

[algogeeks] Re: Fixing Up The Binary Search Tree

2012-06-30 Thread Navin Gupta
element. - O( N ) 2:- Now convert the doubly linked list into tree recursively. -O(N) http://www.geeksforgeeks.org/archives/17063 Return the root of the new tree formed.-- Navin Kumar Gupta Final Year,B.Tech(Hons.) Computer Science Engg. National Institute of Technology,Jamshedpur Mobile

[algogeeks] Re: first Repeating character in a string

2012-06-30 Thread Navin Gupta
) first_repeating_pos = count[i][0]; -- Navin Kumar Gupta Final Year,B.Tech(Hons.) Computer Science Engg. National Institute of Technology,Jamshedpur Mobile - (+91)8285303045 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion

[algogeeks] Re: Microsoft Interview Question

2012-06-28 Thread Navin Gupta
Kumar Gupta Final Year, B.Tech (Hons.) Computer Science Engg. National Institute of Technology,Jamshedpur Mobile - 8285303045 -- 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

Re: [algogeeks] Find peak element in log(n)

2012-06-24 Thread aditya gupta
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. -- Aditya Gupta B.Tech III

[algogeeks] Re: Question asked in Amazon online test

2012-06-23 Thread Anurag Gupta
if we just need to determine number of swaps, it can be Done in O(n) Ex : 11100010 start counting number of zeros from the end so we have zeroCount = 1 whenever we encounter a 1 we add current zeroCount to numberOfSwaps so numberOfSwaps = 1 and so on the final value of numberOsSwaps is the

[algogeeks] Re: Microsoft Interview Question

2012-06-21 Thread Anchal Gupta
@akshat ur code doesn't give intact output, so i modified ur code and here is the code : int j=0,k=0; for (i = 0; i n; ++i) { if(a[i]0) { a[j] = a[i]; j++; } else { temp[k] = a[i]; k++; } } k=0; for (i = j; i n; ++i) {

[algogeeks] LCA tutorial

2012-06-19 Thread Ankit Gupta
I was going through this tutorial http://community.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor but i was not able to fully understand the O(N), O(1) algorithm for the restricted RMQ. They have converted the array into a new binary array and find a solution for this new

  1   2   3   4   5   6   7   8   9   >