Re: [algogeeks] MS written Reasoning question

2013-05-03 Thread rahul sharma
@ashish...4 all selected...remaining 2 to be selected..1 m,ba 1 betch makes one 2 mba and 1 mca...but as it is not only option coz we can put 2 mcas at 2 remaing pos so this is not true...3 are ignored 4th must be true.. On Mon, Apr 29, 2013 at 7:37 AM, ashish gupta

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

Re: [algogeeks] MS written Reasoning question

2013-05-02 Thread Padarn Wilson
b and d cannot be true at the same time. d) - 2 MBA - 2 BTECH - 2 left to allocate. But b) allocates 3 more. On Sat, Apr 27, 2013 at 4:02 AM, rahul sharma rahul23111...@gmail.comwrote: 10 candidates appear for an interview and 6 selected. 2-M.A 2-MCA 4-BTECH 2-MBA. If at least one MBA is

Re: [algogeeks] MS written Reasoning question

2013-05-02 Thread Padarn Wilson
(oh sorry forgot to mention - d must be true because of the statement 'if at least one MBA is selected then exactly 2 BTECH are selected and vice versa') On Mon, Apr 29, 2013 at 6:22 AM, Padarn Wilson pad...@gmail.com wrote: b and d cannot be true at the same time. d) - 2 MBA - 2 BTECH - 2

[algogeeks] MS written Reasoning question

2013-04-28 Thread rahul sharma
10 candidates appear for an interview and 6 selected. 2-M.A 2-MCA 4-BTECH 2-MBA. If at least one MBA is selected then exactly 2 btech are selected and vice versa. Of six candidates,exactly one must be an MA cndidate question:- which of the following statementsis definitely true:,if 2 btech are

Re: [algogeeks] MS interview question

2013-04-26 Thread achala sharma
1. Make a trie of all dictionary words. 2.then run a loop for all characters of string 3.suppose start from I ,as I is a word in dictionary,word found then increment counter 4.Now counter comes to X,no word found 5.Now it comes to A,two word could start from A(A and AM) now run this loop till end

Re: [algogeeks] MS Question:WAP to print last n lines of a log file

2013-03-12 Thread Sairam Ravu
lines = 0; string last_n_lines[n]; //read each line into a circular buffer while(getline(file,last_n_lines[lines%n])) { lines++; } // if number of lines n // then print all of them if(lines=n) { start = 0; count = lines; } else { start = lines%n; count = lines; } //Now print all of

Re: [algogeeks] MS Question:WAP to print last n lines of a log file

2013-03-12 Thread sourabh jain
Read line by line . use doublylinkedlist(Queue)/ Circular Buffer of size N. when EOF is achieved print the lines. On Mon, Mar 4, 2013 at 9:10 AM, Ashish Goel ashg...@gmail.com wrote: Q1. Given a log file, pirnt last n lines. Note that the Log file is being written into. Q2. Implement

Re: [algogeeks] MS Question:WAP to print last n lines of a log file

2013-03-04 Thread Anurag Sharma
Both questions look related to me. If the log file is being updated as well simultaneously, you should be able to use Circular queue/buffer for that. On Mon, Mar 4, 2013 at 9:10 AM, Ashish Goel ashg...@gmail.com wrote: Q1. Given a log file, pirnt last n lines. Note that the Log file is being

Re: [algogeeks] MS Question:WAP to print last n lines of a log file

2013-03-04 Thread Karthikeyan V.B
int main() { int n=10; coutEnter the value of n:; cinn; int i=0; ifstream file(C:\\Users\\kvb\\Desktop\\sample.txt); string line; string buffer[n]; if(file.is_open()) { while(file.good()) { getline(file,line);

[algogeeks] MS Question:WAP to print last n lines of a log file

2013-03-03 Thread Ashish Goel
Q1. Given a log file, pirnt last n lines. Note that the Log file is being written into. Q2. Implement Circular Buffer. Best Regards Ashish Goel Think positive and find fuel in failure -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] MS Question

2013-01-22 Thread Amitesh Singh
you can't implement in O(log n). It can be done in O(log n) in case of Ranked BS Tree. -- Amitesh On Sun, Jan 20, 2013 at 6:23 PM, Praveen praveensonare...@gmail.com wrote: If for all the nodes in BST we also store the size of subtree, then it is possible to find nth smallest element in

Re: [algogeeks] MS Question

2013-01-20 Thread Guneesh Paul Singh
not possible unless u use augmented bst..which itself takes o(n) to built --

Re: [algogeeks] MS Question

2013-01-20 Thread Mohanabalan D B
http://stackoverflow.com/questions/2329171/find-kth-smallest-element-in-a-binary-search-tree-in-optimum-way On Sun, Jan 20, 2013 at 4:57 PM, Guneesh Paul Singh gunees...@gmail.comwrote: not possible unless u use augmented bst..which itself takes o(n) to built -- --

Re: [algogeeks] MS Question

2013-01-20 Thread Praveen
If for all the nodes in BST we also store the size of subtree, then it is possible to find nth smallest element in O(logN). On Sun, Jan 20, 2013 at 4:57 PM, Guneesh Paul Singh gunees...@gmail.comwrote: not possible unless u use augmented bst..which itself takes o(n) to built -- --

[algogeeks] MS Question

2013-01-19 Thread Umer Farooq
Given a BST, how would you return the nth smallest element. The code had to cover all the edge cases and was expected to write a logn solution. -- Umer --

[algogeeks] MS interview

2012-08-24 Thread GAURAV CHAWLA
Ques Given a large text... in the text.. there are gt; , lt; etc representing and .(there can be others like eq; etc) the task is to replace such (gt;) with the '' symbol... and (lt;) with '' given the table which have corresponding matches... and table is

[algogeeks] MS QUESTION

2012-08-24 Thread sulekha metta
Hi all, This was asked in microsoft, question is write a program to reverse a linked list.and write it's test cases. i got very few test cases 1) check if the node is null 2) check if there is only one node 3) check if there is any loop in the linked list. can any one tell how to

Re: [algogeeks] MS QUESTION

2012-08-24 Thread Navin Kumar
Reversing a linked list if loop exists: 1. Find the node from which loop start by any loop finding algorithm in linked list and keep the position of that node. 2. Unroll the loop i.e. set the last node's(last unrepeating node) next pointer to NULL. 3. Reverse this singly linked list. 4. Change

Re: [algogeeks] MS QUESTION

2012-08-24 Thread Navin Kumar
Few more Test cases : Check for 10 node. Check for 1 million node Check for even number of nodes Check for odd number of nodes... etc etc... On Fri, Aug 24, 2012 at 6:25 PM, Navin Kumar algorithm.i...@gmail.comwrote: Reversing a linked list if loop exists: 1. Find the node from which loop

Re: [algogeeks] MS interview

2012-08-24 Thread Navin Kumar
Anagram problem solution using TRIE.. For each word in dictionary we will put it in TRIE as.. 1. First sort the word 2. Search in trie using sorted word. If search found then we will add the original word in that TRIE node. 3. If node node not found then using simple TRIE insertion insert

[algogeeks] MS interview

2012-08-22 Thread GAURAV CHAWLA
Ques.. Given a m-word dictionary ... and a n-sized word... .. now suggest DS for dictionary such that you can find out all the anagrams of the given word present in dictionary... -- Regards, G C -- You received this message because you are subscribed to the Google Groups Algorithm Geeks

Re: [algogeeks] MS interview

2012-08-22 Thread Ashish Goel
O(n) convert each string into format a1b2and then insert into multimap wityh this a1b2...as key and original word as value. All words with same key are anagrams Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Aug 22, 2012 at 11:39 PM,

Re: [algogeeks] MS interview

2012-08-22 Thread Navin Kumar
@Ashish: According to your algo making multimap itself takes O(mn) time complexity (preprocessing). After then getting anagram of a string takes O(n) time. Am i right? On Thu, Aug 23, 2012 at 6:51 AM, Ashish Goel ashg...@gmail.com wrote: O(n) convert each string into format a1b2and then

Re: [algogeeks] MS Design Ques

2012-07-07 Thread sravanreddy001
i was thinking of character array. which is same as string. Any thoughts on better alternatives? On Friday, 6 July 2012 13:34:01 UTC-4, anshu wrote: yes, We can have much better data structure for storing big integer instead of string just for simplicity I have taken string. On Fri, Jul 6,

Re: [algogeeks] MS Design Ques

2012-07-07 Thread Anshu Mishra
Best will be storing BIG_INT in array of integers. int [] val; //store actual number int size; // required length of val array. take the string as input for constructors and convert it into 2's complement form, maintaining little endian order or big endian order. Perform other operation keeping

Re: [algogeeks] MS Design Ques

2012-07-06 Thread Mithun Kumar
@anshuman... Are you converting numbers to string because data types ranges and precision differs? or is there any other reason? -mithun On Fri, Jul 6, 2012 at 12:58 AM, payal gupta gpt.pa...@gmail.com wrote: thnx...4 d rply.. Regards, PAYAL GUPTA, NIT-B. On Fri, Jul 6, 2012 at 12:43

Re: [algogeeks] MS Design Ques

2012-07-06 Thread Anshu Mishra
yes, We can have much better data structure for storing big integer instead of string just for simplicity I have taken string. On Fri, Jul 6, 2012 at 11:11 AM, Mithun Kumar mithunsi...@gmail.com wrote: @anshuman... Are you converting numbers to string because data types ranges and precision

Re: [algogeeks] MS Design Ques

2012-07-05 Thread Anshu Mishra
First define all the basic operation you can apply on two numbers. Binary operation : +, -, *, /, %, optional((and), |(or), ^(xor)) Unary operation : !, ~, - Comparison : , ==, != Define all these operation. Most simplest one can be, class BIG_INT { private string val; //Define

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 : !, ~, -

Re: [algogeeks] MS Design Ques

2012-07-03 Thread Mithun Kumar
can you elaborate question...what is BIG_INT? On Sun, Jul 1, 2012 at 8:13 PM, payal gupta gpt.pa...@gmail.com wrote: 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

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread atul anand
peacelover1987...@yahoo.co.in wrote: This is a variant of that one -- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread Hassan Monfared
-- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread Amol Sharma
; } On Fri, Jun 29, 2012 at 3:37 PM, raghavan M peacelover1987...@yahoo.co.in wrote: This is a variant of that one -- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread atul anand
@amol : #includestdio.h int main() { int arr[]={5,0,1,2,6,7,8,3,4,9}; int i,j,n,temp; n=sizeof(arr)/sizeof(arr[0]); for(j=0;j=1;j++) { for(i=0;in;i++) { if(arr[i]!=i){ temp=arr[i]; arr[i]=arr[arr[i]];

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread Amol Sharma
i don't see any change in the code you posted...other than expanding swap function i believe in discussing the idea/algonot the code.. -- Amol Sharma Final Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread atul anand
yes it is same and it not working . Apart for this you had provided code for sorting O(n) time and not the idea/algo. please explain the algorithm , how you are sorting it within O(n) time and O(1) space complexity. On Mon, Jul 2, 2012 at 3:18 PM, Amol Sharma amolsharm...@gmail.com wrote: i

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-02 Thread atul anand
opssyeah dat was the bug... now got it :) On Mon, Jul 2, 2012 at 4:08 PM, Amol Sharma amolsharm...@gmail.com wrote: @atul: the logic for the O(n) counting is same as for the count sort. you haven't write the swap function correctly, here is correct code for swap function --

[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 to

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-01 Thread Amol Sharma
: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M peacelover1987

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-01 Thread Darpan Baweja
PM, raghavan M peacelover1987...@yahoo.co.in wrote: This is a variant of that one -- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-01 Thread Bhaskar Kushwaha
saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-01 Thread shiva@Algo
: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-01 Thread shiva@Algo
-- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-07-01 Thread Amol Sharma
-- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post

[algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread raghavan M
Hi Question as in subject *No extra spaceĀ (can use one extra space)-O(1) max *No order change allowed example: input : 1,-5,2,10,-100,-2 output: -5,-10,-100,1,2 input : -1,-5,10,11,15,-500,200,-10 output : -1,-5,-10,-500,-10,10,11,15 Thanks Raghavn -- You received this message because you

Re: [algogeeks] MS Question :implement read write lock class

2012-06-29 Thread Mithun Kumar
This link should help http://stackoverflow.com/questions/5667793/how-does-a-read-write-mutex-lock-work?rq=1 -mithun On Fri, Jun 29, 2012 at 7:30 AM, bharat b bagana.bharatku...@gmail.comwrote: class lock { enum{read, write,free}status; }; By default, make status value as free. Based

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread saurabh singh
duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M peacelover1987...@yahoo.co.inwrote: Hi Question as in subject *No extra space (can use one extra

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread Ravi Ranjan
one can modify dutch national flag algo for two colors(2 types positive n negative) -- 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] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread adarsh kumar
Quick sort partition routine variation. On Fri, Jun 29, 2012 at 3:06 PM, Ravi Ranjan ravi.cool2...@gmail.comwrote: one can modify dutch national flag algo for two colors(2 types positive n negative) -- You received this message because you are subscribed to the Google Groups Algorithm

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread raghavan M
To: algogeeks@googlegroups.com Sent: Friday, 29 June 2012 3:06 PM Subject: Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order one can modify dutch national flag algo for two colors(2 types positive n negative) -- You received this message because you

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread raghavan M
This is a variant of that one From: saurabh singh saurab...@gmail.com To: algogeeks@googlegroups.com Sent: Friday, 29 June 2012 3:05 PM Subject: Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread Bhaskar Kushwaha
of that one -- *From:* saurabh singh saurab...@gmail.com *To:* algogeeks@googlegroups.com *Sent:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread Bhaskar Kushwaha
:* Friday, 29 June 2012 3:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread utsav sharma
*Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread Hassan Monfared
:05 PM *Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread Bhaskar Kushwaha
*Subject:* Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order duplicate of a previous post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M

Re: [algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-28 Thread Lomash Goyal
we can create linked list for the number where each node will store some k digits (say 5) in the reverse order.then we just perform a normal addition of the data of the nodes with the help of carry. note that if the numbers are not positive then we need to maintain a sign bit node also.if any of

[algogeeks] MS Question :implement read write lock class

2012-06-28 Thread Ashish Goel
Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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

Re: [algogeeks] MS Question :implement read write lock class

2012-06-28 Thread bharat b
class lock { enum{read, write,free}status; }; By default, make status value as free. Based on the request, status value will be changed... Based on the value of the status, we should decide whether another read/write lock can be given. Any suggestions ? On Thu, Jun 28, 2012 at 4:46 PM, Ashish

[algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-26 Thread Ashish Goel
Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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

Re: [algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-26 Thread Navin Kumar
whether it is in character array or integer array?? On Tue, Jun 26, 2012 at 3:40 PM, Ashish Goel ashg...@gmail.com wrote: Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- You received this message because you are subscribed to the Google

Re: [algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-26 Thread saurabh singh
^ Does it make any difference? Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Tue, Jun 26, 2012 at 5:32 PM, Navin Kumar algorithm.i...@gmail.comwrote: whether it is in character array or integer array?? On Tue, Jun 26, 2012 at 3:40 PM, Ashish Goel

Re: [algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-26 Thread Kumar Vishal
MSB is at end or at the last of the array .. ?? On Tue, Jun 26, 2012 at 5:43 PM, saurabh singh saurab...@gmail.com wrote: ^ Does it make any difference? Saurabh Singh B.Tech (Computer Science) MNNIT blog:geekinessthecoolway.blogspot.com On Tue, Jun 26, 2012 at 5:32 PM, Navin Kumar

Re: [algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-26 Thread Kumar Vishal
I mean 123 is store as 1,2,3 or 3,2,1 On Tue, Jun 26, 2012 at 6:01 PM, Kumar Vishal kumar...@gmail.com wrote: MSB is at end or at the last of the array .. ?? On Tue, Jun 26, 2012 at 5:43 PM, saurabh singh saurab...@gmail.comwrote: ^ Does it make any difference? Saurabh Singh

Re: [algogeeks] MS Question: Add two large numbers where the numbers are stored in an array format

2012-06-26 Thread Ashish Goel
the base is not given, so 10 can't be assumed Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Tue, Jun 26, 2012 at 4:38 PM, amrit harry dabbcomput...@gmail.comwrote: make size of both array by adding '0' in front of smaller array then int

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-17 Thread algogeek
This solution works perfectly :) On Friday, June 15, 2012 10:59:22 AM UTC+5:30, Navin Kumar wrote: I corrected in function InsertAtBottom :In my code isntead of (!IsEmptyStack) use IsEmptyStack On Fri, Jun 15, 2012 at 10:49 AM, Navin Kumar algorithm.i...@gmail.comwrote: @all: In my

[algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Ashish Goel
Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread rahul patil
to store items in stack you will need some DS. Do they mean you cant use any auxillary DS than stack ? On Thu, Jun 14, 2012 at 2:24 PM, Ashish Goel ashg...@gmail.com wrote: Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- You received this

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Navin Kumar
void Reverse(struct Stack *S) { int data; if(IsEmptyStack(S)) return; data=pop(s); ReverseStack(S); InsertAtBottom(S, data); } void InsertAtBottom(struct stack *S, int data) { int temp; if(!IsEmptyStack(S)){ push(S,data); return; } temp=pop(S);

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Sourabh Singh
@ Navin Kumar Nice . Solution. But your function also make a stack only. so you are using a stack[internal] here. but may be this one is allowed:-) On Thu, Jun 14, 2012 at 5:23 AM, Navin Kumar algorithm.i...@gmail.comwrote: void Reverse(struct Stack *S) { int data;

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Ashish Goel
Navin: copy pastes not encouraged till the logic is also clarified ;) Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Thu, Jun 14, 2012 at 7:25 PM, Sourabh Singh singhsourab...@gmail.comwrote: @ Navin Kumar Nice . Solution. But your

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Hassan Monfared
how can you pop from empty stack ? temp=pop(S); Regards, Hassan On Thu, Jun 14, 2012 at 8:25 PM, Ashish Goel ashg...@gmail.com wrote: Navin: copy pastes not encouraged till the logic is also clarified ;) Best Regards Ashish Goel Think positive and find fuel in failure +919985813081

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Lomash Goyal
void pushreverse(int data) { int temp; if(top==0) { push(data); return; } else temp=pop(); pushreverse(data); push(temp); } int reversestack() { //static int arr[50]; int top2=0; int i; if(top==0) { return top2; } top2=pop(); reversestack(); pushreverse(top2); } On Thu, Jun 14, 2012 at 2:44

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Karthikeyan V.B
Hi all, Generate combinations (taken k out of n) of a given string Eg: Input : abcd Output: abc acd abd bcd -- 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] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Nishant Pandey
the steps would be like this : if i say stack is like this 1,2,3,4 then 1) pop each and every item from the stack till stack is empty the nodes will be ther in function call stack stil not pushed 2) now now take elements from function call stack like 4 and push it 3) when 3 comes next time first

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Nishant Pandey
stack means inbuild stack we cant use any DS from our program explicitly. On Thu, Jun 14, 2012 at 2:44 PM, rahul patil rahul.deshmukhpa...@gmail.comwrote: to store items in stack you will need some DS. Do they mean you cant use any auxillary DS than stack ? On Thu, Jun 14, 2012 at 2:24 PM,

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Nishant Pandey
i think i already explained the logic initially :) On Thu, Jun 14, 2012 at 9:30 PM, Hassan Monfared hmonfa...@gmail.comwrote: how can you pop from empty stack ? temp=pop(S); Regards, Hassan On Thu, Jun 14, 2012 at 8:25 PM, Ashish Goel ashg...@gmail.com wrote: Navin: copy pastes not

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Navin Kumar
@all: In my code isntead of (!IsEmptyStack) use IsEmptyStack Logic : First pop the all element and then start putting element at bottom in reverse order i.e. the element which is fetched last is put at the bottom and so on. ex: let our stack is: 1 2 3 4 (1 is at bottom). function Call is will

Re: [algogeeks] MS Question: Reverse stack using push, pop without any auxiliary data structure

2012-06-14 Thread Navin Kumar
I corrected in function InsertAtBottom :In my code isntead of (!IsEmptyStack) use IsEmptyStack On Fri, Jun 15, 2012 at 10:49 AM, Navin Kumar algorithm.i...@gmail.comwrote: @all: In my code isntead of (!IsEmptyStack) use IsEmptyStack Logic : First pop the all element and then start putting

Re: [algogeeks] MS Question : find word in 2D array

2012-06-09 Thread Bhaskar Kushwaha
@utsav u haven't initialized match anywhere so ur algo fails On Thu, Jun 7, 2012 at 2:50 AM, utsav sharma utsav.sharm...@gmail.comwrote: i think it can be solved using DP word=bcdf take hash of word h[b]=1 h[c]=2 h[d]=3 h[f]=4 given 2d matrix m[][]= {b c b e f g h b c d f p o u d f d

Re: [algogeeks] MS Q: how to test a driverless car?

2012-06-08 Thread Ashish Goel
Things like sensor data coming from CAN/MoST from the car is collected and analysed in real time to avoid collisions, off-lane movement, distance maintenance, auto parking(including parallel), slippage on road/snow, GPS integration for perfect location and location specific data (like

Re: [algogeeks] MS Q: how to test a driverless car?

2012-06-07 Thread Umer Farooq
What are the specs of the car. Can you please give the answer to the following clarifying questions: - How much distance is it suppose to travel without the driver? - Is it suppose to run on smooth roads only or can it also run on roads with jumps on it? On what type of road is the car most

[algogeeks] MS Question : find word in 2D array

2012-06-06 Thread Ashish Goel
WAP to find a word in a 2D array. The word can be formed on row/col/diagnal/reverse diagnal Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] MS Q: how to test a driverless car?

2012-06-06 Thread Ashish Goel
Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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

Re: [algogeeks] MS Question : find word in 2D array

2012-06-06 Thread atul anand
i did this question long time back well simple brute force check can be doneyou can keep one flag matrix of same size to avoid necessary recursion. On 6/6/12, Ashish Goel ashg...@gmail.com wrote: WAP to find a word in a 2D array. The word can be formed on row/col/diagnal/reverse

Re: [algogeeks] MS Question : find word in 2D array

2012-06-06 Thread utsav sharma
i think it can be solved using DP word=bcdf take hash of word h[b]=1 h[c]=2 h[d]=3 h[f]=4 given 2d matrix m[][]= {b c b e f g h b c d f p o u d f d f g k p } take another matrix match[][] if( h[ m[i][j] ] 0 ) //if this char is in word then {a=h[ m[i][j] ]; if (match[i-1][j] ==a-1

Re: [algogeeks] MS Question: Delete a node in single linked list if it is less than any of the successor nodes

2012-06-04 Thread Amol Sharma
here is the question ans solution with proper explanation http://www.geeksforgeeks.org/archives/11604 -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99

Re: [algogeeks] MS Question: Delete a node in single linked list if it is less than any of the successor nodes

2012-06-04 Thread atul anand
whats problem with the approch provided by navin http://k2code.blogspot.in/2011/09/deleting-node-in-singly-linked-list-if.html it seems much simpler ...is there any test case for which it wont work ?? On Mon, Jun 4, 2012 at 3:25 PM, Amol Sharma amolsharm...@gmail.com wrote: here is the

RE: [algogeeks] MS Question: WAP to find files in a

2012-06-03 Thread Ashish Goel
directory/subdirectories MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit The question is to implement without use of any library Sent from my Windows Phone From: atul anand Sent: 03-06-2012 11:19 To: algogeeks@googlegroups.com Subject: Re: [algogeeks

[algogeeks] MS: searching problem......help me out...

2012-06-03 Thread abhinav gupta
We have given a list 14 6 7 15 8 9 we have to find 15 in (log n ) times. -- *Thanks and Regards,* Abhinav Kumar Gupta **abhinav@gmail.com -- 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] MS: searching problem......help me out...

2012-06-03 Thread Abhishek Goswami
Hi, I have found two url which contain answer of your question some extent. 42bits.wordpress.com/2010/04/17/find-kth-minimum-in-a-unsorted-array/ http://www.medwelljournals.com/fulltext/?doi=rjasci.2011.70.75 On Sun, Jun 3, 2012 at 8:31 PM, abhinav gupta abhinav@gmail.com wrote:

Re: [algogeeks] MS: searching problem......help me out...

2012-06-03 Thread Rahul Kumar Patle
@abhinav: if you want to search just 15 in log(n) time then you can use the concept of heap tree.. apply one round of heapification (not for all elements but just one time it will be complete in log(n) times), and you will need to swap elements but when you got element 15 you can stop.. although

Re: [algogeeks] MS: searching problem......help me out...

2012-06-03 Thread abhinav gupta
@Rahul: but for heapify, i need to build heap tree first from the list. which will cost linear traversal of the elements, that will cost O(n). but i need to search it in O(log n) or polylogrithmic complexity of (log n) i.e. (log^2 n). On Sun, Jun 3, 2012 at 8:55 AM, Rahul Kumar Patle

Re: [algogeeks] MS: searching problem......help me out...

2012-06-03 Thread abhinav gupta
@ Abhishek : Link that you have provided is for kth min element in the unsorted array, but here i dont know the given value is of at what min position. On Sun, Jun 3, 2012 at 9:06 AM, abhinav gupta abhinav@gmail.com wrote: @Rahul: but for heapify, i need to build heap tree first from the

Re: [algogeeks] MS: searching problem......help me out...

2012-06-03 Thread Abhishek Goswami
Hi Rahul, In the below url,They have mentioned the parallel searching. it means divide array than search element from two point. i.e number of element is {48,23,10,32,5} search 32. divide array [0-2] and [3-4] range... traverse the array from p[0] and p [3]... till half of the loop. I hope

[algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread Ashish Goel
ls-r implementation needed... Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 -- 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] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread atul anand
i wrote this program in college labbut used shell script to simulate ls -r functionality. now to do in c or java .. we only need to knw about the libraries to use. On 6/3/12, Ashish Goel ashg...@gmail.com wrote: ls-r implementation needed... Best Regards Ashish Goel Think positive and

Re: [algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread Navin Kumar
#include stdio.h #include stdlib.h #include sys/types.h #include dirent.h #include unistd.h #include ctype.h #include string.h void dirfun(char *); int main() { char *home=/home/navin/temp/; dirfun(home); return 0; } void dirfun(char *path) { struct dirent

Re: [algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread Navin Kumar
you can set your directory path in this line char *home=/home/navin/temp/; On Sun, Jun 3, 2012 at 11:26 AM, Navin Kumar algorithm.i...@gmail.comwrote: #include stdio.h #include stdlib.h #include sys/types.h #include dirent.h #include unistd.h #include ctype.h #include string.h void

  1   2   3   4   5   >