[algogeeks] Re: microsoft interview

2011-09-08 Thread Amit Gupta
Guys, why don't we do something like this : 1. If (arrayHasBeenTraversed, Goto 4). Else, Traverse the 2-D array [row,column] wise. Inspect element array[row][column]. Goto 2. 2. If you encounter a '1' (array[row][column]), change all the 0's in the corresponding [row,column] to '-1' Al

Re: [algogeeks] stack implementation with a constraint

2011-09-08 Thread surender sanke
@bharat take two hashmaps of hash1 and hash2 take frequency of a data from hash1, and find its list in hash2. if ur poping, reduce frequency in hash1 and in corresponding hash2 remove its entry in that list and put it in freq-1 entry and keep track of max and second max of highest frequncy value of

Re: [algogeeks] future first????

2011-09-08 Thread praveen raj
Full of Aptitude. they check the speed and accuracy... With regards, Praveen Raj DCE-IT 3rd yr 735993 praveen0...@gmail.com On Thu, Sep 8, 2011 at 3:33 AM, htross wrote: > future first is coming to our college.what kind of questions will > be asked in first round > > -- > You

Re: [algogeeks] stack implementation with a constraint

2011-09-08 Thread bharatkumar bagana
@surender: say the hash table of is as follows... <1,2->3->4> <2,5->6> <3,7->8> pop(7) would decrease the frequency of element 7 means that element has to be added to 2nd key i.e <2,5->6->7> here how do u get the element 7 from hash table as freq is the key element in u'r table? And after getting

Re: [algogeeks] sorting

2011-09-08 Thread siddharam suresh
@praveen raj: yes bubble sort takes O(N) in best case, but selection sort it depends the selection algo(does the selection starts from the first(then itsO(n)) or last(then its O(N^2)) Thank you, Sid. On Fri, Sep 9, 2011 at 11:20 AM, praveen raj wrote: > for checking whther given array sorted or

Re: [algogeeks] sorting

2011-09-08 Thread praveen raj
for checking whther given array sorted or not... bubble sort or insertion sort... takes O(n).. time... With regards, Praveen Raj DCE-IT 3rd yr 735993 praveen0...@gmail.com On Thu, Sep 8, 2011 at 11:32 PM, aayush jain wrote: > thanx @piyush > > -- > You received this message because y

Re: [algogeeks] ACM

2011-09-08 Thread Piyush Kapoor
Go Go Go!!! On Fri, Sep 9, 2011 at 11:07 AM, Kunal Patil wrote: > Cool.. If you can share/ask algorithm related programming questions.. :) > In fact it is the main cause of this group. :) :) :) > There are sufficient SPOJ problem discussions over here.. > You can continue asking questions if you

Re: [algogeeks] stack implementation with a constraint

2011-09-08 Thread surender sanke
maintain a hash of linked_list consists of values of that frequency. values with same frequency comes under same list if pop of a particular value is done, then frequency is changed of that number, a new record would be created if required. maintain two values tracking max and second_max, which wo

Re: [algogeeks] ACM

2011-09-08 Thread Kunal Patil
Cool.. If you can share/ask algorithm related programming questions.. :) In fact it is the main cause of this group. :) :) :) There are sufficient SPOJ problem discussions over here.. You can continue asking questions if you think, that particular problem needs special data handling techniques to m

Re: [algogeeks] Kth largest element

2011-09-08 Thread praveen raj
I am considering.. Maxheapify... A[parent(i)]>=A[i] kth largest element... therefore O(klogn)... k times u have to extract the largest element and logn to maintain the maxheapify everytime. minheapifyA[parent(i)]<=A[i] kth largest element that means ... (n-k) smallest element. the

[algogeeks] ACM

2011-09-08 Thread Manish Verma
Hey, anyone preparing for acm-icpc what about discussing acm-icpc questions here what say @shady?? -- 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

Re: [algogeeks] computer organization

2011-09-08 Thread vishwa
I suggest you read virtual memory concept one more time(Galvin (OS priciples))... and of course as you said CPU registers also matters... RAM extension is mainly depends on processor...whether it is 16 bit or 32 or 64... You check the entry for PHYSICAL ADDRESS EXTENSION in wikipedia.. hope that w

Re: [algogeeks] Re: MICROSOFT

2011-09-08 Thread praveen raj
Through heapsort k times... O(klogn) . With regards, Praveen Raj DCE-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 al

Re: [algogeeks] computer organization

2011-09-08 Thread bharatkumar bagana
@vishwa : Only addr bus!! or opcode also needed to fit in the register think of it .. and 2nd quest(RAM limitation)ans? On Fri, Sep 9, 2011 at 10:06 AM, vishwa wrote: > It depends on Address Bus... whether its 32bit or 64 bit... its like can > address bus hold that address. > > > On Fri, Sep

Re: [algogeeks] Re: MICROSOFT

2011-09-08 Thread bharatkumar bagana
@himansu: how can quicksort selecting kth largest element be done in O(n) time ...I think in worst case it takes O(n^2) time will u pls explain this. On Fri, Sep 9, 2011 at 2:10 AM, Himanshu Neema < potential.himansh...@gmail.com> wrote: > @Dave: Thanks for pointing that out . > > In

Re: [algogeeks] computer organization

2011-09-08 Thread vishwa
It depends on Address Bus... whether its 32bit or 64 bit... its like can address bus hold that address. On Fri, Sep 9, 2011 at 9:40 AM, bharatkumar bagana < bagana.bharatku...@gmail.com> wrote: > To access a data element , processor has to have the address of that data > element .. for that, proc

Re: [algogeeks] Re: Facebook Interview questions. -- Urgent

2011-09-08 Thread Harshal
The questions asked to us was simliar to this (it was titled *The Game of Life* :D), Consider a MxN matrix, with each cell painted either black or white. A flip is defined over a cell as inverting the colors of all cells in the 3x3 grid centered at that cell. The outermost boundary never changes c

Re: [algogeeks] sorting..

2011-09-08 Thread bharatkumar bagana
Randomized quick sort .. even the worst case in this algo is O(n^2) also, this is best sorting algo .. It is showed that nearly 20-25% of time O.S spends its time in sorting.In unix based systems , they are using this algo only .. A random choice will only choose from middle parts half the time. Ho

Re: [algogeeks] computer organization

2011-09-08 Thread bharatkumar bagana
To access a data element , processor has to have the address of that data element .. for that, processor should have some register or address bus or some thing like that to fetch the data ...what is the limitation from processor side in extending the memory? and also what is the limitation from pro

Re: [algogeeks] what is meaning of STAT field in ps command

2011-09-08 Thread Ankur Goel
Hi, PROCESS STATE CODES Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process. DUninterruptible sleep (usually IO) RRunning or runnable (on run queue) SInterruptible sleep (waiting for an event

[algogeeks] what is meaning of STAT field in ps command

2011-09-08 Thread Rajesh Kumar
output of ps aux command looklike-- USER PID %CPU %MEMVSZ RSS TTY STAT START TIME COMMAND x 1433 0.0 0.123940 2548? Sl 05:55 0:00/usr/bin/gnome- y 1512 0.0 0.294388 4772?

[algogeeks] Re: Amazon Interview question

2011-09-08 Thread Brijesh
Please reply with your alog...! -- 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/-/OGVCUV_hutUJ. To post to this group, send email to algogeeks@googlegroups.co

[algogeeks] File trying to read when reached EOF , WHY ????

2011-09-08 Thread SAMMM
#include #include #include #include #include using namespace std; class GraphClass { int arr[1000][1000]; int r,c; public: GraphClass() { for(int i=0;i<1000;i++) memset(*(arr+i),0,sizeof(*(arr+1))); r=c=0; } void ReadFromFile(char *str) { FILE *f; char buff[1000]={'\0'};

Re: [algogeeks] Re: MICROSOFT

2011-09-08 Thread Himanshu Neema
@Dave: Thanks for pointing that out . In that case , if tree is really big and we want to *save memory* : *Algorithm #1 :* 1) Convert tree to a linked list ( Right rotation or left rotation ) : O(n) 2) Quick Select Kth largest element : Worst case O(n^2) ( when tree was already a bst + if we chos

Re: [algogeeks] Kth largest element

2011-09-08 Thread Brijesh
Better watch this video... http://www.youtube.com/watch?v=HjPmZuOXkHQ&feature=player_embedded After 20th minute! It'll clear all ypur doubts. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://

[algogeeks] Re: Kth largest element

2011-09-08 Thread Brijesh
Thanks for the elaboration! -- 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/-/z2bD7spFbPQJ. To post to this group, send email to algogeeks@googlegroups.com.

[algogeeks] Re: EOF

2011-09-08 Thread Anurag Gupta
thank u all :) On Sep 8, 4:44 pm, hashd wrote: > @Anurag: The input is said to be of unknown and large length ... read it one > character at a time using a loop like > while((c=getchar())!=EOF){ > //body > > > > > > > > } -- You received this message because you are subscribed to the Google Gro

[algogeeks] MINDTREE

2011-09-08 Thread aayush jain
mindtree is coming in our college if anybody know the qus. and paper plz send me... -- 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 emai

Re: [algogeeks] sorting

2011-09-08 Thread aayush jain
thanx @piyush -- 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] MINDTREE

2011-09-08 Thread aayush jain
mindtree is coming in our college if anybody know the qus. and paper plz send me. -- 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

Re: [algogeeks] sorting

2011-09-08 Thread Piyush Grover
It depends on the use cases. If you have less elements of order of( say 100) then even insertion sort can be a better choice. It's in-place sorting algo and can perform sorting as it receives the elements like a stream. If you have large number of elements and all the elements can't be accommodat

[algogeeks] Re: sorting

2011-09-08 Thread Don
Best for what? Don On Sep 8, 12:41 pm, aayush jain wrote: > which is best sorting tec. n 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 group,

Re: [algogeeks] sorting

2011-09-08 Thread aayush jain
if list is sorted nd when list is unsorted. and which one quick sort or merge sort. -- 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

[algogeeks] Re: Kth largest element

2011-09-08 Thread Dave
@Praveen: No. Brijesh was correct. Inserting an element into a heap with k elements is O(log k). This must be done n times, so O(n log k). Dave On Sep 8, 12:50 pm, praveen raj wrote: > @brijesh...Tht would...be... O(klogn) -- You received this message because you are subscribed to the Goog

Re: [algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
Okay. We can do it with min Heap. 1) Build a Min Heap MH of the first k elements (arr[0] to arr[k-1]) of the given array. O(k) 2) For each element, after the kth element (arr[k] to arr[n-1]), compare it with root of MH. a) If the element is greater than the root then make it root and call heapify

Re: [algogeeks] sorting

2011-09-08 Thread praveen raj
Merge sort Quicksort--number of comparisons and exchanges lesser than heapsort...if worst case not occurs... -- 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

Re: [algogeeks] Kth largest element

2011-09-08 Thread praveen raj
@brijesh...Tht would...be... O(klogn) -- 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.

Re: [algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
@Brijesh: Can you help me with a code ? or atleast pseudo code ? How are you going to keep on inserting the elements ? Thanks & Regards, -Rohit On Thu, Sep 8, 2011 at 10:38 PM, Brijesh wrote: > make a max heap of size K , and keep inserting all the elements in it.. and > at last the root will b

[algogeeks] sorting

2011-09-08 Thread aayush jain
which is best sorting tec. n 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 group, send email to algogeeks+unsubscr...@googlegroups.com. For mo

[algogeeks] sorting..

2011-09-08 Thread aayush jain
very easy qus...which is the best sorting tech. n 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 group, send email to algogeeks+unsubscr...@g

Re: [algogeeks] Re: whats d problem wid using gets?

2011-09-08 Thread praveen raj
@sandeep...dont understand... plz give an example... With regards, Praveen Raj -- 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 a

Re: [algogeeks] Re: whats d problem wid using gets?

2011-09-08 Thread SANDEEP CHUGH
another problem with gets is that although we can read multiword string but we cannot read multiple strings like with scanf,, On Thu, Sep 8, 2011 at 10:50 PM, praveen raj wrote: > > char str[MAXLINE]; > fp=fopen("ABC.txt","r"); > > syntax: > > fgets(str,MAXLINE,fp); > With regards, > > Praveen

Re: [algogeeks] Re: whats d problem wid using gets?

2011-09-08 Thread praveen raj
char str[MAXLINE]; fp=fopen("ABC.txt","r"); syntax: fgets(str,MAXLINE,fp); With regards, Praveen Raj -- 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

Re: [algogeeks] Kth largest element

2011-09-08 Thread Brijesh
make a max heap of size K , and keep inserting all the elements in it.. and at last the root will be the k-th largest element ! O(nlogk) On Thursday, 8 September 2011 22:32:52 UTC+5:30, Sandeep Chugh wrote: > > wat abt creating a max heap? and then deleting root element k-1 times.. > after then

Re: [algogeeks] Kth largest element

2011-09-08 Thread Brijesh
make a max heap of size K , and keep inserting all the elements in it.. and at last the root will be the k-th largest element ! O(nlonk) On Thursday, 8 September 2011 22:32:52 UTC+5:30, Sandeep Chugh wrote: > > wat abt creating a max heap? and then deleting root element k-1 times.. > after then

[algogeeks] Re: MICROSOFT in VJTI mumbai

2011-09-08 Thread Brijesh
+1.. please someone share the procedure and questions, topics and all... -- 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/-/pmW5D1vnWbwJ. To post to this group

[algogeeks] Re: Kth largest element

2011-09-08 Thread Dave
@Rohit: See, e.g., http://en.wikipedia.org/wiki/Selection_algorithm#Linear_general_selection_algorithm_-_Median_of_Medians_algorithm or http://jonah.cs.elon.edu/sduvall2/courses/csc331/2006spring/Lectures/Order_statistics.ppt Dave On Sep 8, 11:55 am, Rohit jalan wrote: > How to find out Kth lar

Re: [algogeeks] Kth largest element

2011-09-08 Thread SANDEEP CHUGH
wat abt creating a max heap? and then deleting root element k-1 times.. after then root contains kth largest element On Thu, Sep 8, 2011 at 10:28 PM, Piyush Kapoor wrote: > use max heap ,it will take n + k*logn > > > On Thu, Sep 8, 2011 at 10:25 PM, Rohit jalan wrote: > >> How to find out Kth

Re: [algogeeks] Kth largest element

2011-09-08 Thread praveen raj
Use the Randomized partition approach of quicksort to find the kth largest element in the array. With regards, Praveen Raj -- 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 un

Re: [algogeeks] Kth largest element

2011-09-08 Thread Piyush Kapoor
use max heap ,it will take n + k*logn On Thu, Sep 8, 2011 at 10:25 PM, Rohit jalan wrote: > How to find out Kth largest element in an array ? > > -- > Thanks & Regards : > ROHIT JALAN > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. >

[algogeeks] Kth largest element

2011-09-08 Thread Rohit jalan
How to find out Kth largest element in an array ? -- Thanks & Regards : ROHIT JALAN -- 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

[algogeeks] MICROSOFT in VJTI mumbai

2011-09-08 Thread dilip makwana
Hey guys MS coming to our college (VJTI Mumbai) ...preferably 14-15 Sept So *whoevere attended recently in past 2-3 months please share format and questions asked ...* Give details about - in C/C++ what type of ques asked... etc and* if possible post questions ..* And *what areas one need to ho

Re: [algogeeks] computer organization

2011-09-08 Thread Aditya Virmani
wht do u mean by tht qn? i didn get it...OS isnt processing any data...it just simply maintains the imaging & indexing operations...wht do u mean by managing...? accessing involves use of indexing & seeking to the particular data point... On Thu, Sep 8, 2011 at 3:41 PM, bharatkumar bagana < bagana

[algogeeks] backtracking

2011-09-08 Thread sukran dhawan
guys which is the best site or book to practise backtracking and branch and bound programs ? -- 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

[algogeeks] Please share amazon online test questions for freshers

2011-09-08 Thread algo geek
-- 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

Re: [algogeeks] Barclays Placement Procedure

2011-09-08 Thread vartika aggarwal
@Sweety: Thanks! :-) On Thu, Sep 8, 2011 at 9:28 AM, sweety bhagat wrote: > > > tally solution qstn are subjective it includes appti , c/c++ output ,sql nd > data structure mailny link list > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm

Re: [algogeeks] answer these interesting questions

2011-09-08 Thread sukran dhawan
1 a 2 c 3 b On Wed, Sep 7, 2011 at 11:08 PM, Mani Bharathi wrote: > “Kya-Kya” is an island inhabitants of which always answer any question with > two > answers , one of which is true and the other is false . > > 1.You are walking on a road and came to a park . You ask the inhabitants > Ram , Laxm

[algogeeks] Re: urgent :guys what type of ques does flipkart ask anyidea for written and interview

2011-09-08 Thread htross
please post the questions after the first round is over... On Sep 8, 9:35 am, rahulmaximus wrote: > what the pattern like? > Any papers or type of topics to stress on would be welcomed ... -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.

Re: [algogeeks] Re: EOF

2011-09-08 Thread hashd
@Anurag: The input is said to be of unknown and large length ... read it one character at a time using a loop like while((c=getchar())!=EOF){ //body } -- 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: whats d problem wid using gets?

2011-09-08 Thread kartik sachan
using gets we can get buffer over as gets doesn't check about the size input so it mai go to that area where our stack base pointer(think in memory layout section) is stored so our programmed doenn't return to orignal state as address is stored there...so it is dangeroues to use -- You receiv

Re: [algogeeks]

2011-09-08 Thread annarao kataru
@thank u -- 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 grou

[algogeeks] computer organization

2011-09-08 Thread bharatkumar bagana
can any one tell me how a processor supports an external hard disk with huge memory like 1000 TB ? what are the requirements needed to access a data element in that drive? -- **Please do not print this e-mail until urgent requirement. Go Green!! Save Papers <=> Save Trees *BharatKumar Bagana* **

Re: [algogeeks] Re: Adobe written test

2011-09-08 Thread pavan kumar
Thnx Amit...Can any one post some sample ques so that it vl be very useful ?? On Thu, Sep 8, 2011 at 11:41 AM, Amit Gupta wrote: > Written test of adobe had 3 sections - > Quant and Analytical section - 45 questions(30 + 15) 45 mins > 2 coding papers - 1 hr each , 10 ques each > 1st coding p

Re: [algogeeks] which is better Subquery or Join

2011-09-08 Thread nunna jaikish
AFAIK..no such hard rule ..depends on lot of factors http://support.sas.com/documentation/cdl/en/sqlproc/62086/HTML/default/viewer.htm#a001361223.htm On Thu, Sep 1, 2011 at 5:49 PM, ravi maggon wrote: > for what reason? > > > On Thu, Sep 1, 2011 at 5:44 PM, sukran dhawan wrote: > >> subquery >>

Re: [algogeeks] Objective Question

2011-09-08 Thread rahul vatsa
index we create for a column on a table, nd when we create that, internally the indexes, which r key,field values with that column value & probably the corresponding record addr, r created and stored in some tree structure. and wen we do a select based on this column value, db 1st searches this tr

[algogeeks] Re: answer these interesting questions

2011-09-08 Thread Anas Hadi
Solution to 3rd question: Charles: 1st True. 2nd False Bobby : 1st True, 2nd False Amar:1st False, 2nd True Hence Bobby is the chief -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegr

Re: [algogeeks] os

2011-09-08 Thread sharmila saru
4 On Wed, Sep 7, 2011 at 9:09 PM, Mohit Goel wrote: > How many processes are created in this snippet? > Main() > { > Fork(); > Fork() && fork () || fork (); > Fork (); > } > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to th

Re: [algogeeks] Aps

2011-09-08 Thread sharmila saru
ANSWER: 45 On Wed, Sep 7, 2011 at 8:39 PM, Mani Bharathi wrote: > While traveling at uniform speed. U read a two digit no. after one hr > the number is reversed order. After another hour the number read is same > two digit number. What is the average speed? > > -- > You received this message bec

Re: [algogeeks] answer these interesting questions

2011-09-08 Thread surender sanke
explanation would be appreciated surender On Thu, Sep 8, 2011 at 12:12 AM, Piyush Grover wrote: > 4) a and b > > > On Thu, Sep 8, 2011 at 12:08 AM, Piyush Grover > wrote: > >> 1.)a >> 2.)b >> 3.)b >> 4)b >> >> >> On Wed, Sep 7, 2011 at 11:08 PM, Mani Bharathi >> wrote: >> >>> “Kya-Kya” is an i