Re: [algogeeks] command to use printer using c/c++

2010-09-11 Thread saurabh singh
when you run the executable of your code then redirect the output of it to a file. ex : program > C:/out.txt On Sun, Sep 12, 2010 at 9:54 AM, Jasveen Singh wrote: > hi guyz, > i have aproject to submit tomorrow and i have made the program,it is a > graphical program in c++,but i have to give a s

[algogeeks] command to use printer using c/c++

2010-09-11 Thread Jasveen Singh
hi guyz, i have aproject to submit tomorrow and i have made the program,it is a graphical program in c++,but i have to give a screenshot in the file can u guyz help me please because i'm unable to get a screenshot of the graphical output as it runs full screen and Printscr button doesn't work on D

[algogeeks] Re: On random no. generation

2010-09-11 Thread sourav
Thanks sharad for the info. I got it at http://groups.google.co.in/group/algogeeks/browse_thread/thread/31d9864045742a08/fb3e2af1e11087de?hl=en&lnk=gst&q=random#fb3e2af1e11087de Sourav On Sep 12, 7:14 am, sharad kumar wrote: > we have discussed this problem before pls check the archives > > > >

[algogeeks] Re: On random no. generation

2010-09-11 Thread Gene
One of many ways int rand07() { int r; do { r = rand04() + 5 * rand04(); // 0 to 24. } while (r >= 8 * 3); return r / 3; } On Sep 11, 10:07 pm, sourav wrote: > You are given a random no. generator function rand04() that generates > random numbers between 0 and 4 (i.e., 0,1,2,3,4) wit

Re: [algogeeks] On random no. generation

2010-09-11 Thread sharad kumar
we have discussed this problem before pls check the archives On Sun, Sep 12, 2010 at 7:37 AM, sourav wrote: > You are given a random no. generator function rand04() that generates > random numbers between 0 and 4 (i.e., 0,1,2,3,4) with equal > probability. You have to design a random no. generat

[algogeeks] On random no. generation

2010-09-11 Thread sourav
You are given a random no. generator function rand04() that generates random numbers between 0 and 4 (i.e., 0,1,2,3,4) with equal probability. You have to design a random no. generator function rand07() that generates numbers between 0 to 7 (0,1,2,3,4,5,6,7) using rand04() such that rand07() genera

Re: [algogeeks] Re: Excellent Compilation of Interview Questions

2010-09-11 Thread Nikhil Agarwal
Thanks man for the site.Anybody having such info/any material please post it here.Thanks in advance On Sat, Sep 11, 2010 at 1:53 PM, bittu wrote: > thanks keep posting such type of material... > regards > Shashank > > -- > You received this message because you are subscribed to the Google Group

Re: [algogeeks] LIS in nlogn

2010-09-11 Thread Nikhil Agarwal
Please use google Link is http://groups.google.com/group/algogeeks/browse_thread/thread/b20cd8160a8e8f92/1c9628cdb85cf8a2?lnk=raot On Sat, Sep 11, 2010 at 9:00 PM, ashish agarwal < ashis

Re: [algogeeks] LIS in nlogn

2010-09-11 Thread ashish agarwal
can you give link for this On Sat, Sep 11, 2010 at 6:10 AM, Nikhil Agarwal wrote: > This has been discussed already.Please refer that post I have provided the > actual code . > > On Sat, Sep 11, 2010 at 3:20 PM, ashish agarwal < > ashish.cooldude...@gmail.com> wrote: > >> Can anybody tell me leas

Re: [algogeeks] LIS in nlogn

2010-09-11 Thread Nikhil Agarwal
This has been discussed already.Please refer that post I have provided the actual code . On Sat, Sep 11, 2010 at 3:20 PM, ashish agarwal < ashish.cooldude...@gmail.com> wrote: > Can anybody tell me least increasing sub sequence in nlogn > please try to provide code in C > > -- > You received thi

[algogeeks] hello

2010-09-11 Thread Gaurav
iouyiugjl On Fri, Sep 10, 2010 at 5:00 PM, > wrote: > Today's Topic Summary > > Group: http://groups.google.com/group/algogeeks/topics > >- Explain <#12afb697e122ca05_group_thread_0> [8 Updates] >- I want improve my algorithm?? <#12afb697e122ca05_group_thread_1> [2 >Updates] >-

[algogeeks] Re: Write a C program to sort a stack in ascending order.

2010-09-11 Thread Srinivas
yeah thanks ashita...u r right.. reverse(stack *s){ IsEmpty(s) return; top = pop(s); reverse(s); ascending(s, top); } ascending(stack *s, int top){ IsEmpty(s){ push(top); return; } i = pop(s); if(i < top){ ascending(s, top); push(i); } else{

Re: [algogeeks] Re: Write a C program to sort a stack in ascending order.

2010-09-11 Thread ashita dadlani
@Srinivas: Sorry for the confusion. But if we have a stack {5,8,3,4,2} with 5 as the last input,ie,top, do we have to arrange the stack such that s={2,3,4,5,8}with 2 as the top? if I am getting it correct,then shouldn't your algo be modified slightly as follows:? reverse(stack *s){ IsEmpty(s)

Re: [algogeeks] Re: Write a C program to sort a stack in ascending order.

2010-09-11 Thread ashita dadlani
@Srinivas: shouldn't it be: i = pop(s); if(i > top){ ascending(s, i); push(top); } else{ ascending(s, top); push(i); } On Sat, Sep 11, 2010 at 6:52 PM, ashita dadlani wrote: > > else{ > ascending(s, i); > push(top); > } > } > @swinivas:why have you used ascending(s,

[algogeeks] Re: Write a C program to sort a stack in ascending order.

2010-09-11 Thread Srinivas
yeah no use of ascending(s,i) here... thanks ashita for the correction reverse(stack *s){ IsEmpty(s) return; top = pop(s); reverse(s); ascending(s, top); } ascending(stack *s, int top){ IsEmpty(s){ push(top); return; } i = pop(s); if(i > top){ ascend

Re: [algogeeks] Re: Write a C program to sort a stack in ascending order.

2010-09-11 Thread ashita dadlani
else{ ascending(s, i); push(top); } } @swinivas:why have you used ascending(s,i) here? On Sat, Sep 11, 2010 at 6:40 PM, Srinivas wrote: > reverse(stack *s){ > IsEmpty(s) >return; > top = pop(s); > reverse(s); > ascending(s, top); > } > ascending(stack *s, int top){ > IsEm

[algogeeks] Re: Write a C program to sort a stack in ascending order.

2010-09-11 Thread Srinivas
reverse(stack *s){ IsEmpty(s) return; top = pop(s); reverse(s); ascending(s, top); } ascending(stack *s, int top){ IsEmpty(s){ push(top); return; } i = pop(s); if(i > top){ ascending(s, top); push(i); } else{ ascending(s, i); push(top);

Re: [algogeeks] Aricent question

2010-09-11 Thread MOHIT ....
well element can be placed in two order only s= same d=different _d _ d _ d _ d _ upto n times their are n+1 gap in between which should be filled by same element so same element can be detected by 1. if atelast one couple of two/more same element filled in one gap ( so check for two consecut

Re: [algogeeks] Aricent question

2010-09-11 Thread Rahul Singal
This is O(n) solution. first check if 2 consecutive element in an array are same or not . If they are same we have the solution. otherwise check the first 3 element and find out which 2 elements are same. I hope it works. -- You received this message because you are subscribed to the Google Grou

Re: [algogeeks] cyclic String

2010-09-11 Thread Ashim Kapoor
I can do it in 2 O(n)sweeps if all elements are distinct. 12345 23451 Sweep one to find the 1st element of string 1 in string 2. Sweep 2 to compare each element of the 2 strings from the position mod n found in the 1st sweep. I dont know how to do it if elements are repeated. but the way Praveen

Re: [algogeeks] Aricent question

2010-09-11 Thread Ashim Kapoor
The majority vote program ( discussed a couple of days ago ) would work in this case I think. In the end we would have the modal element with count = 0 (n - n ). Please correct me if I am wrong. On Sat, Sep 11, 2010 at 3:00 PM, bittu wrote: > Given an array of 2n elements of which n elements are

[algogeeks] LIS in nlogn

2010-09-11 Thread ashish agarwal
Can anybody tell me least increasing sub sequence in nlogn please try to provide code in C -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send

Re: [algogeeks] Yahoo Question:Greatest Sub-sequential sum

2010-09-11 Thread ashish agarwal
@ashita I think its working fine for this seq also i=1 and j=5 and sum =25 {3,4,17,-8,9} correct me On Sat, Sep 11, 2010 at 2:16 AM, ashita dadlani wrote: > http://codepad.org/Jui20xme > a little modification over anand's code. > > > On Sat, Sep 11, 2010 at 2:33 PM,

Re: [algogeeks] Re: Given an array, find out if there exists a pair of nos. that adds up to a sum 'x'

2010-09-11 Thread topojoy biswas
put all the numbers in a hash table( which demands O(n) space) and then pick each number in the array and check in the hashtable whether x-chosen number is present. this would take O(1) per search. Do it for all the numbers in the array. It wold take O(n). On Fri, Sep 10, 2010 at 11:00 PM, jagadis

Re: [algogeeks] Re: Explain

2010-09-11 Thread siddharth srivastava
On 10 September 2010 16:25, saurabh agrawal wrote: > Thanks a lot umesh...but still i am in confusion that: > > after first processing : "A is replaced by B" > after second proecessing " B is replaced by A" > then why again this A is not being replaced by #define A macro.. > why it is not going i

[algogeeks] Aricent question

2010-09-11 Thread bittu
Given an array of 2n elements of which n elements are same and the remaining n elements are all different. Write a C program to find out the value which is present n times in the array. There is no restriction on the elements in the array. They are random (In particular they not sequential). -- Y

Re: [algogeeks] Yahoo Question:Greatest Sub-sequential sum

2010-09-11 Thread ashita dadlani
http://codepad.org/Jui20xme a little modification over anand's code. On Sat, Sep 11, 2010 at 2:33 PM, ashita dadlani wrote: > @anand: > the maximum sum obtained from your solution is correct. > However,the subarray printed is not correct for the following case: > {-2

Re: [algogeeks] Yahoo Question:Greatest Sub-sequential sum

2010-09-11 Thread ashita dadlani
@anand: the maximum sum obtained from your solution is correct. However,the subarray printed is not correct for the following case: {-2,3,4,17,-8} -8 is also getting printed which is not a part of thw subsequence. On Sat, Sep 11, 2010 at 2:00 PM, ashita dadlani wrote: > @ashish: > what if the ar

Re: [algogeeks] Yahoo Question:Greatest Sub-sequential sum

2010-09-11 Thread ashita dadlani
@ashish: what if the array is {-2,3,4,17,-8,9}? On Wed, Sep 8, 2010 at 8:52 AM, Anand wrote: > Maximum Value Contiguous Subsequence problem in O(n). > http://codepad.org/BhYxSlp4 > > > On Tue, Sep 7, 2010 at 2:40 PM, ashish agarwal < > ashish.cooldude...@gmail.com> wrote: > >> yeah..it will be i

Re: [algogeeks] cyclic String

2010-09-11 Thread Praveen Baskar
str="hello"; str1="lloeh"; if (str+str).subString(str1) is true then the string is cyclic string of another On Sat, Sep 11, 2010 at 1:52 PM, bittu wrote: > How will you check if a string is cyclic string of another > > solution O(n)..???/?? or even less compraiosn.. > > -- > You received thi

[algogeeks] Re: Excellent Compilation of Interview Questions

2010-09-11 Thread bittu
thanks keep posting such type of material... regards Shashank -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr.

[algogeeks] cyclic String

2010-09-11 Thread bittu
How will you check if a string is cyclic string of another solution O(n)..???/?? or even less compraiosn.. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe fr