Re: [algogeeks] complexity

2011-07-28 Thread sachin sharma
it is O(plg5) Best Wishes Sachin Sharma -- 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] complexity

2011-07-28 Thread Puneet Gautam
@sachin: Explain pls...!!? On 7/28/11, sachin sharma sachin.bles...@gmail.com wrote: it is O(plg5) Best Wishes Sachin Sharma -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Logical operator question

2011-07-28 Thread sagar pareek
+1 @ankur :) On Wed, Jul 27, 2011 at 11:23 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: one request : dont use trubo C On Wed, Jul 27, 2011 at 10:23 PM, Vijay Khandar vijaykhand...@gmail.comwrote: I m getting o/p 1 2 1 1 1 2 2 1 but on wards when x=y=z= -1 then i m getting

Re: [algogeeks] Logical operator question

2011-07-28 Thread Prem Krishna Chettri
Can SomeOne verify the Compilation as .. 1 211 1 221 1 222 0 0-10 0 00-1 0 0-1-1 Thx.. On Thu, Jul 28, 2011 at 11:47 AM, sagar pareek sagarpar...@gmail.comwrote: +1 @ankur :) On Wed, Jul 27, 2011 at 11:23 PM, Ankur Khurana ankur.kkhur...@gmail.comwrote: one request : dont use trubo C

Re: [algogeeks] Re: interview ques

2011-07-28 Thread Puneet Gautam
@bharath: To store the bunch of records together also, we gonna need another useful ds like linked list or array which again points to the problem of excessive storage or excessive pointers... correct me if am not..! On 7/28/11, bharath bharath.sri...@gmail.com wrote: @Dumanshu: A B+ tree is a

Re: [algogeeks] Re: AMAZON Q

2011-07-28 Thread Tyler Durden
@Rajeev: How will you update the position of each element in the linked list after removing a particular element? Won't you have to traverse the list completely in which case your algo will be O(n^2) ?? -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] complexity

2011-07-28 Thread Rajeev Kumar
@Puneet, get_power(int a, int b) works in O(logb) as you keep on dividing b with 2... you are calling that method *P *times in *func(int p) *method. So it is *plogb...*u r passing 5 as b valueit will be *plog5* On Thu, Jul 28, 2011 at 11:45 AM, Puneet Gautam

Re: [algogeeks] complexity

2011-07-28 Thread Puneet Gautam
k...thanks... On 7/28/11, Rajeev Kumar rajeevprasa...@gmail.com wrote: @Puneet, get_power(int a, int b) works in O(logb) as you keep on dividing b with 2... you are calling that method *P *times in *func(int p) *method. So it is *plogb...*u r passing 5 as b valueit will be

Re: Re : [algogeeks] Re: size of self referential structure

2011-07-28 Thread sunny agrawal
Okay. I was a bit wrongactually the thing is that The exact number of bytes allocated for various C data types depends on *both the machine and the compiler.** *so it may be the that the compiler u are using is 32 bit.. one thing that u can try out is that on ubuntu install 64 bit

Re: [algogeeks] puzzle

2011-07-28 Thread Hemalatha
Give all the primary and secondary diagonal Elements a value -1 and the rest as 1s. -1 1 1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 1 -1 1 -1 1 1 1 1 -1 Regards Hemalatha On Thu, Jul 28, 2011 at 11:29 AM, priyanka goel priya888g...@gmail.comwrote: @ SkRiPt... can u pl

Re: [algogeeks] puzzle

2011-07-28 Thread sunny agrawal
@Hemlatha this is one of the possible solution the Question is to find Number of such solutions On Thu, Jul 28, 2011 at 12:09 PM, Hemalatha hemalatha.amru...@googlemail.com wrote: Give all the primary and secondary diagonal Elements a value -1 and the rest as 1s. -1 1 1 1 1 -1 1 -1 1 1

Re: [algogeeks] Re: size of self referential structure

2011-07-28 Thread Jnana Sagar
@aditya..the answer may vary, because c is machine dependent language..in few machines int is of 2 bytes and char is of 1 byte..u can't say..it varies with diff machines On 7/26/11, aditya kumar aditya.kumar130...@gmail.com wrote: char *s[5] is a array of pointers of type char . but the thing is

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Deoki Nandan
there is no specification on complexity . if input matrix is 1 2 3 4 5 6 7 8 9 then after 180 rotation output should be 1 2 3 6 9 8 7 4 5 On Wed, Jul 27, 2011 at 11:34 PM, amit karmakar amit.codenam...@gmail.comwrote: If you meant rotate a 2D matrix by angle 180 of order n x n Then you cannot

Re: [algogeeks] puzzle

2011-07-28 Thread sunny agrawal
yes 2^((n-1)^2) is the answer :) consider a row or column of size n, Number of ways it can we filled with 1's and -1's(such that product is 1) is sum of all nCi where i = 0,2,4. (i = no of -1s) and that will be 2^(n-1) (same is the number when product is -1 ) so now let f(i,j) is the number

Re: [algogeeks] Re: AMAZON Q

2011-07-28 Thread Rajeev Kumar
@Tayler : That's y i am using Java ArrayList instead of linked list where arrayList maintains element position.But problem is when an element is removed from the list,all subsequent elements to be moved forward Please check javadoc of arrayList :

Re: [algogeeks] Small Doubt

2011-07-28 Thread MANNU
@Prem: Each program is provided with a pool of address, which consist of heap, stack etc. My question is that if I write an address 0xff which is not provided to that program then what will be the output? On 7/28/11, Prem Krishna Chettri hprem...@gmail.com wrote: First

Re: [algogeeks] Re: AMAZON Q

2011-07-28 Thread Tyler Durden
@Rajeev: Okay, I am using C which has no such facilities of auto indexing the list.. -- 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/-/BsMmVwxw_T4J. To post

Re: [algogeeks] Small Doubt

2011-07-28 Thread Prem Krishna Chettri
Hey.. good To have your Question . Well lemme try to elaborate things here as i cannot use WhiteBoard . So Srry guys... :( Well partly you have answered your question and some part can even be reflected in the above thread of virtual - physical mem mapping. using MMU.. So I wont go beyond MMU.

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Rajeev Kumar
@puneet Can you give us an example what u mean by 180 degree rotation... For given matrix like 1, 2, 3, 4 5, 6, 7, 8 9,10,11, 12 13,14,15,16 What is the expected output? On Wed, Jul 27, 2011 at 11:29 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: Can anyone give an O(n)

[algogeeks] C output

2011-07-28 Thread Aman Goyal
#include‹stdio.h› main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; } ouput: compiler error. Any logical reasons? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread amit
This should be O(2^n) #include cstdio #include cstring using namespace std; int n; int sol[1000]; void solve(int pos, int k) { for(int i = 0; i k; i++) printf(%d, , sol[i]); putchar('\n'); for(int i = pos; i n; i++) { sol[k] = i+1; solve(i+1, k+1); } } int

Re: [algogeeks] direct i ..ques

2011-07-28 Thread Aman Goyal
c(n,2) * c(n,2) On Wed, Jul 27, 2011 at 11:07 PM, siva viknesh sivavikne...@gmail.comwrote: No. rectangles in NxN matrix ... is it n^2 + (n-2) ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] C-question

2011-07-28 Thread Vijay Khandar
Now got it Thanks... On Wed, Jul 27, 2011 at 11:27 PM, rajeev bharshetty rajeevr...@gmail.comwrote: The output is 10101101 consider it to be f(173) - f(86) - f(43) - f(21) - f(10) - f(5) - f(2) - f(1) 1 0 110 1

Re: [algogeeks] self referential struct. Contd.

2011-07-28 Thread Aman Goyal
yes this will be the case. On Wed, Jul 27, 2011 at 11:35 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @nikhil:So what u mean is that if i have: struct{ int a; char b[5]; }; the size of this struct's node will be 12 not 9.., to make it a multiple of 4?? On 7/26/11, Nikhil Gupta

Re: [algogeeks] DE Shaw - Data Structure Section Qn

2011-07-28 Thread Akshata Sharma
using array, we can do in O(logn) always as it is ordered. If all values hash to same bucket in case of hashtable, it would be O(n) worse case On Thu, Jul 28, 2011 at 12:03 AM, rajeev bharshetty rajeevr...@gmail.comwrote: Hash Table with Bucket , made of linked list . At most if all n values

Re: [algogeeks] Re: direct i ..ques

2011-07-28 Thread Aman Goyal
(C(n+1,2))* (C(n+1,2)) choosing any two rows from n+1 rows, and any two columns from n+1 columns will yield a rectangle . So solution is the no of possible combinations. On Wed, Jul 27, 2011 at 11:23 PM, Abhinav Arora abhinavdgr8b...@gmail.comwrote: It will be (1+2+3+,,,+n)^2.u can verify

[algogeeks] Re: how to calculate the complexity

2011-07-28 Thread bharath
Master's theorem is for recursive programs only. In general, there is no golden rule to calculate time complexity. Few pointers are to identify the key operations (eg - loops) and analyze the estimated running time based on a input size. On Jul 27, 2:46 pm, rajeev bharshetty rajeevr...@gmail.com

[algogeeks] Re: Blocked/Unrolled linked list with no duplicates and sorted

2011-07-28 Thread banu
Anyone ? On Jul 26, 10:27 pm, banu varun.nagp...@gmail.com wrote: Hi, Basically I am trying to create a blocked linked list(unrolled linked list) with following properties - Configurable number of elements in each node - No duplicate elements in the unrolled linked list - Linked list is

Re: [algogeeks] how to calculate the complexity

2011-07-28 Thread Anish Kumar
Masters' Theorem can be applied only to Divide and Conquer kind of alogs. I would suggest you to read the initial few chapters of Introduction to Algorithms by Cormen. Regards On 28 July 2011 01:16, rajeev bharshetty rajeevr...@gmail.com wrote: Masters Theorem http://esudo apt-get install

Re: [algogeeks] Sparse matrix

2011-07-28 Thread Anish Kumar
I think this can help http://en.wikipedia.org/wiki/Sparse_matrix#Storing_a_sparse_matrix On 28 July 2011 00:45, aditi garg aditi.garg.6...@gmail.com wrote: can u plz elaborate... On Thu, Jul 28, 2011 at 12:04 AM, rajeev bharshetty rajeevr...@gmail.comwrote: To store sparse matrix

Re: [algogeeks] puzzle

2011-07-28 Thread 석문기
The problem is finding the subspaces that satisfy two conditions in the 6*6 total space? 2011/7/28 vetri natarajananitha...@gmail.com given a 6x6 matrix with all the elements as either 1 or -1. find the number of ways the elements can b arranged such that 1.the product of all elements of all

Re: [algogeeks] how to calculate the complexity

2011-07-28 Thread Puneet Gautam
Time complexity: int get_power(int a, int b) { if(!b) return 1; if(b%2) return a * get_power(a, b/2); return get_power(a, b/2); } int func(int p) { int sum = 0; for(int i = 1; i = p; ++i) { sum += get_power(i, 5); } return sum; } O(plgp) or O(plg5)..? or anything else..? On 7/28/11, sunny

Re: [algogeeks] C output

2011-07-28 Thread aditi garg
well im not sure bt i guess one possible reason could be that struct yy is a member of struct xx..so a pointer of struct yy cannot be declared widout ref to xx... On Wed, Jul 27, 2011 at 9:52 PM, Aman Goyal aman.goya...@gmail.com wrote: #include‹stdio.h› main() { struct xx { int x; struct

Re: [algogeeks] DE Shaw - Data Structure Section Qn

2011-07-28 Thread ankit sambyal
In the question it is specified that the data structure should have a worst case time complexity of O(N) -- 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] C output

2011-07-28 Thread Prem Krishna Chettri
Well, this is quiet obvious even the least follower of C struct can answer it but the good part is why does compiler is design to do so.. Hope ppls do follow me in this activation rec.. yy *q struct yy (defined in somewhere) x.. Guys above notation is in stack so srry again for no

[algogeeks] Re: C output

2011-07-28 Thread prabhat
i think there will be warning due to inner structure is not declaring variable. Inner structure must be like: struct yy { char s; struct xx *p; }a; On Jul 27, 9:22 pm, Aman Goyal aman.goya...@gmail.com wrote: #include‹stdio.h› main() { struct xx { int x; struct yy { char s;      

[algogeeks] Re: DE Shaw - Data Structure Section Qn

2011-07-28 Thread vj
O(lgn) in ordered array using binary search On Jul 28, 1:44 pm, ankit sambyal ankitsamb...@gmail.com wrote: In the question it is specified that the data structure should have a worst case time complexity of O(N) -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Blocked/Unrolled linked list with no duplicates and sorted

2011-07-28 Thread sunny agrawal
Nice Problem :) i think taking care of duplicates is very simple...but main point is sorted insertion that has to very carefully done there are many cases that need to be taken care of 1. if the value to be inserted is between two nodes and both nodes are fullthen a new node will be

Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Piyush Sinha
@amitno it wont work..check it.. On Wed, Jul 27, 2011 at 10:07 PM, amit amit.codenam...@gmail.com wrote: This should be O(2^n) #include cstdio #include cstring using namespace std; int n; int sol[1000]; void solve(int pos, int k) { for(int i = 0; i k; i++) printf(%d, , sol[i]);

Re: [algogeeks] Re: C output

2011-07-28 Thread Piyush Kapoor
It is not showing compiler error on Codeblocks on my machine. On Thu, Jul 28, 2011 at 2:26 PM, prabhat prabhat0...@gmail.com wrote: i think there will be warning due to inner structure is not declaring variable. Inner structure must be like: struct yy { char s; struct xx *p; }a;

[algogeeks] Re: Sparse matrix

2011-07-28 Thread prabhat
as far as i know multi linklist it used to store sparse matrix On Jul 27, 11:33 pm, aditi garg aditi.garg.6...@gmail.com wrote: How wud u store a sparse matrix( whch has elemensts only below or abv the diagonal) in memory...what data structure u wud use and y? -- You received this message

Re: [algogeeks] Re: C output

2011-07-28 Thread Rohit Srivastava
no error in dev c++. On Thu, Jul 28, 2011 at 2:43 PM, Piyush Kapoor pkjee2...@gmail.com wrote: It is not showing compiler error on Codeblocks on my machine. On Thu, Jul 28, 2011 at 2:26 PM, prabhat prabhat0...@gmail.com wrote: i think there will be warning due to inner structure is

Re: [algogeeks] Logical operator question

2011-07-28 Thread kavitha nk
@prem::ya its rite.. //BE COOL// kavi -- 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] Re: sizeof() question.

2011-07-28 Thread kavitha nk
wat does it mean dat sizweof cannot be applied to functions??den wat is foo()?is s a func ly na??explain me i cant get it.. //BE COOL// kavi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Logical operator question

2011-07-28 Thread Prem Krishna Chettri
Thx Kavi.. :) On Thu, Jul 28, 2011 at 2:59 PM, kavitha nk kavithan...@gmail.com wrote: @prem::ya its rite.. //BE COOL// kavi -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] Least Common Ancestor

2011-07-28 Thread kavitha nk
http://geeksforgeeks.org/?p=1029 follow the link fa one more soln.. //BE COOL// kavi -- 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

Re: [algogeeks] Least Common Ancestor

2011-07-28 Thread sunny agrawal
Solution in the link is for BST, not for BT On Thu, Jul 28, 2011 at 3:15 PM, kavitha nk kavithan...@gmail.com wrote: http://geeksforgeeks.org/?p=1029 follow the link fa one more soln.. //BE COOL// kavi -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Least Common Ancestor

2011-07-28 Thread kavitha nk
oh 5n sry...how to get practiced wit algo???help me //BE COOL// kavi -- 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

Re: [algogeeks] Re: C output

2011-07-28 Thread rajeev bharshetty
No error in gcc 4.3.2 too On Thu, Jul 28, 2011 at 2:47 PM, Rohit Srivastava access2ro...@gmail.comwrote: no error in dev c++. On Thu, Jul 28, 2011 at 2:43 PM, Piyush Kapoor pkjee2...@gmail.comwrote: It is not showing compiler error on Codeblocks on my machine. On Thu, Jul 28,

Re: [algogeeks] Re: reverse a line.

2011-07-28 Thread kavitha nk
first create a temp char array with size equal to dat of the string length.scan each word(char by char until end is white space is reached)...then start filling the new array from last by subtracting the original string length with each word lengthcrct me if i'm wrong.. //BE COOL// kavi

[algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread KK
bool foo(int x) // Implement this function where 0 = x = 100 It should return true x% of times n false otherwise first i told him to have a static int s then increment it each time the func is called... and if s % (100 - x ) == 0 then true else false. then he told me to have some

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Muthu Raj
Please elaborate upon the question a little more :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote: bool foo(int x) // Implement this function where 0 = x = 100 It should return true x% of

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Nikhil Jindal
Generate a random number from 1 to 100. If it is less than or equal to x, return true, else return false. This will ensure that ur returning true with x/100 probability. Cheers Nikhil Jindal On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote: bool foo(int x) // Implement this

[algogeeks] hai...........

2011-07-28 Thread sharmila saru
my area of interest is computer network as u ask question abt that .. i will answer immediately.. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] hai...........

2011-07-28 Thread Rahul
How it is that we open a number of email in a computer , when there is only one port for smtp? --- Rahul On Thu, Jul 28, 2011 at 5:23 PM, sharmila saru sharmi99p...@gmail.comwrote: my area of interest is computer network as u ask question abt that .. i will

Re: [algogeeks] Re: C output

2011-07-28 Thread Tyler Durden
Only a warning in Dev C++ due to no variable declaration of inner structure -- 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/-/HtevjjeGDZoJ. To post to this

[algogeeks] Re: interview ques

2011-07-28 Thread bharath
@Puneet, to store anything on a machine, you will need to have a pointer to it else there is no question of accessing it. I am guessing the question emphasized on reducing the size of the B+ tree. Also, with B+ trees, you have sequence pointers at the data record level. Therefore, if these data

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Tushar Bindal
I think that we have to make a spiral traversal So o/p for your matrix would be: 1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10 On Thu, Jul 28, 2011 at 1:56 PM, Rajeev Kumar rajeevprasa...@gmail.comwrote: @puneet Can you give us an example what u mean by 180 degree rotation...

Re: [algogeeks] Re: sizeof() question.

2011-07-28 Thread Tyler Durden
No, it's wrong to say that sizeof() can't be applied to functions. It's an operator and can take the function name as its operand. -- 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] AMAZON Q

2011-07-28 Thread Anantha Krishnan
We must use BIThttp://www.topcoder.com/tc?module=Staticd1=tutorialsd2=binaryIndexedTreesto solve this problem with O(nlogn). Here http://ideone.com/IaU3F is my implementation. Thanks Regards Anantha Krishnan On Tue, Jul 26, 2011 at 7:18 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: You

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-28 Thread Rajeev Kumar
Hi All, Algorithm :(as ankur suggested above) 1)Assume given array is a[]; 2)construct a temporary array of size a.length+1.Insert '0' as first element in temp(to simplify the edge conditional checks) 3)temp array contains sum of elements upto index(i) of that position. 4)Create a hashmap and

[algogeeks]

2011-07-28 Thread Coder Coder
Can anyone tell me the iterative code to find mirror image of a binary tree?? 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

[algogeeks] pointer access in c++

2011-07-28 Thread mohit verma
hey guys, One simple example: class A{ int a,b; public: A():a(2),b(3){} }; class B:public A { public: int c; }; int main() { B ob; int *ptr=ob.c; cout*ptr; ptr--; cout*ptr; ptr--; cout*ptr; return 0; } AFAIK, inheritance in any visibility mode does not provide access to

Re: [algogeeks] hai...........

2011-07-28 Thread mageshthegreat
I don't think you use smtp to view yahoo or gmail. It is only http requests and responses. The smtp is significant only if you use your computer as the server to send or receive emails. If you have a local apache server then it uses the port to send out mails from your local copy of website

[algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Rahul Menon
Hello friends, Recently I appeared for placement interviews for Amazon in my campus.Unfortunately though I couldn't make it, still want to share something for others here preparing for amazon interviews! First of all though it is very hard to crack, here are a few things which can make your

Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Neha Sharan
@rahul:what kind of questons were asked in aptitude test? On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon menonrahul1...@gmail.comwrote: Hello friends, Recently I appeared for placement interviews for Amazon in my campus.Unfortunately though I couldn't make it, still want to share something

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Tushar Bindal
If this is the case, we can follow this method: take variables 1. dir = 1 2. st_col=0 3. end_col = n-1 4. st_row = 1 5. end_row = n-1 6. row = 0 7. col = n-1 8. noOfCellsVisited = 0 dir are as follows: 1 - left ro right 2 - top to bottom 3 - right to left 4 - bottom to top row will keep account

[algogeeks] Re: [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Rahul Menon
I dont remember exactly! There where a few questions from Computer Networks, OS etc also a few aptitude questions! 20 mcq + 2 programming questions, On Jul 28, 5:31 pm, Neha Sharan neharick...@gmail.com wrote: @rahul:what kind of questons were asked in aptitude test? On Thu, Jul 28, 2011 at

Re: [algogeeks] Re: [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Neha Sharan
Thanks. On Thu, Jul 28, 2011 at 6:07 PM, Rahul Menon menonrahul1...@gmail.comwrote: I dont remember exactly! There where a few questions from Computer Networks, OS etc also a few aptitude questions! 20 mcq + 2 programming questions, On Jul 28, 5:31 pm, Neha Sharan neharick...@gmail.com

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Tushar Bindal
There will be following changes to this while(noOfCellsVisitedmn) { if(dir == 1) { for i = st_col to end_col { print arr[row][i]; noOfCellsVisited++} dir++; end_col--; row = n-1-row; } else if(dir==2) { for i = st_row to end_row { print arr[i][col]; noOfCellsVisited++} dir++; end_row--;

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Tushar Bindal
i am sorry for givin such a naive solution and making so many mistakes. i still left a mistake in dir==4 * col=n-1-(col+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

Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Siddharth kumar
#includeiostream #define ARR_LEN 5 using namespace std; int main() { int int_arr[ARR_LEN], k, min, max, x, temp, i; for(i=0; iARR_LEN; i++) cinint_arr[i]; coutEnter k: ; cink; min = (1k)-1; max = min(ARR_LEN-k); for(x=min; x=max;

Re: [algogeeks] Re: rotate a matrix NVIDIA question

2011-07-28 Thread Tushar Bindal
thanks amit for this code i tried this for the first time and am still not over finding out my mistakes (got another one while trying it out on an array) yours was an easy one :) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Muthu Raj
Thnks a lot neha :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 6:01 PM, Neha Sharan neharick...@gmail.com wrote: @rahul:what kind of questons were asked in aptitude test? On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon

[algogeeks] TIC TAC TOE

2011-07-28 Thread Balaji S
Given a 3X3 matrix , with 1's 0's and -1's ( 1 is player one 0 is player two -1 is none) how ll you find who is the winner / draw in a tic tac toe game in the most effiecient manner... -- With Regards, Balaji.S -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Tyler Durden
#includestdio.h #includemath.h int set_bits(int a) { int c=0; while(a) { if(a 1) c++; a =1; } return c; } void sub(int a[],int n,int k) { int i; int x,c=0,j; x = pow(2,n); for(i=0;ix;i++) //this statement is exec 2^n

Re: [algogeeks] self referential struct. Contd.

2011-07-28 Thread Nikhil Gupta
Here's another example. struct example { int a; char b; int c; } Now if a variable of type example is declared then (considering base address as 2000) a gets : 2000 to 2003 b gets : 2004 c gets : 2005 to 2008 ? NO It gets 2008 to 2011. The bytes from 2005 to 2007 (3 bytes) are padded in this

[algogeeks] Re: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-07-28 Thread sandz
Please e-mail the book as well. nsandee...@gmail.com Thanks. On Jun 24, 6:28 pm, cooks rohit.wali...@gmail.com wrote: addToMailList(rohit.wali...@gmail.com); :) On Jun 24, 2:08 pm, murthy.krishn...@gmail.com murthy.krishn...@gmail.com wrote: yaa If any one has it, can you please

Re: [algogeeks] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread Tushar Bindal
though the code given by siddharth seems to be a bit tough to understand due to one long statement, it gives a good idea to run the main loop fron 2^k -1 to (2^k - 1)*(2^(n-k)) since these rae the only numbers having k digits set -- You received this message because you are subscribed to the

Re: [algogeeks] hai...........

2011-07-28 Thread Arun Vishwanathan
when u log in with a user name and password, the mail client(gmail)(mail server) contacts the IMAP server through a port(imap is 143 i guess)and you can view your mails on the server(the mails that were sent to u sit in a queue on this server) itself or bring a copy to your local machine.SMTP

Re: [algogeeks] Facebook Intern F2F Interview

2011-07-28 Thread Vishal Thanki
+1 Nikhil On Thu, Jul 28, 2011 at 4:26 PM, Nikhil Jindal fundoon...@yahoo.co.in wrote: Generate a random number from 1 to 100. If it is less than or equal to x, return true, else return false. This will ensure that ur returning true with x/100 probability. Cheers Nikhil Jindal On Thu, Jul

Re: [algogeeks] TIC TAC TOE

2011-07-28 Thread radha krishnan
Excuse me MR.balaji :P U got selected for Microsoft Redmond :P still preparing ? :P On Thu, Jul 28, 2011 at 6:01 AM, Balaji S balaji.ceg...@gmail.com wrote: Given a 3X3 matrix , with 1's 0's and -1's ( 1 is player one 0 is player two -1 is none) how ll you find who is the winner / draw in a

Re: [algogeeks] Re: interview ques

2011-07-28 Thread himanshu kansal
@bharath: yeah i was also thinking that we could store a pointer to a data block in which multiple records can be stored.but i think for searching a record we have to 1st get to that block and then search the record in that block On Thu, Jul 28, 2011 at 5:31 PM, bharath

Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-07-28 Thread Rahul Singhal
Hi friends, I would recommend to go through all topics mentioned on tutorials on site topcoder for google.Make a note, do practise more of greedy and dynamic programming questions.In final rounds of interview, they generally ask questions involving probability along with computation which is also

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-28 Thread Tushar Bindal
can't we include -9 , 3 , 1, 5 , 0 as a possible sub 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

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-28 Thread Ankur Khurana
it will be answer as per my algo . On Thu, Jul 28, 2011 at 7:39 PM, Tushar Bindal tushicom...@gmail.comwrote: can't we include -9 , 3 , 1, 5 , 0 as a possible sub array? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

[algogeeks] Re: AMAZON Q

2011-07-28 Thread SVIX
extra memory allowed... and n log n and resultant array should have values f(x) in the same order as x in the first array (before sort) now, sort the first array and take distinct (another array)... create a dictionaryint,int. add each element in the sorted list and it's index as key and

Re: [algogeeks]

2011-07-28 Thread sagar pareek
viod mirror(node *root) { node* tmp; if(root) { mirror(root-left); mirror(root-right); tmp=root-left; root-left=root-right; root-right=tmp; } } On Thu, Jul 28, 2011 at 6:40 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote: http://www.ideone.com/NyAmw On Thu, Jul 28, 2011 at 5:48

Re: [algogeeks]

2011-07-28 Thread ambika iyer
how to find the complexity of the above recursive code On Thu, Jul 28, 2011 at 8:02 PM, sagar pareek sagarpar...@gmail.com wrote: viod mirror(node *root) { node* tmp; if(root) { mirror(root-left); mirror(root-right); tmp=root-left; root-left=root-right;

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-28 Thread Rajeev Kumar
@Tushar : We can do it...thing is to modify the getCombinations() method in the program to select any two instead of selecting two elements side by side... On Thu, Jul 28, 2011 at 7:31 AM, Tushar Bindal tushicom...@gmail.comwrote: yeah i was just confirming that it is meant to be

Re: [algogeeks]

2011-07-28 Thread ambika iyer
@tushar : thnx!! On Thu, Jul 28, 2011 at 8:11 PM, Tushar Bindal tushicom...@gmail.comwrote: it should be O(n) where n is number of nodes as we get into the function once for a node. we just perform some O(1) operations to do the swapping. On Thu, Jul 28, 2011 at 8:05 PM, ambika iyer

[algogeeks] DirectI -Written Test

2011-07-28 Thread radha krishnan
Anyone have an idea about DirectI Written test ? Thanks in Advance ! Radhakrishnan, CEG,AU, Chennai -- 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] Re: Facebook Interview question at NIT Warangal

2011-07-28 Thread sunny agrawal
as Number of possible sets are nCk i think complexity of the best solution will be O(k*nCk) (as in siddarths solution) siddharth's solution will fail in case k 64 a simple recursive program is possible i think in same complexity. On Thu, Jul 28, 2011 at 6:40 PM, Tushar Bindal

[algogeeks] Re: Facebook Intern F2F Interview

2011-07-28 Thread KK
@Nikhil: ya true but i dont know wht else was he expecting. @sunny and Muthu: like suppose u pass 20 then func should return true with 20% probabily and false otherwise... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] Re: Facebook Intern F2F Interview

2011-07-28 Thread sunny agrawal
Okay... i was reading % as Modulus operator :( did u gave the solution Nikhil posted , i think that should be the answer. On Thu, Jul 28, 2011 at 9:10 PM, KK kunalkapadi...@gmail.com wrote: @Nikhil: ya true but i dont know wht else was he expecting. @sunny and Muthu: like suppose u pass

Re: [algogeeks] Re: Facebook Intern F2F Interview

2011-07-28 Thread Muthu Raj
ya me toowas readin % as modulus :) *Muthuraj R. 4TH Year BE.** Information Science Dept* *PESIT, Bengaluru . * On Thu, Jul 28, 2011 at 9:13 PM, sunny agrawal sunny816.i...@gmail.comwrote: Okay... i was reading % as Modulus operator :( did u gave the solution Nikhil posted , i think

Re: [algogeeks] Re: Contiguous subarray with sum zero

2011-07-28 Thread Tushar Bindal
yup i got it now. nice code -- 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] Puzzle

2011-07-28 Thread shubham
A man leaves his office daily at 07:00 PM. His driver arrives with the car from home to his office at sharp 07:00 PM. So he doesn't need to wait for any transport medium as soon he is free from his work. But today he finished his work early and left the office at 05:30 PM. As his driver was not

Re: [algogeeks] DirectI -Written Test

2011-07-28 Thread Puneet Gautam
Well, they do ask questions mainly from Linked list, tree traversals and yes, automata Also questions on time complexity and algos .. Every question is given a specified time limit which bases your scoring on how fast u do it.. Thats all i know.. On 7/28/11, radha krishnan

Re: [algogeeks] Puzzle

2011-07-28 Thread Kunal Patil
Insufficient data to calculate what you need to find out !!! On Thu, Jul 28, 2011 at 9:39 PM, shubham shubh2...@gmail.com wrote: A man leaves his office daily at 07:00 PM. His driver arrives with the car from home to his office at sharp 07:00 PM. So he doesn't need to wait for any transport

  1   2   >