[algogeeks] Re: MICROSOFT:Given a BST and a number. Find two node in a BST whose sum is equal to given number in O(n) time and O(1) space.

2017-09-05 Thread deepikaanand
using iterators: __author__ = 'deepika' """ This code will return iterator for inorder traversal of a BST """ class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None def __repr__(self): return str(self.val)

[algogeeks] Re: @Walmart Labs interview questions

2012-10-31 Thread deepikaanand
Hi I appeared for walmart . the exam for for 90 min no negative marking mcqs were pretty easy almost all form geeksforgeeks(gate corner). 1 qsnetworking + 1qs on database(min and max number of rows possible in join table) , no of distinct colors required to color map of India .rest were from dat

Re: [algogeeks] Fwd: Snapdeal placement proceedure

2012-08-31 Thread deepikaanand
coding qs (section B) 1. find subarray of 0's and 1's with equal number of 1's and 0's 2. convert link list such that all vowels come in the begining 3. one of the nodes in BST is corrupted find that node 4. to arrange link list such that all alternating are in one and others(that is remaining

Re: [algogeeks] Fwd: Snapdeal placement proceedure

2012-08-31 Thread deepikaanand
> > 1. some question on fish which has tail and head and a relation was given > between its length from head to tail ..It was required to find the complete > length of fish (ans : 72 inches) too easy > > 2.How will you boil a egg for 9 min using timer of 4 min and 7 min > > 3. odd one out OTTFFS

[algogeeks] Re: CISCO Written Test ??

2012-08-26 Thread deepikaanand
written test will be (apti + tech) no negative marking apti from time , speed and distance, probablity , mixtures , profit and loss (easy) 2 qs to infer from the passage given(critical reasoning) 1 DI set (too simple) and technical qs 2 simple C o/p qs A large %age of qs was from digital logic de

[algogeeks] google paper

2012-08-10 Thread deepikaanand
Somebody from DCE plz tell the paper pattern of google... -- 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/-/BjLRVjRlekIJ. To post to this group, send email to

[algogeeks] Yahoo

2012-08-08 Thread deepikaanand
Has anyone appeared for Yahoo recentlyplz tell the pattern of the paper -- 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/-/HL1OrE0BzxYJ. To post to this g

Re: [algogeeks] directi paper pattern

2012-08-08 Thread deepikaanand
This is the file -- 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/-/CUTdpkjQnDcJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscr

[algogeeks] directi paper pattern

2012-07-31 Thread deepikaanand
can anyone tell me the pattern (selection procedure )followed by directi this year -- 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/-/uaKshpROlGoJ. To post t

[algogeeks] Re: Equal probability between 1-7

2012-07-28 Thread deepikaanand
int rand7() { int x = 5*rand5() + rand5(); //enlarge the range from (0 to 5 )to 0 to 24 by multiplying with 5 if(x > 20) return rand7() ;//recursive call else return x%7;//this will result in uniform distribution of number between 0-6 } -- You received this message because you are subscribed t

[algogeeks] Re: output

2012-07-25 Thread deepikaanand
sent... On Wednesday, July 25, 2012 9:18:46 PM UTC+5:30, jatin wrote: > > Trie ??if u have it to mail kardio... > On Wednesday, 25 July 2012 21:10:55 UTC+5:30, deepikaanand wrote: >> >> @ jatin >> then there is something wrong I executed d same prog which I have past

[algogeeks] Re: output

2012-07-25 Thread deepikaanand
@ jatin then there is something wrong I executed d same prog which I have pasted here...it was giving me the correct answer and for the second qs has no absolute answer it depends on compiler -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" gro

[algogeeks] Re: [Amazon]

2012-07-25 Thread deepikaanand
every element in 3D array can be written in the form of *(*(*(a+i)+j)+k) = a[i][j][k] ele = required element to be searched for say M = number of 3D matrices R = number of row C = number of col First find the most probable matrix in which the element might be present fix j = R-1 fix k = C-1 //as

[algogeeks] Re: output

2012-07-25 Thread deepikaanand
for the first o/p qs as p1 is moving towards the NULL('\0') character so is p2...to avoid dis save the base address and den let p2 move forward with p1 char *p1="Name"; char *p2; p2=(char *)malloc(20); char *save; save = (char *)malloc(20); save = p2; if(p2==NULL) cout<<"\n NOT ENOUGH SPACE"; els

[algogeeks] adobe aptitude test

2012-07-25 Thread deepikaanand
can anybody tell me which topics are asked in adobe apti test...and what is the usual level of qs asked in aptitude test... -- 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

[algogeeks] Re: Finding the repeated element

2012-07-19 Thread deepikaanand
http://ideone.com/vuAse -- 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/-/rbiZjy8dcgEJ. To post to this group, send email to algogeeks@googlegroups.com. To un

[algogeeks] Re: Amazon Interview Question

2012-07-12 Thread deepikaanand
If the assumption is that there is only one element which occurs once , some elements repeat twice and only one element which repeats thrice then following is the code according to the assumption made http://ideone.com/yseYy -- You received this message because you are subscribed to the Go

[algogeeks] Max sum circular array

2012-07-09 Thread deepikaanand
What is best approach to find max sum in a circular 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 unsubscribe from this group, send email to algogeeks+unsubscr...

[algogeeks] Re: Given only a pointer to a node to be deleted in a singly linked list how you handle deleting last node

2012-07-09 Thread deepikaanand
No there is no way to delete the last node in such a situation though u can replace the info part of such a last node with '#'though it wont delete the node but now u know that u can traverse the list while node->info != '#' -- You received this message because you are subscribed to the G

[algogeeks] Re: Microsoft interview qs

2012-07-09 Thread deepikaanand
@Atul thanx for the code its working for the example you took...Please check the same for i/p "abcmno","abcmnop" Algo displays:- mno It should display mno mnop... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send em

[algogeeks] Re: Inversion problem

2012-07-07 Thread deepikaanand
http://www.geeksforgeeks.org/archives/3968 On Jul 8, 11:01 am, Navin Kumar wrote: > Let A[n] be an array of n distinct number. If i A[j] then the > pair (i , j) is called inversion of A. > > Give an algorithm that determines the total number of inversions in > O(nlogn) time. -- You received th

[algogeeks] Re: Write a C program to reconstruct a BST from a given array of preorder traversal.

2012-07-04 Thread deepikaanand
@Navin I dont think der is any need to sort the preorder traversal given ...it will cost u more as sorting take O(n log n ) and recursion alone will take O(n^2) {mentioned in step 4 } sO the overall complexity will be the sum of two..+ space of O(n) //to store inorder traversal -- You received

[algogeeks] Re: Write a C program to reconstruct a BST from a given array of preorder traversal.

2012-07-04 Thread deepikaanand
code :- http://ideone.com/O5yuo -- 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

[algogeeks] Re: trie display

2012-06-28 Thread deepikaanand
It is not working..Even i tried to solve the problem using recursion but it didnt work code :- http://ideone.com/UhTTx -- 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 unsub

[algogeeks] Microsoft interview qs

2012-06-28 Thread deepikaanand
//Taken from careercup.com Design the autocomplete feature (ex:Google Suggest) I assumed {"abcde","abcegh","abcpqr","abcxyz","xyz" ,"abcmno"} URLs and stored them in trie...Such if the user enters abc ...the o/p will be abc is a prefix in 5 number of cases d e e g h m n o p q r x y z

[algogeeks] Re: trie display

2012-06-28 Thread deepikaanand
@Prem I know the implementation of trie...But I have doubt that say I have struct trie * current.. and input = "abc"...The last character matched with head->CHILDREN[i]- >letter will be 'c'... now "current" points to c next step- there will be 4 branches from 'c'..."de","xyz","efgh","pqr"..

[algogeeks] Re: trie display

2012-06-28 Thread deepikaanand
@Prem I know the implementation of trie...But I have doubt that say I have struct trie * current.. and input = "abc"...The last character matched with head->CHILDREN[i]- >letter will be 'c'... now "current" points to c next step- there will be 4 branches from 'c'..."de","xyz","efgh","pqr"...

[algogeeks] trie display

2012-06-27 Thread deepikaanand
If there is a trie of following strings(say URLs) "abcde","abcegh","abcpqr","abcxyz","xyz" if input = abc then output should be = de,egh,pqr,xyz How can I code for this ??? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this gro

[algogeeks] Re: Reverse Queue

2012-06-24 Thread deepikaanand
code:- http://ideone.com/yMQSK -- 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 op

[algogeeks] Re: Question asked in Amazon online test

2012-06-23 Thread deepikaanand
@saurabh..wat array r u getting finallyis it all 1's or in sorted order for the input int a[8]={1,1,1,0,1,0,1,1}; -- 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 unsubsc

[algogeeks] Re: Question asked in Amazon online test

2012-06-22 Thread deepikaanand
will bubble sort give number of swaps?? I tried the (bubble sort) code of 1,0,0,1,1,0,1 >swapcount = 5 and for the array (0,0,1,0,1,0,1,1)>swapcount = 3 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send em

[algogeeks] Re: Sorting using array of pointer

2012-06-22 Thread deepikaanand
@vindhya thanx .. -- 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

[algogeeks] Sorting using array of pointer

2012-06-22 Thread deepikaanand
//To sort an array of integers by not moving the element itself ..we can only use array of pointers...to adjust the pointers I have used bubble sortbut it only runs for the first pass when i = 0 ..but not for further values of i void sort(int A[]) { int i ; //int **a = &ptr[0]; for(i

[algogeeks] How are strings stored in memory??

2012-06-14 Thread deepikaanand
If a string is input via stdin char str[20]; cout<<"\n Enter string" ; cin>>str; //say xyz\npqr cout

[algogeeks] Re: finding anagrams in a list of words

2012-05-13 Thread deepikaanand
@gaurav the approach suggested as : to have an array of 25 prime nos..How is it supposed to work ; cz(this is wat i have understood) if a :0 ,b:1,c:3,d:5,e:7 then be = b + e = 1+7 =8 and dc = d + c =5 +3 = 8.. -- You received this message because you are subscribed to the Google Groups "Algori

[algogeeks] Algorithm internship question paper NSIT

2012-04-26 Thread deepikaanand
28 questions 120 min +1/-0.25 3 programming qs 1.to add two numbers stored in link list 2.to test is the given tree is a sumtree or not 3.to store numbers from a tree to a file and then retrieve those values and buld the tree Objective type qs 1. rec= fork(); rec= fork(); rec= fork(); rec= fork()

[algogeeks] Re: RBS internship paper

2012-03-10 Thread deepikaanand
NSIT On Mar 10, 12:50 pm, saurabh arora wrote: > which college -- 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+unsubsc

[algogeeks] RBS internship paper

2012-03-09 Thread deepikaanand
First Rounf : Aptitude paper :- three section(Quant,aptitude,verabal) 20 qs each part negative marking after 25 % of wrong attempts quant was quite difficult :- 1.questions from area of triangle(two find a side if longest side and other side along with area is given) 2.(loga + log b + log c)/log

[algogeeks] Qualcomm Internshhip Paper

2011-10-05 Thread deepikaanand
folowing is d internship paper of qualcomm (software position) 3 sections analytical,programming skills and CSE analytical paper had qs from relationships,to derive code ,pattern matching,sets ,i found it a little bit tough in comparison to other two sections programming paper had input o/p qs ve

[algogeeks] Qualcomm exam

2011-10-05 Thread deepikaanand
folowing is d internship paper of qualcomm (software position) 3 sections analytical,programming skills and CSE analytical paper had qs from relationships,to derive code ,pattern matching,sets ,i found it a little bit tough in comparison to other two sections programming paper had input o/p qs ve

[algogeeks] thread qs

2011-09-28 Thread deepikaanand
PLz expalin the output of the following program :- #include #include void *thread(void *); int main() { pthread_t t1,t2; char msg1[]="HELLO1"; char msg2[]="HELLO2"; printf("Before create1 \n"); pthread_create(&t1,NULL,thread,(void *)msg1); printf("after create1\n"); printf("before create2\n"); pt

[algogeeks] Re: output expalnation?

2011-09-26 Thread deepikaanand
junk value cz b=6 will not get executed -- 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. Fo

[algogeeks] royal bank of scotland

2011-09-14 Thread deepikaanand
wat is selection procedure of RBS (for internships or placements) -- 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+unsubs

[algogeeks] Re: Questions -->

2011-09-10 Thread deepikaanand
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

[algogeeks] Re: worst case complexity

2011-09-09 Thread deepikaanand
ans : O(n^5) inner most loop rums for j times then middle loop sums 'j ' from j=0 to j= i^2 so ans is proportional to i^4 and outer loop again sums it for n times so ans : O(n^5) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to th

[algogeeks] Re: enum vs macro

2011-09-04 Thread deepikaanand
macro is a pre processor directive while enum is not -- 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

[algogeeks] atrenta paper

2011-08-18 Thread deepikaanand
plz sm1 from NSIT upload Arenta qs paper -- 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. F

[algogeeks] suffix tree and skip list

2011-08-13 Thread deepikaanand
plz post the code for implementation of suffix tree and skip list in C/C++ -- 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 algoge

[algogeeks] Re: Goldman sachs _ DCE _ 10 AUGUST

2011-08-12 Thread deepikaanand
+1 ...plz upload the qs -- 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,

[algogeeks] Re: goldman sachs paper

2011-08-11 Thread deepikaanand
@Krishna can u plzz gv me hint what sort of aptitude qs are asked..as i dont practise Quant analysis type qs frequently..so do I need to go through aptitude books before the exam ? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to th

[algogeeks] Re: goldman sachs paper

2011-08-11 Thread deepikaanand
plzz post the paper ! ! -- 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

[algogeeks] Re: goldman sachs paper

2011-08-10 Thread deepikaanand
@UTKARSH i know the selection criteria but i want to know exactly the qs asked...plzz post a few qs if u knw any... -- 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 unsubscrib

[algogeeks] goldman sachs paper

2011-08-10 Thread deepikaanand
can anyone please post the questions asked in goldman sachs this year -- 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+un

[algogeeks] MS written test qs

2011-08-06 Thread deepikaanand
can any1 plz gv the solution of the following problem ;- You have to make a package library which will do the calculation of (a^b)mod(c), where a, b, c are very large size of 1 digits. (^- power). Design a data structure for the numbers' storage and suggest what functions will you be providing

[algogeeks] Re: Duplicates in a string

2011-08-05 Thread deepikaanand
static int array[256]; removedupli(char s[],int n) { array[s[0]]=1; for(i=1;ihttp://groups.google.com/group/algogeeks?hl=en.

[algogeeks] Re: remove duplicate words in a string

2011-08-05 Thread deepikaanand
ya an array of 256 is surely a wastage of space but this was i couls think in my microsoft interview as the result should have also been i place that is i/p : AAA BBB CCC o/p:A BC//space should also be removed ::explanantion s[0] is alwayz unique therfor array[s[0]] = 1 => this char has already occ

[algogeeks] Re: remove duplicate words in a string

2011-08-05 Thread deepikaanand
static int array[256]; removedupli(char s[],int n) { array[s[0]]=1; for(i=1;ihttp://groups.google.com/group/algogeeks?hl=en.