Re: [algogeeks] LEFT MOST set bit in an unsigned integer.

2012-06-14 Thread aditya kumar
for 16bit ..take a number n = 1000
let x be the number mentionf in a question
pos  = -1
while (1){
if(x & n){
pos++
exit}
else
n »=1
}

pos is the answer
if pos is greater than numbr of bits then x doesnt hv set bits

> How to find the LEFT MOST set bit in an unsigned integer.
> Example:
> "00*1*0 0001 0100 0010" is a 16-bit unsigned integer. We have to find the
> left most set bit position (Starting with 0 from right side )
> which is 13th position in our example. How to find this. Can any one pls
> give any suggestions.
> Thank You Very Much In Advance.
>
> --
> 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/-/HJnuFujMZ3wJ.
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Interview Question

2012-01-19 Thread ADITYA KUMAR
thats a brute force solution...
can u expalin the complexity..i think its O(n^2)
and also there exist no solution for n < 3

On Thu, Jan 19, 2012 at 3:36 PM, bharat b wrote:

> @Neeraj : will u pls explain u'r logic ...
>
> On 1/19/12, NEERAJ KODDHAN  wrote:
> > int[] a = new int[2*n];
> > put(a, n);
> >
> > static void put(int[] a,int i){
> > if(i>0){
> >  for(int j=0;j > if(a[j]==0 && a[j+i+1]==0){
> >  a[j]=i;
> > a[j+i+1]=i;
> > put(a, i-1);
> >  a[j]=0;
> > a[j+i+1]=0;
> > }
> >  }
> > }else if(i==0){
> > for (int k : a) {
> >  System.out.print(k +" ");
> > }
> > System.out.println();
> >  }
> > }
> >
> >
> > On Wed, Jan 18, 2012 at 10:04 PM, Coding Geek  >wrote:
> >
> >> Place N number from 1 to N, in 2N positions in such a way so that there
> >> are
> >>
> >> Exactly “n” number of cells between two placed locations of number “n”.
> >> Write a program to display numbers placed in this way.
> >>
> >> Example:-
> >>
> >> (1) One of the possible placement for 7 numbers in 14 positions is :
> >> 5 7 2 3 6 2 5 3 4 7 1 6 1 4
> >>
> >>
> >>
> >> --
> >>
> >> "To Iterate is Human, To Recurse is Divine"
> >>
> >> --
> >> 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
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> > --
> > 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
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
> --
>
>
> **Regards
> *
> * 
>
> Bharat B | M.Tech II  | Computer Science & Engineering | IITM
> *
> *
> *Ph: +91 8056127652*
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Regards
Aditya Kumar
B-tech IV year
Computer Science & Engg.
MNNIT, Allahabad.

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: sqrt function...

2012-01-06 Thread ADITYA KUMAR
when ever you need to calculate values or solve a equations,apply discrete
mathematics
like newton raphson method it coverges very fast.
On Thu, Jan 5, 2012 at 3:50 PM, WgpShashank wrote:

> you may also like it , explained two algorithm , discussed about
> complexities , let me know if anything wrong :)
>
>
>
> http://shashank7s.blogspot.com/2011/02/wap-to-calculate-square-root-of-number.html
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology,Mesra
> *http://shashank7s.blogspot.com*
>
>
>
>  --
> 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/-/cfkrVqrSNGsJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Aditya Kumar
B-tech IV year
Computer Science & Engg.
MNNIT, Allahabad.

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] what will be the focus of yahoo in written exam ,what to study for it. please respond ASAP..

2011-11-14 Thread aditya kumar
guys this is not the ideal place to discuss placement related questions .
plz query in interviewstreet group

On Mon, Nov 14, 2011 at 5:24 PM, wujin chen  wrote:

> two month   ago , I passed yahoo written test in china.
> data structure, algorithm , and given a code segment  with some lines
> missing, ask you to fill it.
>
>
> today i rejected yahoo offically.  actually i love to be one of yahoo.
> finally i chose microstrategy in hangzhou ,china, because it is close to
> my home.
> good luck~!
>
>
> 2011/11/10 rahul sharma 
>
>> i also want to knw...somebody who has faced yahoo this year plz post.
>>
>>
>> On Wed, Nov 9, 2011 at 11:50 PM, kumar raja wrote:
>>
>>>
>>>
>>> --
>>> Regards
>>> Kumar Raja
>>> M.Tech(SIT)
>>> IIT Kharagpur,
>>> 10it60...@iitkgp.ac.in
>>>
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Post only ALGO RELATED QUESTIONS ...

2011-10-06 Thread aditya kumar
do justify the name of the group  ..
thnks

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Help sourcebit !!!

2011-10-06 Thread aditya kumar
guys its my sincere request to all .. before posting any question plz plz do
search for archives first . if you would had done that you could have got
better knowledge .


On Wed, Oct 5, 2011 at 9:14 PM, raman shukla wrote:

> Hey mate dont worry there is nothing like pattern, You should be able
> to think little logical and write normal JAVA programs like
> implementation of different sorting algorithm in java and finding
> regular expression in text file. This is only required, no need to
> panic. All the best.
>
> On Oct 5, 5:31 pm, praveen raj  wrote:
> > Plz put the technical written paper pattern ...of sourcebit... and some
> > sample papers...of what type of questions(level) would be asked...
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: EMC^2

2011-10-01 Thread aditya kumar
package is 8.75 l that has 7.5l as fst mothn bonus .
so ctc is 8l
On Sun, Oct 2, 2011 at 2:10 AM, Sahil Garg  wrote:

> how much package??
>
> Sahil Garg
> Computer Engineering
> Delhi College of Engineering
>
>
>
> On Sun, Sep 25, 2011 at 1:32 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> since the company is about data and storage manageemnt so do we need to
>> stress on DBMS .??
>> and thnks fr all the help :)
>>
>>
>> On Sat, Sep 24, 2011 at 11:11 PM, siva viknesh wrote:
>>
>>> Total Rounds: max 3.
>>> 1 written  + 1 tech + 1 hr
>>> Probably there might be a 2nd tech interview in case they are willing
>>> to take you for the company and want to give you another chance to
>>> prove yourself.
>>>
>>> Tomorrow itself they'll complete the recruitment process and shortlist
>>> the candidates.
>>>
>>>
>>> Round 1:
>>> Written Test:
>>>
>>>  mostly only general aptitude questions.
>>>  since the offer is increased, they might ask technical questions.
>>>
>>>  in technical test:
>>>
>>>  mostly C,
>>>  C++ ( 5 percent chance).
>>>  and java very very rare..
>>>
>>> Based on the number of students short listed after the first round,
>>> they would recruit only 1/3rd of the count.
>>>
>>> Round 2:
>>> Technical.
>>>
>>> There will be three or more types of panels depending on the number of
>>> people to be recruited. The panel that you might be called for is
>>> purely random and based on the "L U C K" factor.
>>>
>>> One panel might have pure coding where in full C and Data Structure
>>> questions will be asked.
>>>
>>> Another panel might ask general theoretical questions from all areas -
>>> networks, dbms, oops, c, data structures, etc... even puzzles.
>>>
>>> The other panel would ask questions only from the area of interest
>>> that you specify. Please put in the area which you are strongest at.
>>> All possible questions will be asked from your area of interest.
>>>
>>> HR Round:
>>> General as usual questions only. Mostly if you clear the technical
>>> rounds, then HR is "chumma... namesake". U will be recruited :) :)
>>>
>>> Some details about the company:
>>>
>>> Basically a storage management company
>>> Core work:  RAID groups, storage solutions for other clients.
>>> Also working on virtualization (virtual servers) and now moving
>>> towards cloud computing
>>>
>>>
>>> ALL THE BEST :) :)
>>>
>>> On Sep 24, 6:46 pm, aditya kumar  wrote:
>>> > does any one have the idea about emc2 .?? if yes plz do share the
>>> details
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SOURCEBITS :: EXPERIENCE

2011-09-30 Thread aditya kumar
1st round was a written test . It had 30 mcq's . This was the easiest mcq's
.
20 simple aptitude questions were thr along with some 10 C questions .

21 students were shortlisted for the first round .
in the interview round they asked me basics questions possibly from all the
subjects .
1) deadlock and their condition .
2) any three unix command .
3) dangling pointer and how to avoid dangling ptr .
4) osi layers , their function and protocols used in applocation layer
5) virtual function . and why are they needed .
6) process management .
7) l-value .(this is the only question where i couldnt find proper example
to explain )
8) lseek , what happens if do lseek after we have reached the end of a file
.
9) syntax of open command in unix .
10) features of oops and some real life example .
11) how to do data hiding in oops .

and few more question which i dint remember

For 15 mins he asked me about my project . He went into details of few of
them .
Since i had done my projects on android so i guess it added to my advantage
.

after the long four hour wait they announced shortlisted candidates for HR
round .
they short listed 13 out of 21.

In HR round :
This was very different Hr round as it was on skype that too video call.
Here you got to be very careful coz you dont have the liberty to properly
express yourself with hand gestures . There were basic HR questions .
Basically you need to sell yourself acc to thier needs . So i convinced them
with proper evidence and examples that i am kind of candidates they are
looking for . Its very important to go thru the comoany websites since then
only you can try explaining  them how you can fit into company needs .

It took them almost 36 hrs to announce the results .
Finally they short-listed 6 out of 13 .

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Yahoo

2011-09-29 Thread aditya kumar
u can use any lang .
perl python etc .

On Thu, Sep 29, 2011 at 10:57 AM, prasanth n  wrote:

> c++ and java ll be given more preference
>
>
> On Mon, Sep 26, 2011 at 5:59 PM, abhishek wrote:
>
>> c,c++ ,java
>>
>> On Sep 26, 4:15 pm, Akash Mukherjee  wrote:
>> > any language pref?? are bash solns acceptable??
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Sep 26, 2011 at 12:04 PM, abhishek 
>> wrote:
>> >
>> > > a file is given containing lots of records seprated by new line
>> > > (records can be repeat)
>> > > and a substring given for eg"abc"
>> >
>> > > now check for the record which contains the substring
>> > > and print top 10 record according to their frequency
>> >
>> > > derive algo with complexity o(n)
>> >
>> > > On Sep 26, 10:58 am, htross  wrote:
>> > > > can u explain more on the coding  question u solved?
>> >
>> > > > On Sep 26, 9:08 am, aditya kumar 
>> wrote:
>> >
>> > > > > I cleared the written round, the next round was coding round.
>> >
>> > > > > We were asked to select any one problem out of three in 2 hrs.
>> >
>> > > > > Q1) Given n number of xml files find a particular word and output
>> > > should
>> > > > > list all the files in current directory that contains that word.
>> >
>> > > > > Q2) Given a hierarichal structure i.e., you have a parent class, a
>> > > child
>> > > > > class which extends a parent class which has some attributes and
>> > > methods.
>> > > > > You need
>> >
>> > > > > to parse the structure and output should give you the set of the
>> base
>> > > class,
>> > > > > set of derived class, set of attribute set and the set of method.
>> >
>> > > > > Q3) Input -> India is a great country. Key(alphanumeric) - B2. You
>> have
>> > > to
>> > > > > encrypt the given sentence, in such a way that only the words
>> should be
>> > > > > jumbled.
>> >
>> > > > > Output -> great India a is country. While decrypting it, you have
>> to
>> > > use the
>> > > > > same alpha numeric key and we should be able to get the same
>> original
>> > > > > string,
>> >
>> > > > > i.e., India is a great country.
>> >
>> > > > > I opted for the 3rd question, I used an array to store the
>> starting
>> > > offset
>> > > > > of a word and i used key to shuffle the offset. i used hash
>> function
>> > > which
>> > > > > takes
>> >
>> > > > > the key and according the key value it shuffles the set of offsets
>> > > while
>> > > > > doing encryption. While decrypting i used the reverse method and i
>> > > shuffled
>> > > > > the same
>> >
>> > > > > way to get back the original offset. After 2 hrs the external
>> asked me
>> > > to
>> > > > > explain my logic, i explained each and every line and he was very
>> much
>> > > happy
>> > > > > with
>> >
>> > > > > the algorithm. He asked all the students to wait outside.
>> >
>> > > > > They shortly announced the results for the next interview round.
>> >
>> > > > > Technical round -1
>> >
>> > > > > He asked me whether i was nervous, i told him frankly, yes sir a
>> little
>> > > bit.
>> > > > > Then he motivated me by saying that you have done well in the
>> previous
>> > > > > rounds
>> >
>> > > > > thats why you are here.
>> >
>> > > > > Then he asked me to solve a problem. The problem was given a time
>> in
>> > > format
>> > > > > of hh:mm we have to find the min angle between hr nd min hand.
>> >
>> > > > > I answered him well and he was happy with that so he did not aske
>> me to
>> > > > > write the code.
>> >
>> > > > > Second question -> There is a system which continuously takes
>> stream of
>> > > data
>> > > > > from one end, and

[algogeeks] INTEL recruitment process

2011-09-29 Thread aditya kumar
Guys does any one hve the idea about INTEL interview process for CS students
?? The area they focus and types of question they ask .
If any have any idea plz help !
thnks

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Source Bits

2011-09-27 Thread aditya kumar
rajeev hw much did  they offer u ?

On Tue, Sep 27, 2011 at 5:55 PM, rajeev bharshetty wrote:

> Technical Interview :
>
>- Tell me about yourself ?
>
>
>
>  I emphasized more on my OpenSource projects and the Contribution
> to Amarok ( Video Player Project ). I even stressed on my knowledge
> of Qt Programming ( C++ library for Developing User Interfaces on Linux
> Platform ).
>
>- What do you mean by OpenSource ?
>
>
>
>   OpenSource softwares basically mean that the source code is open
> to you which provides the user the power to change his system in a way he
> likes.
>   The quote I gave was
>
>  “ OpenSource Softwares make you the master of your system rather than
> system mastering you” .
>
>
>- Tell me the basics of Qt Programming ?
>
>
> Qt Programming
>
>- What do you mean by signals and slots in Qt?
>- How does Signals, slots and functions internally work in C++?
>- Then some concepts on C++ programming ( Virtual Functions , Virtual
>Destructors ( Their internal Working ) ?
>- Some basic concepts of Inheritence and Overriding with examples.
>- Some basic concepts on Semaphores and their working ( With
>Implementation).
>
>
>
>
> HR Round :
>
> HR round was on Skype Video chatting on a MacBook Pro ( Awesome).
>
>- Tell me about yourself ,your family and your extra curricular
>activities.
>- What do you know about SourceBits?
>- She asked my CET ranking and my aggregate in RVCE .
>- I was asked about my projects .
>- Why do you want to join SourceBits?
>- What are the other offers you got?
>
>
> On Sun, Sep 25, 2011 at 11:51 AM, Manoj Bagari wrote:
>
>> first of all congrats rajeev for the placements :) :)
>> rajeev can u please tell us in more detaill about the technical anr hr
>> around
>> can u find any differenence on giving hr through skype
>> can u list questions that were asked in techinacal and hr around
>>
>> --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] without using '-'

2011-09-26 Thread aditya kumar
+1 to abhishek

On Mon, Sep 26, 2011 at 11:44 PM, Abhishek Gupta
wrote:

> thats basically taking twos' compliment and converting it to negative one
> and then adding it..its the same principle...which is used for dividing two
> numbers without using '/' and '-'...right kunal??
>
>
> On Mon, Sep 26, 2011 at 10:38 PM, Ashima .  wrote:
>
>> grt.we never generally use ~ operator. got to knw abt it.
>> Ashima
>> M.Sc.(Tech)Information Systems
>>  4th year
>> BITS Pilani
>> Rajasthan
>>
>>
>>
>>
>> On Mon, Sep 26, 2011 at 10:07 AM, ~*~VICKY~*~ wrote:
>>
>>> Tricky question with more tricky answers. thank you all.
>>>
>>>
>>> On Mon, Sep 26, 2011 at 9:55 PM, Kunal Yadav wrote:
>>>
 difference = x+ ~y +1

 On Mon, Sep 26, 2011 at 7:33 PM, ~*~VICKY~*~ 
 wrote:

> Find the difference of two numbers without using '-' operator !
>
> plz share ur solutions!
>
> --
> Cheers,
>
>   Vicky
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Regards
 Kunal Yadav
 (http://sourcebit.in)


  --
 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
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Cheers,
>>>
>>>   Vicky
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks & Regards
> Abhishek Gupta
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] without using '-'

2011-09-26 Thread aditya kumar
find the smallest of two number . then keep adding 1 to the smaller number
till you get the bigger number .
this will give you absolute diff so check for the correct ans .
in case you have floating number then add unit of fraction . and repeat the
same .
On Mon, Sep 26, 2011 at 7:33 PM, ~*~VICKY~*~ wrote:

> Find the difference of two numbers without using '-' operator !
>
> plz share ur solutions!
>
> --
> Cheers,
>
>   Vicky
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Sourcebits [wrriten n interview round]

2011-09-26 Thread aditya kumar
5.5 lakhs

On Mon, Sep 26, 2011 at 1:46 PM, Aditya Virmani wrote:

> what package did they offer?
>
> On Mon, Sep 26, 2011 at 9:41 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> 1st round was a written test . It had 30 mcq's . This was the easiest
>> mcq's .
>> 20 simple aptitude questions were thr along with some 10 C questions .
>>
>> 21 students were shortlisted for the first round .
>> in the interview round they asked me basics questions possibly from all
>> the subjects .
>> 1) deadlock and their condition .
>> 2) any three unix command .
>> 3) dangling pointer and how to avoid dangling ptr .
>> 4) osi layers , their function and protocols used in applocation layer
>> 5) virtual function . and why are they needed .
>> 6) process management .
>> 7) l-value .(this is the only question where i couldnt find proper example
>> to explain )
>> 8) lseek , what happens if do lseek after we have reached the end of a
>> file .
>> 9) syntax of open command in unix .
>> 10) features of oops and some real life example .
>> 11) how to do data hiding in oops .
>>
>> and few more question which i dint remember
>>
>> For 15 mins he asked me about my project . He went into details of few of
>> them .
>> Since i had done my projects on android so i guess it added to my
>> advantage .
>>
>> after the long four hour wait they announced shortlisted candidates for HR
>> round .
>> they short listed 13 out of 21.
>>
>> In HR round :
>> This was very different Hr round as it was on skype that too video call.
>> Here you got to be very careful coz you dont have the liberty to properly
>> express yourself with hand gestures . There were basic HR questions .
>> Basically you need to sell yourself acc to thier needs . So i convinced them
>> with proper evidence and examples that i am kind of candidates they are
>> looking for . Its very important to go thru the comoany websites since then
>> only you can try explaining  them how you can fit into company needs .
>>
>> It took them almost 36 hrs to announce the results .
>> Finally they short-listed 6 out of 13 .
>>
>>
>> On Mon, Sep 26, 2011 at 9:35 AM, manoj  wrote:
>>
>>> hi guys sourcebits is visiting  our campus tomorrow
>>> can anybody please telll us what type of question  wiill be there in
>>> wrriten and interview around
>>> it would be great help :)
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Sourcebits [wrriten n interview round]

2011-09-25 Thread aditya kumar
1st round was a written test . It had 30 mcq's . This was the easiest mcq's
.
20 simple aptitude questions were thr along with some 10 C questions .

21 students were shortlisted for the first round .
in the interview round they asked me basics questions possibly from all the
subjects .
1) deadlock and their condition .
2) any three unix command .
3) dangling pointer and how to avoid dangling ptr .
4) osi layers , their function and protocols used in applocation layer
5) virtual function . and why are they needed .
6) process management .
7) l-value .(this is the only question where i couldnt find proper example
to explain )
8) lseek , what happens if do lseek after we have reached the end of a file
.
9) syntax of open command in unix .
10) features of oops and some real life example .
11) how to do data hiding in oops .

and few more question which i dint remember

For 15 mins he asked me about my project . He went into details of few of
them .
Since i had done my projects on android so i guess it added to my advantage
.

after the long four hour wait they announced shortlisted candidates for HR
round .
they short listed 13 out of 21.

In HR round :
This was very different Hr round as it was on skype that too video call.
Here you got to be very careful coz you dont have the liberty to properly
express yourself with hand gestures . There were basic HR questions .
Basically you need to sell yourself acc to thier needs . So i convinced them
with proper evidence and examples that i am kind of candidates they are
looking for . Its very important to go thru the comoany websites since then
only you can try explaining  them how you can fit into company needs .

It took them almost 36 hrs to announce the results .
Finally they short-listed 6 out of 13 .

On Mon, Sep 26, 2011 at 9:35 AM, manoj  wrote:

> hi guys sourcebits is visiting  our campus tomorrow
> can anybody please telll us what type of question  wiill be there in
> wrriten and interview around
> it would be great help :)
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Yahoo

2011-09-25 Thread aditya kumar
I cleared the written round, the next round was coding round.

We were asked to select any one problem out of three in 2 hrs.

Q1) Given n number of xml files find a particular word and output should
list all the files in current directory that contains that word.

Q2) Given a hierarichal structure i.e., you have a parent class, a child
class which extends a parent class which has some attributes and methods.
You need



to parse the structure and output should give you the set of the base class,
set of derived class, set of attribute set and the set of method.

Q3) Input -> India is a great country. Key(alphanumeric) - B2. You have to
encrypt the given sentence, in such a way that only the words should be
jumbled.

Output -> great India a is country. While decrypting it, you have to use the
same alpha numeric key and we should be able to get the same original
string,



i.e., India is a great country.

I opted for the 3rd question, I used an array to store the starting offset
of a word and i used key to shuffle the offset. i used hash function which
takes



the key and according the key value it shuffles the set of offsets while
doing encryption. While decrypting i used the reverse method and i shuffled
the same



way to get back the original offset. After 2 hrs the external asked me to
explain my logic, i explained each and every line and he was very much happy
with



the algorithm. He asked all the students to wait outside.

They shortly announced the results for the next interview round.



Technical round -1

He asked me whether i was nervous, i told him frankly, yes sir a little bit.
Then he motivated me by saying that you have done well in the previous
rounds



thats why you are here.

Then he asked me to solve a problem. The problem was given a time in format
of hh:mm we have to find the min angle between hr nd min hand.

I answered him well and he was happy with that so he did not aske me to
write the code.

Second question -> There is a system which continuously takes stream of data
from one end, and from other end we want to retrive the particualr number
is



present in the system or not. Example -> If you are retriving for 10 and if
it is present then return the same number else return the closest value to
that



number. I used hashing then he asked me if I had a large input let us say in
lakhs then hashing is not ideal approach. Then i told him that its better to
use



max heap. Then he said ok and before moving to next questions he told me
that there are other better approach to this.

He asked about my favourite subjects since i told my fav subject was OS, he
started askimg me questions about OS.

The questions were

-Difference b/w semaphore and monitor

-There are two threads, one produces even number and other produces odd
number, how will you print the consecutive numbers.

-What is semaphore and how will you implement it?

-What is deadlock and what are 4 conditions of deadlock.

-Simulate deadlock(Pictorial diagram).

-Which data structure will you use for deadlock?

I answered all the above questions so he was very much happy with it.

Then and there he told me that i wont eliminate you in this round and would
like to see you in next round.




Technical round-2

He asked me about my previous round experience and asked me to introduce
myself for another 2/3 mins.

He gave me a problem, there is a function which returns 0 or 1. You need to
pass each and every element of the array one by one to that function and



depending on the return value, you need to store all the numbers in such a
way that all the true values should appear first and all the false value
should



appear last. After thinking for some time i came up with O(n) solution, he
asked me to future optimze it. Within 2 mins he moved on to next question.

Next question was a puzzle about aliens.

Third question was about the real life example of stack.

Fourth question was how the internet works as i told that OS and networking
was my strong subject.

Fifth question was how will you implement tree in real life example.

He asked me to wait outside for the result.



I got elimiated in that round and the next was HR round.

On Sun, Sep 25, 2011 at 9:06 PM, Aditya Virmani wrote:

> neone who has appeared for yahoo recently? can ne one mention thr i/w /
> written rounds experience; they visited dce 3 days back & also nit
> surathkal...
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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.

Re: [algogeeks] Source Bits

2011-09-24 Thread aditya kumar
ya same pattern was in PESIT college .
but be careful in mcq's 26/30 was cutt off .. it was easy n ya thr was no
negative marking . in objective they had more stress on number system .
i got selected in Sourcebits :)

On Sun, Sep 25, 2011 at 11:14 AM, aanchal goyal wrote:

> thanks a lot rajeev :)
>
>
> On Sun, Sep 25, 2011 at 11:03 AM, rajeev bharshetty 
> wrote:
>
>> SourceBits visited *RV College of Engineering *in Bangalore on 23rd
>> Sepetember.
>> There were 20 aptitude questions and 10 basic C Questions.
>> 1 Technical interview Round and 1 HR Round.
>> Apti Questions were usually from RS aggarwal (OK Type)
>> C Questions were very easy . Just brush up the basics .
>> In Technical Interviews they asked some basic OOPS concepts,C concepts and
>> on Semaphores and stuff.Quite easy to crack.
>> HR was on Skype where usual HR questions were asked.
>>
>> On Sun, Sep 25, 2011 at 10:55 AM, aanchal goyal > > wrote:
>>
>>> which all colleges have sourcebits visited? please share the questions
>>> asked/ pattern... thanks
>>>
>>> --
>>> Regards,*
>>> Aanchal Goyal*.
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards,*
> Aanchal Goyal*.
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] os ques about paging

2011-09-24 Thread aditya kumar
m sry i dint read the question properly
page no = vitual page % 3 ie 0 % 3 = 3
thrfre 3*1024 is starting addr of physical page
but the byte address will be 3*1024 + 512 = 3584

On Sun, Sep 25, 2011 at 10:12 AM, Vishnu Ganth wrote:

> 3584
>
>
> On Sun, Sep 25, 2011 at 9:53 AM, sivaviknesh s wrote:
>
>>
>>
>>
>> Consider a virtual memory system in which the virtual page addresses are
>> mapped onto physical page addresses as follow
>> Virtual page address.. Physical page address
>> 03
>> 12
>> 2...1
>> The address of any byte in this system is given by the ordered pair (v,d)
>> where v = virtual page address d = byte offset in the page
>> Assuming that the main memory is capable of holding 4 page frames, what is
>> the physical address of a byte having the virtual address (0,512) given that
>> the page size is 1024 bytes?
>> a) 3584
>> b) 2560
>> c) 1536
>> d) 512
>> e) 1024
>>
>>
>> --
>> Regards,
>> $iva
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> ~VISHNU~
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] os ques about paging

2011-09-24 Thread aditya kumar
c) 512

On Sun, Sep 25, 2011 at 9:53 AM, sivaviknesh s wrote:

>
>
>
> Consider a virtual memory system in which the virtual page addresses are
> mapped onto physical page addresses as follow
> Virtual page address.. Physical page address
> 03
> 12
> 2...1
> The address of any byte in this system is given by the ordered pair (v,d)
> where v = virtual page address d = byte offset in the page
> Assuming that the main memory is capable of holding 4 page frames, what is
> the physical address of a byte having the virtual address (0,512) given that
> the page size is 1024 bytes?
> a) 3584
> b) 2560
> c) 1536
> d) 512
> e) 1024
>
>
> --
> Regards,
> $iva
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: EMC^2

2011-09-24 Thread aditya kumar
since the company is about data and storage manageemnt so do we need to
stress on DBMS .??
and thnks fr all the help :)

On Sat, Sep 24, 2011 at 11:11 PM, siva viknesh wrote:

> Total Rounds: max 3.
> 1 written  + 1 tech + 1 hr
> Probably there might be a 2nd tech interview in case they are willing
> to take you for the company and want to give you another chance to
> prove yourself.
>
> Tomorrow itself they'll complete the recruitment process and shortlist
> the candidates.
>
>
> Round 1:
> Written Test:
>
>  mostly only general aptitude questions.
>  since the offer is increased, they might ask technical questions.
>
>  in technical test:
>
>  mostly C,
>  C++ ( 5 percent chance).
>  and java very very rare..
>
> Based on the number of students short listed after the first round,
> they would recruit only 1/3rd of the count.
>
> Round 2:
> Technical.
>
> There will be three or more types of panels depending on the number of
> people to be recruited. The panel that you might be called for is
> purely random and based on the "L U C K" factor.
>
> One panel might have pure coding where in full C and Data Structure
> questions will be asked.
>
> Another panel might ask general theoretical questions from all areas -
> networks, dbms, oops, c, data structures, etc... even puzzles.
>
> The other panel would ask questions only from the area of interest
> that you specify. Please put in the area which you are strongest at.
> All possible questions will be asked from your area of interest.
>
> HR Round:
> General as usual questions only. Mostly if you clear the technical
> rounds, then HR is "chumma... namesake". U will be recruited :) :)
>
> Some details about the company:
>
> Basically a storage management company
> Core work:  RAID groups, storage solutions for other clients.
> Also working on virtualization (virtual servers) and now moving
> towards cloud computing
>
>
> ALL THE BEST :) :)
>
> On Sep 24, 6:46 pm, aditya kumar  wrote:
> > does any one have the idea about emc2 .?? if yes plz do share the details
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] EMC^2

2011-09-24 Thread aditya kumar
does any one have the idea about emc2 .?? if yes plz do share the details

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Flip kart

2011-09-23 Thread aditya kumar
yes mcq's wer in online test .
1st coding question was to print all ascending  lexical order of ()
http://chinmaylokesh.wordpress.com/2011/02/23/catalan-number-combinatorial-problem-print-all-valid-properly-opened-and-closed-n-pairs-of-parentheses/
here
is the soln
2nd was very easy array problem

On Fri, Sep 23, 2011 at 1:12 PM, sagar pareek  wrote:

> and would u like to please tell me the online coding questions...
>
>
> On Fri, Sep 23, 2011 at 1:10 PM, sagar pareek wrote:
>
>> thanx a ton
>> one more query...
>> was mcq is in online test?
>>
>>
>> On Fri, Sep 23, 2011 at 1:54 AM, aditya kumar <
>> aditya.kumar130...@gmail.com> wrote:
>>
>>> those three question they ASKD me in interview nt in coding round n they
>>> are very particular abt coding
>>>
>>>
>>> On Fri, Sep 23, 2011 at 1:53 AM, aditya kumar <
>>> aditya.kumar130...@gmail.com> wrote:
>>>
>>>> 11.5 fr our college
>>>> they will hve online test .. 3 coding question and u need to attempnt
>>>> any two ..25mcq's .. mcq;s wer mostly frm sql ..
>>>>  Q-> Given a linked list find whether the linked list is palindrome or
>>>> not. I gave him solution by modifying the linked list then i gave solution
>>>> using extra
>>>> space then i gave solution using recursion. First i gave complexity as
>>>> O(n^2) using brute force. He asked me to reduce the complexity then i moved
>>>> on to
>>>> modify the linked list itself, he told me not to modify the linked list.
>>>> Then i went for the extra linked list. Then he asked me not to use extra
>>>> space and
>>>> finally i came up with a recursive solution. And he was very much happy
>>>> after seeing the recursive solution, i think thats wat he was looking for.
>>>> Q-> I was asked to do a level order traversal in binary tree. I used
>>>> queue.
>>>> Q-> He asked me to do spiral traversal of a Binary Tree. I used stack
>>>> and queues for the alternate levels.
>>>>
>>>> On Thu, Sep 22, 2011 at 7:54 PM, sagar pareek wrote:
>>>>
>>>>> 12.5
>>>>>
>>>>>
>>>>> On Thu, Sep 22, 2011 at 5:49 PM, Adi Srikanth 
>>>>> wrote:
>>>>>
>>>>>> around 11.5 LPA gross
>>>>>> Regards,
>>>>>> Adi Srikanth.
>>>>>> Mob No 9887233349
>>>>>> Personal Pages: adisrikanth.co.nr
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Thu, Sep 22, 2011 at 11:55 AM, rahul sharma <
>>>>>> rahul23111...@gmail.com> wrote:
>>>>>>
>>>>>>> wats eligibility n package?
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Sep 22, 2011 at 12:26 AM, sagar pareek <
>>>>>>> sagarpar...@gmail.com> wrote:
>>>>>>>
>>>>>>>> nit allahabad
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Sep 22, 2011 at 12:20 AM, arpit rajpurohit <
>>>>>>>> arpit.rajpuro...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> which college may i know?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Sep 21, 2011 at 11:29 PM, sagar pareek <
>>>>>>>>> sagarpar...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>> it is coming in my college
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Wed, Sep 21, 2011 at 10:14 PM, arpit rajpurohit <
>>>>>>>>>> arpit.rajpuro...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> How did u applied for it? Can you please let me know..
>>>>>>>>>>>
>>>>>>>>>>>  On Wed, Sep 21, 2011 at 10:05 PM, sagar pareek <
>>>>>>>>>>> sagarpar...@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hello ...
>>>>>>>>>>>> Do anyone know the process and questions of "flip kart" ??
>>>>>>>>>>>>
>>>>>>>>>>>> --

Re: [algogeeks] Flip kart

2011-09-22 Thread aditya kumar
those three question they ASKD me in interview nt in coding round n they are
very particular abt coding

On Fri, Sep 23, 2011 at 1:53 AM, aditya kumar
wrote:

> 11.5 fr our college
> they will hve online test .. 3 coding question and u need to attempnt any
> two ..25mcq's .. mcq;s wer mostly frm sql ..
> Q-> Given a linked list find whether the linked list is palindrome or not.
> I gave him solution by modifying the linked list then i gave solution using
> extra
> space then i gave solution using recursion. First i gave complexity as
> O(n^2) using brute force. He asked me to reduce the complexity then i moved
> on to
> modify the linked list itself, he told me not to modify the linked list.
> Then i went for the extra linked list. Then he asked me not to use extra
> space and
> finally i came up with a recursive solution. And he was very much happy
> after seeing the recursive solution, i think thats wat he was looking for.
> Q-> I was asked to do a level order traversal in binary tree. I used queue.
> Q-> He asked me to do spiral traversal of a Binary Tree. I used stack and
> queues for the alternate levels.
>
> On Thu, Sep 22, 2011 at 7:54 PM, sagar pareek wrote:
>
>> 12.5
>>
>>
>> On Thu, Sep 22, 2011 at 5:49 PM, Adi Srikanth wrote:
>>
>>> around 11.5 LPA gross
>>> Regards,
>>> Adi Srikanth.
>>> Mob No 9887233349
>>> Personal Pages: adisrikanth.co.nr
>>>
>>>
>>>
>>> On Thu, Sep 22, 2011 at 11:55 AM, rahul sharma 
>>> wrote:
>>>
>>>> wats eligibility n package?
>>>>
>>>>
>>>> On Thu, Sep 22, 2011 at 12:26 AM, sagar pareek 
>>>> wrote:
>>>>
>>>>> nit allahabad
>>>>>
>>>>>
>>>>> On Thu, Sep 22, 2011 at 12:20 AM, arpit rajpurohit <
>>>>> arpit.rajpuro...@gmail.com> wrote:
>>>>>
>>>>>> which college may i know?
>>>>>>
>>>>>>
>>>>>> On Wed, Sep 21, 2011 at 11:29 PM, sagar pareek >>>>> > wrote:
>>>>>>
>>>>>>> it is coming in my college
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Sep 21, 2011 at 10:14 PM, arpit rajpurohit <
>>>>>>> arpit.rajpuro...@gmail.com> wrote:
>>>>>>>
>>>>>>>> How did u applied for it? Can you please let me know..
>>>>>>>>
>>>>>>>>  On Wed, Sep 21, 2011 at 10:05 PM, sagar pareek <
>>>>>>>> sagarpar...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Hello ...
>>>>>>>>> Do anyone know the process and questions of "flip kart" ??
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> **Regards
>>>>>>>>> SAGAR PAREEK
>>>>>>>>> COMPUTER SCIENCE AND ENGINEERING
>>>>>>>>> NIT ALLAHABAD
>>>>>>>>>
>>>>>>>>>  --
>>>>>>>>> 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
>>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>>
>>>>>>>>
>>>>>>>>  --
>>>>>>>> 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
>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> **Regards
>>>>>>> SAGAR PAREEK
>>>>>>> COMPUTER 

Re: [algogeeks] Flip kart

2011-09-22 Thread aditya kumar
11.5 fr our college
they will hve online test .. 3 coding question and u need to attempnt any
two ..25mcq's .. mcq;s wer mostly frm sql ..
Q-> Given a linked list find whether the linked list is palindrome or not. I
gave him solution by modifying the linked list then i gave solution using
extra
space then i gave solution using recursion. First i gave complexity as
O(n^2) using brute force. He asked me to reduce the complexity then i moved
on to
modify the linked list itself, he told me not to modify the linked list.
Then i went for the extra linked list. Then he asked me not to use extra
space and
finally i came up with a recursive solution. And he was very much happy
after seeing the recursive solution, i think thats wat he was looking for.
Q-> I was asked to do a level order traversal in binary tree. I used queue.
Q-> He asked me to do spiral traversal of a Binary Tree. I used stack and
queues for the alternate levels.

On Thu, Sep 22, 2011 at 7:54 PM, sagar pareek  wrote:

> 12.5
>
>
> On Thu, Sep 22, 2011 at 5:49 PM, Adi Srikanth wrote:
>
>> around 11.5 LPA gross
>> Regards,
>> Adi Srikanth.
>> Mob No 9887233349
>> Personal Pages: adisrikanth.co.nr
>>
>>
>>
>> On Thu, Sep 22, 2011 at 11:55 AM, rahul sharma 
>> wrote:
>>
>>> wats eligibility n package?
>>>
>>>
>>> On Thu, Sep 22, 2011 at 12:26 AM, sagar pareek wrote:
>>>
 nit allahabad


 On Thu, Sep 22, 2011 at 12:20 AM, arpit rajpurohit <
 arpit.rajpuro...@gmail.com> wrote:

> which college may i know?
>
>
> On Wed, Sep 21, 2011 at 11:29 PM, sagar pareek 
> wrote:
>
>> it is coming in my college
>>
>>
>> On Wed, Sep 21, 2011 at 10:14 PM, arpit rajpurohit <
>> arpit.rajpuro...@gmail.com> wrote:
>>
>>> How did u applied for it? Can you please let me know..
>>>
>>>  On Wed, Sep 21, 2011 at 10:05 PM, sagar pareek <
>>> sagarpar...@gmail.com> wrote:
>>>
 Hello ...
 Do anyone know the process and questions of "flip kart" ??

 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> **Regards
>> SAGAR PAREEK
>> COMPUTER SCIENCE AND ENGINEERING
>> NIT ALLAHABAD
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 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
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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.
>> 

Re: [algogeeks] Re: matrix

2011-09-17 Thread aditya kumar
@prasanth : sinjalspecial is correct bt his code works for 1D array . for 2D
array you can think of array of 1D array and then implement the same .
newazz here is one link :
http://tech-queries.blogspot.com/2010/05/find-max-sum-in-2d-array.html

On Sat, Sep 17, 2011 at 8:43 PM, tech coder wrote:

> people just dont read the question properly and post the answer
>
> On 9/17/11, prasanth n  wrote:
> > @sinjanspecial:
> >
> > i think your code is for an 1 D matrix..but i have to find for a 2D
> matrix..
> >
> > On Sat, Sep 17, 2011 at 7:33 PM, sinjanspecial
> > wrote:
> >
> >> hii I think this code will work
> >>
> >> #include
> >> #include
> >>
> >> void largestsum(int a[],int n)
> >> {
> >>int s=0,e=0,ls=0,max=0,j,i,sum=0;
> >>for(i=0;i >>{
> >>sum+=a[i];
> >>if(sum>max)
> >>{
> >>max=sum;
> >>e=i;
> >>s=ls;
> >>}
> >>if(sum<0)
> >>{
> >>sum=0;
> >>ls=i+1;
> >>}
> >>}
> >>printf("\nlargest sum is=%d\n",max);
> >>printf("The element which make largest sum is\t");
> >>for(j=s;j<=e;j++)
> >>{
> >>printf("%d\t",a[j]);
> >>}
> >> }
> >>
> >> int main() {
> >>
> >>int a[]={6,4,-5,5,2,8,-21,15,4};
> >>int n=9;
> >>largestsum(a,n);
> >>
> >>
> >>return 0;
> >> }
> >>
> >> Thanks & Regards
> >> Sinjan
> >> M.Tech(s/w engg)
> >> DTU delhi
> >> On Sep 17, 2:55 pm, prasanth n  wrote:
> >> > given a matrix with +ve and -ve numbers, find the submatrix with
> maximum
> >> > sum??
> >> >
> >> > --
> >> > *prasanth*
> >>
> >> --
> >> 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
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >>
> >
> >
> > --
> > *prasanth*
> >
> > --
> > 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
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
> --
> *
>
>  Regards*
> *"The Coder"*
>
> *"Life is a Game. The more u play, the more u win, the more u win , the
> more
> successfully u play"*
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] External Sort : source code or any link ??

2011-09-17 Thread aditya kumar
External Sort : source code or any link ??

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Directi Questions - needed answers

2011-09-17 Thread aditya kumar
see here the basic operation is comparision so we can express comaprision in
terms of order of O(n). newazz we still require n-1 comparisions to find
second max .
On Sat, Sep 17, 2011 at 5:06 PM, Yogesh Yadav  wrote:

> @aditya:
> comparing isn't complexity here... here it means no. of comparisons between
> 2 numbers...
>
>
> On Sat, Sep 17, 2011 at 5:04 PM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> @yogesh: we can get second max by comparing n elements ie O(n).
>>
>>
>> On Sat, Sep 17, 2011 at 4:59 PM, Ashima .  wrote:
>>
>>> ans 8:
>>> it should be 40%
>>> @dheeraj: if total is 100 percent and other person paid more than 1st
>>> person.Than how can the 1st person's percentage be more than 50%?
>>>
>>> Ashima
>>> M.Sc.(Tech)Information Systems
>>> 4th year
>>> BITS Pilani
>>> Rajasthan
>>>
>>>
>>>
>>>
>>> On Sat, Sep 17, 2011 at 4:20 AM, Yogesh Yadav  wrote:
>>>
>>>> Ans 1. apply bubble sort. outer loop should run just two times because
>>>> in 2nd time the 2nd largest element will be at 2nd last position...
>>>> comparisons=(n-1)+(n-2)
>>>>
>>>> On Sat, Sep 17, 2011 at 4:27 PM, Ashima . wrote:
>>>>
>>>>> ans 2:
>>>>> http://www.qbyte.org/puzzles/p131s.html
>>>>>
>>>>> Ashima
>>>>> M.Sc.(Tech)Information Systems
>>>>> 4th year
>>>>> BITS Pilani
>>>>> Rajasthan
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Sep 17, 2011 at 1:46 AM, Ashima . wrote:
>>>>>
>>>>>> ans1: i think 2n but may be better solution is posible
>>>>>> Ashima
>>>>>> M.Sc.(Tech)Information Systems
>>>>>>  4th year
>>>>>> BITS Pilani
>>>>>> Rajasthan
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Sep 16, 2011 at 11:19 PM, Dheeraj Sharma <
>>>>>> dheerajsharma1...@gmail.com> wrote:
>>>>>>
>>>>>>> ans 7. - 15 km east and 12 km south of origin
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Sep 17, 2011 at 11:29 AM, Dheeraj Sharma <
>>>>>>> dheerajsharma1...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Ans 8.   62.5 % ???
>>>>>>>>
>>>>>>>>
>>>>>>>> On Sat, Sep 17, 2011 at 9:11 AM, VIHARRI wrote:
>>>>>>>>
>>>>>>>>> 1. Minimum no.of comparisons required to select the 2nd max element
>>>>>>>>> in
>>>>>>>>> an array of N numbers.
>>>>>>>>>
>>>>>>>>> 2. What are the number of counting ties for four horses. ( example
>>>>>>>>> for
>>>>>>>>> two horses A and B there are three cases - A wins, B wins, A & B
>>>>>>>>> ties ).
>>>>>>>>>
>>>>>>>>> 3. What are the minimum no.of tournaments needed to get the winner.
>>>>>>>>> A
>>>>>>>>> player is out when he loses two matches. Total players are 51.
>>>>>>>>> ( Badminton ).
>>>>>>>>>
>>>>>>>>> 4. while(true)
>>>>>>>>>{
>>>>>>>>> sleep 1sencond;
>>>>>>>>> if( getpid() % 2 == 0 )
>>>>>>>>> {
>>>>>>>>> fork();
>>>>>>>>> }
>>>>>>>>>   }
>>>>>>>>> How many no.of processes are created by the end of 12th second, if
>>>>>>>>> time starts from 0th second? Process id's start from 0.
>>>>>>>>>
>>>>>>>>> 5. Which of the following are thread safe?
>>>>>>>>> a) Atomic operations
>>>>>>>>> b) Mutual exclusion
>>>>>>>>> c) Re-entrant
>>>>>>>>> d) Queuing
>>>>>>>>>
>>>>>>>>> 6. When a dice is rolled the outcome of the face is summed up each
>>>>>

Re: [algogeeks] matrix

2011-09-17 Thread aditya kumar
i guess kadane's algo doesnt tell u abt the subarray element instead it
tells abt max sum of subarray . to get the element of subarray store the
end_offset whenever your max_sum changes .

On Sat, Sep 17, 2011 at 4:47 PM, sukran dhawan wrote:

> kadane s algo
>
>
> On Sat, Sep 17, 2011 at 3:25 PM, prasanth n  wrote:
>
>> given a matrix with +ve and -ve numbers, find the submatrix with maximum
>> sum??
>>
>> --
>> *prasanth*
>>
>> --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Directi Questions - needed answers

2011-09-17 Thread aditya kumar
@yogesh: we can get second max by comparing n elements ie O(n).

On Sat, Sep 17, 2011 at 4:59 PM, Ashima .  wrote:

> ans 8:
> it should be 40%
> @dheeraj: if total is 100 percent and other person paid more than 1st
> person.Than how can the 1st person's percentage be more than 50%?
>
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Sat, Sep 17, 2011 at 4:20 AM, Yogesh Yadav  wrote:
>
>> Ans 1. apply bubble sort. outer loop should run just two times because in
>> 2nd time the 2nd largest element will be at 2nd last position...
>> comparisons=(n-1)+(n-2)
>>
>> On Sat, Sep 17, 2011 at 4:27 PM, Ashima .  wrote:
>>
>>> ans 2:
>>> http://www.qbyte.org/puzzles/p131s.html
>>>
>>> Ashima
>>> M.Sc.(Tech)Information Systems
>>> 4th year
>>> BITS Pilani
>>> Rajasthan
>>>
>>>
>>>
>>>
>>> On Sat, Sep 17, 2011 at 1:46 AM, Ashima .  wrote:
>>>
 ans1: i think 2n but may be better solution is posible
 Ashima
 M.Sc.(Tech)Information Systems
  4th year
 BITS Pilani
 Rajasthan




 On Fri, Sep 16, 2011 at 11:19 PM, Dheeraj Sharma <
 dheerajsharma1...@gmail.com> wrote:

> ans 7. - 15 km east and 12 km south of origin
>
>
> On Sat, Sep 17, 2011 at 11:29 AM, Dheeraj Sharma <
> dheerajsharma1...@gmail.com> wrote:
>
>> Ans 8.   62.5 % ???
>>
>>
>> On Sat, Sep 17, 2011 at 9:11 AM, VIHARRI wrote:
>>
>>> 1. Minimum no.of comparisons required to select the 2nd max element
>>> in
>>> an array of N numbers.
>>>
>>> 2. What are the number of counting ties for four horses. ( example
>>> for
>>> two horses A and B there are three cases - A wins, B wins, A & B
>>> ties ).
>>>
>>> 3. What are the minimum no.of tournaments needed to get the winner. A
>>> player is out when he loses two matches. Total players are 51.
>>> ( Badminton ).
>>>
>>> 4. while(true)
>>>{
>>> sleep 1sencond;
>>> if( getpid() % 2 == 0 )
>>> {
>>> fork();
>>> }
>>>   }
>>> How many no.of processes are created by the end of 12th second, if
>>> time starts from 0th second? Process id's start from 0.
>>>
>>> 5. Which of the following are thread safe?
>>> a) Atomic operations
>>> b) Mutual exclusion
>>> c) Re-entrant
>>> d) Queuing
>>>
>>> 6. When a dice is rolled the outcome of the face is summed up each
>>> time, and rolling is stopped when the sum becomes greater than 100.
>>> Which of the following have more probability to become sum.
>>> a) 103
>>> b) 102
>>> c) 100
>>> d) all have equal probability
>>> e) 101
>>>
>>> 7. A man moves 1km east, 2km north, 3km west, 4km south, 5km east,
>>> 6km
>>> north, 7km west and so on until he travels total of 300km so what
>>> will be the distance from origin?
>>>
>>> 8. Alam bought 5pens, 7 pencils, 4 erasers. Ashok bought 6 pens, 8
>>> erasers, 14 pencils and paid half more the amount Alam paid. What is
>>> the percentage of amount did Alam spent on buying pens?
>>>
>>> 9. Time complexity to get min elements from MAX heap.
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> *Dheeraj Sharma*
>> Comp Engg.
>> NIT Kurukshetra
>>
>>
>>
>
>
> --
> *Dheeraj Sharma*
> Comp Engg.
> NIT Kurukshetra
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>


>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/gr

[algogeeks]

2011-09-09 Thread aditya kumar
Given k sorted streams where each stream could possibly be infinite in
length, describe an efficient algorithm to merge the k streams into a new
stream (also in sorted order).

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Min no of moves

2011-09-05 Thread aditya kumar
we need n/2 swaps

On Mon, Sep 5, 2011 at 2:34 PM, sachin goyal  wrote:

> it means we r considring d value for 2*n...so need total n passes...
>
> On Mon, Sep 5, 2011 at 1:33 PM, aditya kumar  > wrote:
>
>> @dheeraj : u are right . i dint read the question properly . i thot there
>> are total n glasses so i answerd : n/4 swaps . bt since we have 2n glass so
>> we need n/2 swaps . i guess gopi did the same mistake
>> @sachin : yes u are also correct since the glasses are identical the order
>> of swapping doesnt matter . yes u can do that way also . the onli thing is
>> dat u will require n/2 swaps .
>>
>>
>>
>> On Mon, Sep 5, 2011 at 12:12 PM, Dheeraj Sharma <
>> dheerajsharma1...@gmail.com> wrote:
>>
>>> i thnk n/2 swaps are required... 1/4 is of the total glasses present..
>>> i.e. 2n/4 ..=n/2
>>>
>>>
>>> On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal wrote:
>>>
>>>> PLEASE CORRECT ME ADITYA
>>>>
>>>>
>>>> On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal wrote:
>>>>
>>>>> 12345|12345
>>>>> F|E
>>>>> WE HAVE TO CREATE THE PATTERN LIKE
>>>>> F E F E F E F E F E
>>>>> ACCORDING TO MY UNDERSTANDING WE CAN DIRECTLY REPLACE THE 2ND WITH
>>>>> SECOND AND 4TH WITH 4TH
>>>>> TELL CORRECT ME IF I AM WRONG AND I AM TRATING WRONG???
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Sep 4, 2011 at 8:04 PM, *$*  wrote:
>>>>>
>>>>>> yes n/4 swaps are required. +1 aditya kumar
>>>>>>
>>>>>>
>>>>>> On Sun, Sep 4, 2011 at 6:32 PM, aditya kumar <
>>>>>> aditya.kumar130...@gmail.com> wrote:
>>>>>>
>>>>>>> swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 .
>>>>>>> so we need n/4 swaps .
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage wrote:
>>>>>>>
>>>>>>>> That's interesting.
>>>>>>>>
>>>>>>>> when n = 3
>>>>>>>>
>>>>>>>> We have been given this :F F F | E E E
>>>>>>>>
>>>>>>>> Swap the middle element and it becomes: F E F | E F E
>>>>>>>>
>>>>>>>> Which is what you want, but when n = 5
>>>>>>>>
>>>>>>>> F F F F F | E E E E E
>>>>>>>>
>>>>>>>> And you swap the middle element it becomes: F F E F F | E E F E E
>>>>>>>>
>>>>>>>> So the same startegy doesn't apply.
>>>>>>>>
>>>>>>>> But if you do with from the center for every alternate element, it
>>>>>>>> works
>>>>>>>>
>>>>>>>> for n = 3
>>>>>>>>
>>>>>>>> F F F | E E E > F F E | F E E > E F E | E F E
>>>>>>>>
>>>>>>>> It also works for n = 5 etc. So, It is a more uniform solution if
>>>>>>>> you may.
>>>>>>>>
>>>>>>>>  --
>>>>>>>> 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
>>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>>
>>>>>>>
>>>>>>>  --
>>>>>>> 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
>>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>>
>>>>>

Re: [algogeeks] Min no of moves

2011-09-05 Thread aditya kumar
@dheeraj : u are right . i dint read the question properly . i thot there
are total n glasses so i answerd : n/4 swaps . bt since we have 2n glass so
we need n/2 swaps . i guess gopi did the same mistake
@sachin : yes u are also correct since the glasses are identical the order
of swapping doesnt matter . yes u can do that way also . the onli thing is
dat u will require n/2 swaps .


On Mon, Sep 5, 2011 at 12:12 PM, Dheeraj Sharma  wrote:

> i thnk n/2 swaps are required... 1/4 is of the total glasses present.. i.e.
> 2n/4 ..=n/2
>
>
> On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal wrote:
>
>> PLEASE CORRECT ME ADITYA
>>
>>
>> On Mon, Sep 5, 2011 at 11:52 AM, sachin goyal wrote:
>>
>>> 12345|12345
>>> F|E
>>> WE HAVE TO CREATE THE PATTERN LIKE
>>> F E F E F E F E F E
>>> ACCORDING TO MY UNDERSTANDING WE CAN DIRECTLY REPLACE THE 2ND WITH SECOND
>>> AND 4TH WITH 4TH
>>> TELL CORRECT ME IF I AM WRONG AND I AM TRATING WRONG???????
>>>
>>>
>>>
>>> On Sun, Sep 4, 2011 at 8:04 PM, *$*  wrote:
>>>
>>>> yes n/4 swaps are required. +1 aditya kumar
>>>>
>>>>
>>>> On Sun, Sep 4, 2011 at 6:32 PM, aditya kumar <
>>>> aditya.kumar130...@gmail.com> wrote:
>>>>
>>>>> swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 .
>>>>> so we need n/4 swaps .
>>>>>
>>>>>
>>>>> On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage wrote:
>>>>>
>>>>>> That's interesting.
>>>>>>
>>>>>> when n = 3
>>>>>>
>>>>>> We have been given this :F F F | E E E
>>>>>>
>>>>>> Swap the middle element and it becomes: F E F | E F E
>>>>>>
>>>>>> Which is what you want, but when n = 5
>>>>>>
>>>>>> F F F F F | E E E E E
>>>>>>
>>>>>> And you swap the middle element it becomes: F F E F F | E E F E E
>>>>>>
>>>>>> So the same startegy doesn't apply.
>>>>>>
>>>>>> But if you do with from the center for every alternate element, it
>>>>>> works
>>>>>>
>>>>>> for n = 3
>>>>>>
>>>>>> F F F | E E E > F F E | F E E > E F E | E F E
>>>>>>
>>>>>> It also works for n = 5 etc. So, It is a more uniform solution if you
>>>>>> may.
>>>>>>
>>>>>>  --
>>>>>> 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
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> 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
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thx,
>>>> --Gopi
>>>>
>>>>
>>>>  --
>>>> 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
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *Dheeraj Sharma*
> Comp Engg.
> NIT Kurukshetra
> +91 8950264227
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Network Question

2011-09-04 Thread aditya kumar
for communication with other n/w they use NAT .
along with the i/p address port number is also stored in the table .
On Sat, Sep 3, 2011 at 11:54 PM, sagar pareek  wrote:

> mask*
>
>
> On Sat, Sep 3, 2011 at 11:54 PM, sagar pareek wrote:
>
>> ok i know it will match longest mask...but then it will always skip the ip
>> of shorter mast if it has same ip address
>>
>>
>> On Sat, Sep 3, 2011 at 10:15 PM, sukran dhawan wrote:
>>
>>> ya the longest mask matching will take place
>>>
>>>
>>> On Sat, Sep 3, 2011 at 9:17 PM, VIHARRI  wrote:
>>>
>>>> I think the communication problem is just bcoz of longest prefix
>>>> match...
>>>>
>>>> On Sep 3, 10:09 am, Vengadanathan  wrote:
>>>> > ya both the subnet can exisit in the same network , but problem is
>>>> > lack of communication between the two subnets ,because in routing
>>>> > table of the router the record for  10.0.1.0/26 will be first then
>>>> > record for 10.0.1.0/24 will be , so 10.0.1.0/26 will be given first
>>>> > preference , so subnet 10.0.1.0/26 cannot communicate with
>>>> 10.0.1.0/24
>>>> > having same ip node more over packet sent within 10.0.1.0/24 will
>>>> > reach 10.0.1.0/26 not to the nodes on the same network .. so
>>>> > 10.0.1.0/24 can communicate with 10.0.1.0/26
>>>> > but cannot communicate within itself ..
>>>> >
>>>> > On Sep 3, 9:38 am, bharatkumar bagana 
>>>> > wrote:
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > > all the addresses which come under second addr will also come under
>>>> first
>>>> > > 
>>>> > > Can those 2 be exist in same LAN ?
>>>> > > If yes , how can router decides to which subnet it has to pass
>>>> through the
>>>> > > incoming packet ..
>>>> >
>>>> > > On Fri, Sep 2, 2011 at 6:36 PM, aditya kumar
>>>> > > wrote:
>>>> >
>>>> > > > their wont be any conflict in ip address . coz within dhcp assigns
>>>> ip
>>>> > > > adsress from the pool of available address and within the n/w
>>>> (LAN) we need
>>>> > > > to have unique ip address bt across the n/w (LAN) we can use same
>>>> ip from
>>>> > > > the pool of ip addresses .
>>>> >
>>>> > > > On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek <
>>>> sagarpar...@gmail.com>wrote:
>>>> >
>>>> > > >> It is urgent to get the answer thats why i m posting network
>>>> question
>>>> > > >> here... searching on net is not working
>>>> >
>>>> > > >>  HI !!
>>>> > > >> I stuck on a question related to VLSM
>>>> >
>>>> > > >> Suppose we have two subnets as
>>>> >
>>>> > > >> 10.0.1.0/24   valid ip address can be 10.0.1.2
>>>> >
>>>> > > >> and
>>>> >
>>>> > > >> 10.0.1.0/26 here also valid ip address can be 10.0.1.2
>>>> >
>>>> > > >> now suppose we are using these two subnets in a LAN and having
>>>> this ip
>>>> > > >> (10.0.1.2) in both the subnets then is there any IP conflict will
>>>> happen or
>>>> > > >> not?
>>>> >
>>>> > > >> --
>>>> > > >> **Regards
>>>> > > >> SAGAR PAREEK
>>>> > > >> COMPUTER SCIENCE AND ENGINEERING
>>>> > > >> NIT ALLAHABAD
>>>> >
>>>> > > >>  --
>>>> > > >> 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
>>>> > > >>http://groups.google.com/group/algogeeks?hl=en.
>>>> >
>>>&g

[algogeeks]

2011-09-04 Thread aditya kumar
How to find longest common substring in two strings ?
i want efficent code and iff possible any method other than using suffix
tree .

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Padding....

2011-09-04 Thread aditya kumar
padding related questions have been discussed many times . plz search.

On Sun, Sep 4, 2011 at 4:13 PM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:

> struct data
> {
> char a;
> int b;
> }__attribute__((packed));
> This is way to get the actual size of struct without any padding
> http://tuxsudh.blogspot.com/2005/05/structure-packing-in-gcc.html
>
>
> On Sun, Sep 4, 2011 at 2:38 AM, Debabrata Das <
> debabrata.barunhal...@gmail.com> wrote:
>
>> @Dheeraj, Thanks for the link
>> @Anshul
>> Considering double to be alligned as a 4 byte boundary..
>> structc_tag
>>
>> c 1 byte
>> padding 1 byte
>> padding 1 byte
>> padding 1 byte
>> double 8 byte
>> int4 byte
>>
>> whole structure is multiple of 4 so no padding required.
>>
>> structd_tag
>>
>> 8 byte for double
>> 4 byte for int
>> 1 byte for char
>>  padding 3 byte
>>
>> last 3 byte padding for structure size to be multiple of 4
>>
>> Correct me if am wrong
>>
>> On Sun, Sep 4, 2011 at 2:40 AM, Anshul AGARWAL
>>  wrote:
>> > #include 
>> >
>> > // structure C
>> > typedef struct structc_tag
>> > {
>> >charc;
>> >double  d;
>> >int s;
>> > } structc_t;
>> >
>> > // structure D
>> > typedef struct structd_tag
>> > {
>> >double  d;
>> >int s;
>> >charc;
>> > } structd_t;
>> >
>> > int main()
>> > {
>> >
>> >
>> >printf("sizeof(structc_t) = %d\n", sizeof(structc_t));
>> >printf("sizeof(structd_t) = %d\n", sizeof(structd_t));
>> >
>> >return 0;
>> > }
>> > plz explain the output ??
>> >
>> > --
>> > 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
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>>
>> --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
>
> **Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
> *BharatKumar Bagana*
> **http://www.google.com/profiles/bagana.bharatkumar
> *
> Mobile +91 8056127652*
> 
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Please provide Code to Find kth Smallest or kth Largest element in unsorted array in liner time ?

2011-09-04 Thread aditya kumar
first do quick sort . ie (nlog n) then find kth largest/smallest .

On Sun, Sep 4, 2011 at 6:28 PM, learner  wrote:

> something I Know using quick sort randomization function we can find
> kt smallest/largest in unsorted array , but i am not able to write
> code , please help me in this and provide the code for the same.?
>
>
> Thanks
> Nimish K.
> 1st Year
> IITR
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Min no of moves

2011-09-04 Thread aditya kumar
swap n/2-1 with n/2+1 , and then n/2-3 with n/2+3 till we reach n-1 .
so we need n/4 swaps .

On Sun, Sep 4, 2011 at 5:28 PM, Anup Ghatage  wrote:

> That's interesting.
>
> when n = 3
>
> We have been given this :F F F | E E E
>
> Swap the middle element and it becomes: F E F | E F E
>
> Which is what you want, but when n = 5
>
> F F F F F | E E E E E
>
> And you swap the middle element it becomes: F F E F F | E E F E E
>
> So the same startegy doesn't apply.
>
> But if you do with from the center for every alternate element, it works
>
> for n = 3
>
> F F F | E E E > F F E | F E E > E F E | E F E
>
> It also works for n = 5 etc. So, It is a more uniform solution if you may.
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Tejas networks

2011-09-04 Thread aditya kumar
q4) floyds algorithm for shortest path .

On Sun, Sep 4, 2011 at 5:41 PM, sukran dhawan wrote:

> for q3 :either both inorder and preorder traversal shud be stored or
> inorder and postorder shud be stored
>
>
> On Sun, Sep 4, 2011 at 2:54 PM, sukran dhawan wrote:
>
>>
>>
>> -- Forwarded message --
>> From: sukran dhawan 
>> Date: Sun, Sep 4, 2011 at 2:53 PM
>> Subject: Re: [algogeeks] Tejas networks
>> To: algogeeks@googlegroups.com
>>
>>
>> reverse a linked list
>>
>> void reverse(struct node ** head)
>> {
>> struct node * last,*temp;
>>
>> last = *head;
>> while(last->next != null)
>> last = last->next;
>>
>> while(*head != last)
>> {
>> temp = *head;
>> *head = (*head)->next;
>> temp->next = last->next;
>> last->next = temp
>> }
>> }
>>
>> On Sun, Sep 4, 2011 at 2:46 PM, Anup Ghatage  wrote:
>>
>>> Could you please give an example for question 3?
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Network Question

2011-09-02 Thread aditya kumar
their wont be any conflict in ip address . coz within dhcp assigns ip
adsress from the pool of available address and within the n/w (LAN) we need
to have unique ip address bt across the n/w (LAN) we can use same ip from
the pool of ip addresses .


On Sat, Sep 3, 2011 at 1:56 AM, sagar pareek  wrote:

> It is urgent to get the answer thats why i m posting network question
> here... searching on net is not working
>
>  HI !!
> I stuck on a question related to VLSM
>
> Suppose we have two subnets as
>
> 10.0.1.0/24   valid ip address can be 10.0.1.2
>
> and
>
> 10.0.1.0/26 here also valid ip address can be 10.0.1.2
>
> now suppose we are using these two subnets in a LAN and having this ip
> (10.0.1.2) in both the subnets then is there any IP conflict will happen or
> not?
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] akamai

2011-09-02 Thread aditya kumar
haha ya i missd one zero its rs 1008000 ctc

On Fri, Sep 2, 2011 at 6:09 PM, sukran dhawan wrote:

> i think u missed a zero :)
>
>
> On Fri, Sep 2, 2011 at 5:49 PM, aditya kumar  > wrote:
>
>> Rs 100800 // this is CTC
>> basic pay is around 7lakhs
>>
>>
>> On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan wrote:
>>
>>> how much they pay ?
>>>
>>> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
>>> aditya.kumar130...@gmail.com> wrote:
>>>
>>>> they basically ask questions on DBMS and networking.
>>>> In DBMS fst round mainly had SQL and 1 coding question related to ER
>>>> DIAGRAM .
>>>> in written round 3 question ws thr
>>>> 1)ER diagram
>>>> 2)stack n que
>>>> 3)print this pattrn for n=3
>>>> X***X
>>>> *X*X*
>>>> **X***X**
>>>> ***X*X***
>>>> X
>>>> ***X*X***
>>>> **X***X**
>>>> *X*X*
>>>> X***X
>>>>
>>>> hope it helps :)
>>>>
>>>>
>>>> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra 
>>>> wrote:
>>>>
>>>>> akamai is visiting our campus on 03 sept can any1 tell sample question
>>>>> that they might ask thanx in advance
>>>>>
>>>>> --
>>>>> 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
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> 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
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] akamai

2011-09-02 Thread aditya kumar
Rs 100800 // this is CTC
basic pay is around 7lakhs

On Fri, Sep 2, 2011 at 1:15 PM, sukran dhawan wrote:

> how much they pay ?
>
> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> they basically ask questions on DBMS and networking.
>> In DBMS fst round mainly had SQL and 1 coding question related to ER
>> DIAGRAM .
>> in written round 3 question ws thr
>> 1)ER diagram
>> 2)stack n que
>> 3)print this pattrn for n=3
>> X***X
>> *X*X*
>> **X***X**
>> ***X*X***
>> X
>> ***X*X***
>> **X***X**
>> *X*X*
>> X***X
>>
>> hope it helps :)
>>
>>
>> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:
>>
>>> akamai is visiting our campus on 03 sept can any1 tell sample question
>>> that they might ask thanx in advance
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] akamai

2011-09-02 Thread aditya kumar
first round had two sections
1)aptitude and technical
2)coding
then follows two rounds of technical interview and one round of hr

On Fri, Sep 2, 2011 at 11:33 AM, somya mishra wrote:

> thanx man only 2 rounds were there?
>
>
> On Fri, Sep 2, 2011 at 11:24 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> they basically ask questions on DBMS and networking.
>> In DBMS fst round mainly had SQL and 1 coding question related to ER
>> DIAGRAM .
>> in written round 3 question ws thr
>> 1)ER diagram
>> 2)stack n que
>> 3)print this pattrn for n=3
>> X***X
>> *X*X*
>> **X***X**
>> ***X*X***
>> X
>> ***X*X***
>> **X***X**
>> *X*X*
>> X***X
>>
>> hope it helps :)
>>
>> On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:
>>
>>> akamai is visiting our campus on 03 sept can any1 tell sample question
>>> that they might ask thanx in advance
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Data Structure Question

2011-09-01 Thread aditya kumar
@saloni : its LIFO nt FIFO

On Fri, Sep 2, 2011 at 11:24 AM, sharmila saru wrote:

> stack bcoz push & pop in FIFO manner
>
>  --
> 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/-/MTgxHW5Jq9YJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Find the Max from each sub-array of size k

2011-09-01 Thread aditya kumar
how did u get such o/p for k=4 ?? i dint get plz expalin

On Fri, Sep 2, 2011 at 9:04 AM, Anup Ghatage  wrote:

> Given an unsorted Array A and any integer k where k <= size of A
>
> Print the maximum of each sub-array of size k of A.
>
> eg:  A = [ 3, 5, 1, 9, 0, 4, -1, 7 ]   k = 4
> Max: 9 9 9 9 7
>
> --
> Anup Ghatage
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Static variable memory location

2011-09-01 Thread aditya kumar
static variables are allocated on heap . and global variables are sored on
data segment

On Fri, Sep 2, 2011 at 9:30 AM, rahul sharma wrote:

> static variable is stored in data segement so it is alive thorugh the
> proggo through let us c : data types
>
>
> On Wed, Aug 31, 2011 at 10:16 PM, Swathi  wrote:
>
>> C standard doens't fine where it has to be stored.. go through this URL
>>
>> http://www.velocityreviews.com/forums/t443436-where-is-a-static-variable-stored.html
>>
>>
>>
>> On Wed, Aug 31, 2011 at 9:57 PM, rohit  wrote:
>>
>>> Where does a static variable get allocated in memory..?
>>> Like automatic variables get stack, objects allocated through
>>> malloc/calloc get memory from heap...wt abt static variable?
>>>
>>> --
>>> 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/-/5Wj2C8yF74QJ.
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] akamai

2011-09-01 Thread aditya kumar
they basically ask questions on DBMS and networking.
In DBMS fst round mainly had SQL and 1 coding question related to ER DIAGRAM
.
in written round 3 question ws thr
1)ER diagram
2)stack n que
3)print this pattrn for n=3
X***X
*X*X*
**X***X**
***X*X***
X
***X*X***
**X***X**
*X*X*
X***X

hope it helps :)

On Thu, Sep 1, 2011 at 10:09 PM, somya mishra wrote:

> akamai is visiting our campus on 03 sept can any1 tell sample question that
> they might ask thanx in advance
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Data Structure Question

2011-09-01 Thread aditya kumar
stack coz of the lifo nature . i guess so

On Fri, Sep 2, 2011 at 11:08 AM, Mani Bharathi wrote:

> @kb2029: how? why?
>
>  --
> 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/-/UKMOdCLe0sUJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Static variable

2011-08-31 Thread aditya kumar
but one u have pushed all elements on to the stack why do we again enetr the
loop to decreement the value of i . i mean after all the recursion we need
to return to the place from where funtion was being called . why to enter
the loop again ??

On Wed, Aug 31, 2011 at 8:26 PM, rahul sharma wrote:

> no it will pus like
> printf("d",i)
> 
> .
> .
> .
> ..
> so onm
>
>
> but i is static
> latest value used
> 9
> 8
> 7
> instred of these printf are pushed
>
> On Aug 31, 7:53 pm, aditya kumar  wrote:
> > @rahul : wen the values are pushed on to the stack they are like 9 , 8 ,
> 7 ,
> > till 0 so when they pop out shouldnt it be follwing the order 0 1 2 till
> 9 .
> > i realy dont know why the o/p is 0 -1 -2 and so on ??
> >
> > On Wed, Aug 31, 2011 at 8:18 PM, rahul sharma  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > i thnink it works as follow:-
> >
> > > firstly
> > > loop goes pushing into stack
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> > > printf("%d",i);
> >
> > > now i is 1
> > > --i
> > > means --1
> > > i=0;
> >
> > > now all printf are poped printing --i
> > > from 0;
> >
> > > m i ryt?
> >
> > > On Aug 31, 7:40 pm, rahul sharma  wrote:
> > > > these two are same
> >
> > > > On Aug 31, 7:36 pm, ravi maggon  wrote:
> >
> > > > > I check out the code:
> >
> > > > > #include
> > > > > main()
> > > > > {
> > > > > static int i=10;
> > > > > while(i>0)
> > > > > {
> > > > > --i;
> > > > > main();
> > > > > printf("%d",i);
> > > > > }
> >
> > > > > }
> >
> > > > > if you run this you get 00 as output
> >
> > > > > but if you run this
> >
> > > > > #include
> > > > > main()
> > > > > {
> > > > > static int i=10;
> > > > > while(i>0)
> > > > > {
> > > > > --i;
> > > > > main();
> > > > > printf("%d",i);
> > > > > }
> >
> > > > > }
> >
> > > > > You get 0-1-2-3-4-5-6-7-8 as output.
> >
> > > > > Whats the difference in these?
> >
> > > > > On Wed, Aug 31, 2011 at 7:52 PM, aditi garg <
> aditi.garg.6...@gmail.com
> > > >wrote:
> >
> > > > > > @abhishek: y till -8?
> >
> > > > > > On Wed, Aug 31, 2011 at 7:50 PM, vishal jain <
> vishal.l...@gmail.com
> > > >wrote:
> >
> > > > > >> I executed on linux machine..
> >
> > > > > >> I am gettign output
> >
> > > > > >> 0-1-2-3-4-5-6-7-8 :(
> >
> > > > > >> for code
> > > > > >> int main()
> >
> > > > > >> {
> > > > > >> static int i=10;
> > > > > >> while(--i>0)
> > > > > >> {
> > > > > >>  main();
> > > > > >>  printf("%d",i);
> > > > > >> }
> > > > > >> return 0;
> > > > > >> }
> >
> > > > > >> On Wed, Aug 31, 2011 at 7:48 PM, Abhishek Mallick <
> > > > > >> abhishek.mallick2...@gmail.com> wrote:
> >
> > > > > >>> The recursion will run 10 times printing nothing. Then ones it
> > > returns
> > > > > >>> on the 10th one. It will start printing from 0 to -8 (As i is
> > > static).
> >
> > > > > >>> On Aug 31, 6:33 pm, ravi maggon  wrote:
> > > > > >>> > Ans would be 00, keep in mind that i is static
> variable.
> >
> > > > > >>>  > On Wed, Aug 31, 2011 at 6:59 PM, rohit <
> raman.u...@gmail.com>
> > > wrote:
> > > > > >>> > > 123456789
> >
> > > 

Re: [algogeeks] Re: Static variable

2011-08-31 Thread aditya kumar
@rahul : wen the values are pushed on to the stack they are like 9 , 8 , 7 ,
till 0 so when they pop out shouldnt it be follwing the order 0 1 2 till 9 .
i realy dont know why the o/p is 0 -1 -2 and so on ??

On Wed, Aug 31, 2011 at 8:18 PM, rahul sharma wrote:

> i thnink it works as follow:-
>
>
> firstly
> loop goes pushing into stack
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
> printf("%d",i);
>
> now i is 1
> --i
> means --1
> i=0;
>
> now all printf are poped printing --i
> from 0;
>
> m i ryt?
>
>
>
> On Aug 31, 7:40 pm, rahul sharma  wrote:
> > these two are same
> >
> > On Aug 31, 7:36 pm, ravi maggon  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I check out the code:
> >
> > > #include
> > > main()
> > > {
> > > static int i=10;
> > > while(i>0)
> > > {
> > > --i;
> > > main();
> > > printf("%d",i);
> > > }
> >
> > > }
> >
> > > if you run this you get 00 as output
> >
> > > but if you run this
> >
> > > #include
> > > main()
> > > {
> > > static int i=10;
> > > while(i>0)
> > > {
> > > --i;
> > > main();
> > > printf("%d",i);
> > > }
> >
> > > }
> >
> > > You get 0-1-2-3-4-5-6-7-8 as output.
> >
> > > Whats the difference in these?
> >
> > > On Wed, Aug 31, 2011 at 7:52 PM, aditi garg  >wrote:
> >
> > > > @abhishek: y till -8?
> >
> > > > On Wed, Aug 31, 2011 at 7:50 PM, vishal jain  >wrote:
> >
> > > >> I executed on linux machine..
> >
> > > >> I am gettign output
> >
> > > >> 0-1-2-3-4-5-6-7-8 :(
> >
> > > >> for code
> > > >> int main()
> >
> > > >> {
> > > >> static int i=10;
> > > >> while(--i>0)
> > > >> {
> > > >>  main();
> > > >>  printf("%d",i);
> > > >> }
> > > >> return 0;
> > > >> }
> >
> > > >> On Wed, Aug 31, 2011 at 7:48 PM, Abhishek Mallick <
> > > >> abhishek.mallick2...@gmail.com> wrote:
> >
> > > >>> The recursion will run 10 times printing nothing. Then ones it
> returns
> > > >>> on the 10th one. It will start printing from 0 to -8 (As i is
> static).
> >
> > > >>> On Aug 31, 6:33 pm, ravi maggon  wrote:
> > > >>> > Ans would be 00, keep in mind that i is static variable.
> >
> > > >>>  > On Wed, Aug 31, 2011 at 6:59 PM, rohit 
> wrote:
> > > >>> > > 123456789
> >
> > > >>> > > --
> > > >>> > > 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/-/OsL6-Vp91qoJ.
> > > >>> > > 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
> > > >>> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > > >>> > --
> >
> > > >>> > Regards
> > > >>> > Ravi Maggon
> > > >>> > Final Year, B.E. CSE
> > > >>> > Thapar University
> >
> > > >>> --
> > > >>> 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
> > > >>>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > >>  --
> > > >> 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
> > > >>http://groups.google.com/group/algogeeks?hl=en.
> >
> > > > --
> > > > Aditi Garg
> > > > Undergraduate Student
> > > > Electronics & Communication Divison
> > > > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> > > > Sector 3, Dwarka
> > > > New Delhi
> >
> > > >  --
> > > > 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
> > > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > > --
> >
> > > Regards
> > > Ravi Maggon
> > > Final Year, B.E. CSE
> > > Thapar University
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
Yo

Re: [algogeeks] Amazon - Coding Round-2 Qn

2011-08-31 Thread aditya kumar
@rohit : else return (check(tree->left) || check(tree->right)); should be else
return (check(tree->left) && check(tree->right));
 we need both the left and the right to be true .
On Wed, Aug 31, 2011 at 4:18 PM, rohit  wrote:

> Q1.
>
> NODE* head //points to the bst(if it exists)
>
> void exist_bst(NODE *tree)
> {
> if(tree != NULL)
> {
> if(tree->left->info < tree->info  && tree->right->info >= tree->info)
> {
>if(check(tree))
>head = tree;
> }
> else
> {
>  exist_bst(tree->left);
>  exist_bst(tree->right);
> }
> }
> }
>
> int check(NODE *root)
> {
> if(root->left == NULL && root->right == NULL)
> return TRUE;
>
> if(tree->left->info >= tree->info  || tree->right->info < tree->info)
> return FALSE;
>
> else return (check(tree->left) || check(tree->right));
>
> }
>
> I havn't run this on system and this code is subject to more optimisation.
> This was just to give you a fair idea
>
> --
> 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/-/0YV_4hilHhkJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Find square root a number

2011-08-30 Thread aditya kumar
let u have to find the square root of s .
a=sqrt(s) ;
a^2=s ;
2(a^a)=s+a^2 ;
a=(s+a^2)/2a ;

after 20th iteration you will get more approximated value .
hopefully it will help .:)

On Tue, Aug 30, 2011 at 9:14 PM, teja bala wrote:

> @aditya kumar
> Will u plz explain the logic involved here...?
>
> On Tue, Aug 30, 2011 at 7:40 PM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> void getSquareRoot(float s)
>>  {
>>   float a=s;
>>   int i=0;
>>   for(i=0;i<20;i++)
>>   {
>>   a=(s+a*a)/(2*a);
>>  }
>> printf("square root is %f",a);
>>  }
>>
>> On Tue, Aug 30, 2011 at 6:00 PM, Sanjay Rajpal  wrote:
>>
>>> Binary Search kind of mathod is useful here :
>>>
>>> float SquareRoot(float n,float start,float end)
>>> {
>>> float s=(start+end)/2;
>>> if(n - sqr(s) < 0.001) && (n - sqr(s) > -0.001))
>>>return (end+start)/2;
>>> else if(sqr(s) > n)
>>>return SquareRoot(n,0.0,s);
>>> else
>>>return SquareRoot(n,s,end);
>>> }
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Tue, Aug 30, 2011 at 3:25 AM, UTKARSH SRIVASTAV <
>>> usrivastav...@gmail.com> wrote:
>>>
>>>> i don't whethe you have studied a subject cbnst from that use newton
>>>> raphson method
>>>>
>>>>
>>>> On Tue, Aug 30, 2011 at 2:39 AM, Ankuj Gupta wrote:
>>>>
>>>>> U can use binary search method
>>>>>
>>>>> On Aug 30, 1:56 pm, Rajeev Kumar  wrote:
>>>>> > use Babylonian method(Efficient) algrithm..
>>>>> > Refer :
>>>>> http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylo.
>>>>> ..
>>>>> >
>>>>> > public *void* getSquareRoot(double s) {
>>>>> >   double Xn = 2.0;
>>>>> >   double lastXn = 0.0;
>>>>> >   while (Xn != lastXn) {
>>>>> >lastXn = Xn;
>>>>> >Xn = (Xn + s / Xn) / 2.0;
>>>>> >   }
>>>>> >   return Xn;
>>>>> >  }
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Tue, Aug 30, 2011 at 1:49 PM, Ankur Garg 
>>>>> wrote:
>>>>> > > @techcoder
>>>>> >
>>>>> > > Making an array of 32768 or INT_MAX will make ur compiler cry
>>>>> >
>>>>> > > Also ur case doesnt handle the scenario where square root is a
>>>>> decimal
>>>>> > > number
>>>>> >
>>>>> > > On Tue, Aug 30, 2011 at 1:35 PM, tech coder <
>>>>> techcoderonw...@gmail.com>wrote:
>>>>> >
>>>>> > >> the sqrt of 32 bit number can't be more than 16 bits.
>>>>> >
>>>>> > >> have an array of 2^16 elemnts wtih elemts 1 2 3 4 5  32768 .
>>>>> >
>>>>> > >> now apply binary search
>>>>> > >> i=a[mid]where mid=(lower+upper)/2
>>>>> >
>>>>> > >> if(i*i==num)
>>>>> > >> i is the sqrt
>>>>> >
>>>>> > >> increment lower and upper accordingly as we do in binary search
>>>>> >
>>>>> > >> so order is Olognwhere n=2^16
>>>>> >
>>>>>  > >> On Tue, Aug 30, 2011 at 11:37 AM, Raghavan 
>>>>> wrote:
>>>>> >
>>>>> > >>> how to design this logic effectively?
>>>>> >
>>>>> > >>> double squareRoot(int num){
>>>>> >
>>>>> > >>> }
>>>>> >
>>>>> > >>> --
>>>>> > >>> Thanks and Regards,
>>>>> > >>> Raghavan KL
>>>>> >
>>>>> > >>>  --
>>>>> > >>> 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.

Re: [algogeeks] Re: Find square root a number

2011-08-30 Thread aditya kumar
void getSquareRoot(float s)
 {
  float a=s;
  int i=0;
  for(i=0;i<20;i++)
  {
  a=(s+a*a)/(2*a);
}
printf("square root is %f",a);
 }

On Tue, Aug 30, 2011 at 6:00 PM, Sanjay Rajpal  wrote:

> Binary Search kind of mathod is useful here :
>
> float SquareRoot(float n,float start,float end)
> {
> float s=(start+end)/2;
> if(n - sqr(s) < 0.001) && (n - sqr(s) > -0.001))
>return (end+start)/2;
> else if(sqr(s) > n)
>return SquareRoot(n,0.0,s);
> else
>return SquareRoot(n,s,end);
> }
>
> Sanju
> :)
>
>
>
> On Tue, Aug 30, 2011 at 3:25 AM, UTKARSH SRIVASTAV <
> usrivastav...@gmail.com> wrote:
>
>> i don't whethe you have studied a subject cbnst from that use newton
>> raphson method
>>
>>
>> On Tue, Aug 30, 2011 at 2:39 AM, Ankuj Gupta  wrote:
>>
>>> U can use binary search method
>>>
>>> On Aug 30, 1:56 pm, Rajeev Kumar  wrote:
>>> > use Babylonian method(Efficient) algrithm..
>>> > Refer :
>>> http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylo...
>>> >
>>> > public *void* getSquareRoot(double s) {
>>> >   double Xn = 2.0;
>>> >   double lastXn = 0.0;
>>> >   while (Xn != lastXn) {
>>> >lastXn = Xn;
>>> >Xn = (Xn + s / Xn) / 2.0;
>>> >   }
>>> >   return Xn;
>>> >  }
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Tue, Aug 30, 2011 at 1:49 PM, Ankur Garg 
>>> wrote:
>>> > > @techcoder
>>> >
>>> > > Making an array of 32768 or INT_MAX will make ur compiler cry
>>> >
>>> > > Also ur case doesnt handle the scenario where square root is a
>>> decimal
>>> > > number
>>> >
>>> > > On Tue, Aug 30, 2011 at 1:35 PM, tech coder <
>>> techcoderonw...@gmail.com>wrote:
>>> >
>>> > >> the sqrt of 32 bit number can't be more than 16 bits.
>>> >
>>> > >> have an array of 2^16 elemnts wtih elemts 1 2 3 4 5  32768 .
>>> >
>>> > >> now apply binary search
>>> > >> i=a[mid]where mid=(lower+upper)/2
>>> >
>>> > >> if(i*i==num)
>>> > >> i is the sqrt
>>> >
>>> > >> increment lower and upper accordingly as we do in binary search
>>> >
>>> > >> so order is Olognwhere n=2^16
>>> >
>>>  > >> On Tue, Aug 30, 2011 at 11:37 AM, Raghavan 
>>> wrote:
>>> >
>>> > >>> how to design this logic effectively?
>>> >
>>> > >>> double squareRoot(int num){
>>> >
>>> > >>> }
>>> >
>>> > >>> --
>>> > >>> Thanks and Regards,
>>> > >>> Raghavan KL
>>> >
>>> > >>>  --
>>> > >>> 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
>>> > >>>http://groups.google.com/group/algogeeks?hl=en.
>>> >
>>> > >>  --
>>> > >> 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
>>> > >>http://groups.google.com/group/algogeeks?hl=en.
>>> >
>>> > >  --
>>> > > 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
>>> > >http://groups.google.com/group/algogeeks?hl=en.
>>> >
>>> > --
>>> > Thank You
>>> > Rajeev Kumar
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> *UTKARSH SRIVASTAV
>> CSE-3
>> B-Tech 3rd Year
>> @MNNIT ALLAHABAD*
>>
>> --
>>  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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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.

[algogeeks] Is This algorithm gives right answer ?? // algo to find max subarray ie whose sum is max

2011-08-29 Thread aditya kumar
Kadane's Algorithm(array[1..n])
begin
(maxSum, maxStartIndex, maxEndIndex) := (-INFINITY, 0, 0)
currentMaxSum := 0
currentStartIndex := 1
for currentEndIndex := 1 to n do
currentMaxSum := currentMaxSum + array[currentEndIndex]
if currentMaxSum > maxSum then
(maxSum, maxStartIndex, maxEndIndex) := (currentMaxSum,
currentStartIndex, currentEndIndex)
endif

if currentMaxSum < 0 then
currentMaxSum := 0
currentStartIndex := currentEndIndex + 1
endif
endfor

return (maxSum, maxStartIndex, maxEndIndex)
end

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: c program

2011-08-28 Thread aditya kumar
yes i agree since in the question they dint mention so we can solve it the
other way also .

On Sun, Aug 28, 2011 at 7:31 PM, saurabh singh  wrote:

> Well if you go on using system calls functions etc the job can easily be
> done in many ways but the real idea behind the quine problem is the good old
> spirit of a challenge (not merely for an interview) So the best way remains
> the store everything way...
>
> On Sun, Aug 28, 2011 at 3:11 PM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> one more method : use system funtion .
>> eg system("cat filename") //system funtion executes the command
>>
>>
>> On Sun, Aug 28, 2011 at 1:51 PM, UTKARSH SRIVASTAV <
>> usrivastav...@gmail.com> wrote:
>>
>>> good logic
>>>
>>>
>>> On Sun, Aug 28, 2011 at 12:14 AM, Piyush Grover <
>>> piyush4u.iit...@gmail.com> wrote:
>>>
>>>> yeah you can do that by opening the file and printing it but as far as I
>>>> know, interviewer adds the constraint of not using the file method.
>>>>
>>>>
>>>> On Sun, Aug 28, 2011 at 12:35 PM, rahul sharma >>> > wrote:
>>>>
>>>>> this logic is ok...but we have pre defined everything in char f...if i
>>>>> add one or two more statements then it will require corresponding
>>>>> change in char *f...can i open the same file with f open n prin t it
>>>>> out?
>>>>>
>>>>> On Aug 28, 11:31 am, Piyush Grover  wrote:
>>>>> > char*f="char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c";
>>>>> >
>>>>> > f is a global pointer to the char array which contains the string
>>>>> > "char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c"
>>>>> >
>>>>> > Now in main function you are printing this string with arguments
>>>>> 34,f,34,10.
>>>>> > ASCII value of " is 34.
>>>>> > ->So in f, the first %c is replaced by ".
>>>>> > ->The next %s is replaced by string f.
>>>>> > ->the second %c is replaced by " and
>>>>> > ->last %c is replaced by backspace. The last %c is actually I feel
>>>>> not
>>>>> > required. So the code can be:
>>>>> >
>>>>> >
>>>>> char*f="char*f=%c%s%c;main(){printf(f,34,f,34);}";main(){printf(f,34,f,34);
>>>>> }
>>>>> >
>>>>> > I hope it helps. Try to do it manually on paper. You would be able to
>>>>> > understand it.
>>>>> >
>>>>> > -Piyush
>>>>> >
>>>>> > On Sun, Aug 28, 2011 at 11:46 AM, rahul sharma <
>>>>> rahul23111...@gmail.com>wrote:
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > > plz expalin char*f=""
>>>>> >
>>>>> > > On Aug 28, 11:12 am, Piyush Grover 
>>>>> wrote:
>>>>> > > > it's a quine problem.
>>>>> >
>>>>> > > > char*f="char*f=%c%s%c;
>>>>> > > > main(){
>>>>> > > > printf(f,34,f,34,10);}%c";
>>>>> >
>>>>> > > > main()
>>>>> > > > {
>>>>> > > > printf(f,34,f,34,10);
>>>>> >
>>>>> > > > }
>>>>> >
>>>>> > > > I have used whitespaces to make it understand.
>>>>> >
>>>>> > > > On Sun, Aug 28, 2011 at 11:39 AM, rahul sharma <
>>>>> rahul23111...@gmail.com
>>>>> > > >wrote:
>>>>> >
>>>>> > > > > program whose output is the program itself???
>>>>> >
>>>>> > > > > --
>>>>> > > > > 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 program

2011-08-28 Thread aditya kumar
one more method : use system funtion .
eg system("cat filename") //system funtion executes the command

On Sun, Aug 28, 2011 at 1:51 PM, UTKARSH SRIVASTAV
wrote:

> good logic
>
>
> On Sun, Aug 28, 2011 at 12:14 AM, Piyush Grover  > wrote:
>
>> yeah you can do that by opening the file and printing it but as far as I
>> know, interviewer adds the constraint of not using the file method.
>>
>>
>> On Sun, Aug 28, 2011 at 12:35 PM, rahul sharma 
>> wrote:
>>
>>> this logic is ok...but we have pre defined everything in char f...if i
>>> add one or two more statements then it will require corresponding
>>> change in char *f...can i open the same file with f open n prin t it
>>> out?
>>>
>>> On Aug 28, 11:31 am, Piyush Grover  wrote:
>>> > char*f="char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c";
>>> >
>>> > f is a global pointer to the char array which contains the string
>>> > "char*f=%c%s%c;main(){printf(f,34,f,34,10);}%c"
>>> >
>>> > Now in main function you are printing this string with arguments
>>> 34,f,34,10.
>>> > ASCII value of " is 34.
>>> > ->So in f, the first %c is replaced by ".
>>> > ->The next %s is replaced by string f.
>>> > ->the second %c is replaced by " and
>>> > ->last %c is replaced by backspace. The last %c is actually I feel not
>>> > required. So the code can be:
>>> >
>>> >
>>> char*f="char*f=%c%s%c;main(){printf(f,34,f,34);}";main(){printf(f,34,f,34);
>>> }
>>> >
>>> > I hope it helps. Try to do it manually on paper. You would be able to
>>> > understand it.
>>> >
>>> > -Piyush
>>> >
>>> > On Sun, Aug 28, 2011 at 11:46 AM, rahul sharma <
>>> rahul23111...@gmail.com>wrote:
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > > plz expalin char*f=""
>>> >
>>> > > On Aug 28, 11:12 am, Piyush Grover 
>>> wrote:
>>> > > > it's a quine problem.
>>> >
>>> > > > char*f="char*f=%c%s%c;
>>> > > > main(){
>>> > > > printf(f,34,f,34,10);}%c";
>>> >
>>> > > > main()
>>> > > > {
>>> > > > printf(f,34,f,34,10);
>>> >
>>> > > > }
>>> >
>>> > > > I have used whitespaces to make it understand.
>>> >
>>> > > > On Sun, Aug 28, 2011 at 11:39 AM, rahul sharma <
>>> rahul23111...@gmail.com
>>> > > >wrote:
>>> >
>>> > > > > program whose output is the program itself???
>>> >
>>> > > > > --
>>> > > > > 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
>>> > > > >http://groups.google.com/group/algogeeks?hl=en.
>>> >
>>> > > --
>>> > > 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
>>> > >http://groups.google.com/group/algogeeks?hl=en.
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *UTKARSH SRIVASTAV
> CSE-3
> B-Tech 3rd Year
> @MNNIT ALLAHABAD*
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: microsoft

2011-08-27 Thread aditya kumar
My friend has shared his experience in this doc . He got selected .
hope it will help u guys as well !!

On Sat, Aug 27, 2011 at 12:12 PM, siva viknesh wrote:

> hi search this group..  u ll get lot of interview ques recently
> attended for ms
>
> On Aug 27, 10:58 am, rahul sharma  wrote:
> > i joined this group yesterday...dATS y i posted..after psoting i
> > search for this but i got only questions n not the process...
> > thnx moiz 4 ur unfo.
> >
> > On Aug 27, 9:40 am, raj kumar  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > please search for an older post for the topic before posting anything
> > > there's already a post on this topis
> >
> > > thanks
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



MS.docx
Description: application/vnd.openxmlformats-officedocument.wordprocessingml.document


Re: [algogeeks] reverse

2011-08-24 Thread aditya kumar
does anyone know the correct solution this problem ??
problem : i/p :: 39
o/p:: 93 (using bitwise operator)

On Fri, Aug 12, 2011 at 1:41 PM, Prakash D  wrote:

> how does the above code work?
>
>
> On Fri, Aug 12, 2011 at 1:14 PM, Rahul  wrote:
>
>> I understand. where I find some more tricks like these , I mean I
>> really. find. bit thinking hacks. difficult to understand.
>>
>>
>> On 8/12/11, Tarun Arya  wrote:
>> > RAHUL@
>> > d question was to reverse d 2 numbers...it can b done by wat i hav
>> said...
>> > if u want 2 extract numbers then
>> > a&0x0f   //this wil giv number in units place...
>> > a&0xf0   a>>4//this wil give number in tens place
>> >
>> > correct me if i m wrong
>> > Tarun
>> >
>> > --
>> > 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
>> > http://groups.google.com/group/algogeeks?hl=en.
>> >
>> >
>>
>>
>> --
>> Rahul
>>
>> --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Multiprocessor scheduling

2011-08-23 Thread aditya kumar
what are the arrival time ??

On Tue, Aug 23, 2011 at 8:19 PM, saurabh singh  wrote:

> Given m jobs and p processors find the *most optimal scheduling.*
> Is this problem NP complete like subset problem?
> I am trying on a greedy solution but most of them are failing
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)

2011-08-22 Thread aditya kumar
(x(x(b+x(c+dx

On Tue, Aug 23, 2011 at 10:21 AM, saurabh agrawal wrote:

> Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] AMAZON

2011-08-21 Thread aditya kumar
thnks all . yeah sure will post the questions :)

On Sat, Aug 20, 2011 at 4:29 PM, Akash Mukherjee  wrote:

> @aditya - basic os & networking, ds - esp trees(esp bsts) & algo
>
> if needed, refer cracking the coding interview. do post the questions asked
> once its over :)
>
> On Sat, Aug 20, 2011 at 4:25 PM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> PESIT
>>
>>
>> On Sat, Aug 20, 2011 at 4:23 PM, Sanjay Rajpal  wrote:
>>
>>> which college ?
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Amazon question

2011-08-20 Thread aditya kumar
instead of that find sum of first n natural number sum ie (n(n+1))/2.;say
NSum
then find the sum of all elements of the array . say ASum
ASUm - NSum = result (no repeated twice).

On Fri, Aug 19, 2011 at 7:30 PM, Sanjay Rajpal wrote:

> :)
>
>
> *Regards
>
> Sanju
>
> Happy to Help :)*
>
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] AMAZON

2011-08-20 Thread aditya kumar
PESIT

On Sat, Aug 20, 2011 at 4:23 PM, Sanjay Rajpal  wrote:

> which college ?
>
>
> Sanju
> :)
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] AMAZON

2011-08-20 Thread aditya kumar
heyy which subjects need to be studied more for AMAZON .?? AMAZON visiting
our campus 22nd aug .

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Question from Google interview

2011-08-18 Thread aditya kumar
not sure abt the algo but we can think in terms of tokeninzing . ie go for
greedy method . greedy looks for maximum match . extract the token and match
with the dictionary word . if match found then add the additional space else
look for next token .
On Thu, Aug 18, 2011 at 9:10 PM, Navneet Gupta wrote:

> Given a string containing multiple words such that spaces between words is
> missing. Also, you have a dictionary containing valid words.
>
> Ex. "Thatwouldbefantastic"
>
> Output a string with proper spaces inserted.
>
> Output - "That would be fantastic"
>
> The case of words like bandwidth present can be discounted.
>
> --
> Regards,
> Navneet
>
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: calculate a/b without using ‘*’, ‘/’’ and ‘%’

2011-08-18 Thread aditya kumar
how abt subtracting . like a=a-b till a becomes zero . no of times
subtraction is done is the answer .
correct me if i am wrong !

On Thu, Aug 18, 2011 at 8:59 PM, Dave  wrote:

> @Radha: You could simulate long division. It would look something like
> this:
>
> int divide(int a, int b)
> {
>int i, k=0, q=0, s=1;
> // error checking
>if( b == 0 ) return 0 // return 0 for division by zero
> // handle signs
>if( a < 0 )
>{
>a = -a;
>s = -1;
>}
>if( b < 0 )
>{
>b = -b;
>s = -s;
>}
> // quick cases
>if( a < b )
>return 0;
>if( a == b )
>return s;
> // shift divisor to align with dividend
>while( b < a )
>{
>b <<= 1;
>++k;
>}
> // perform k steps of long division in binary
>for( i = 0 ; i < k ; ++i )
>{
>q <<= 1;
>b >>= 1;
>if( a > b )
>{
>a -= b;
>q |= 1;
>}
>}
> // apply sign to result
>if( s < 0 )
>q = -q;
>
>return q;
> }
>
> Dave
>
> On Aug 18, 8:56 am, radha krishnan 
> wrote:
> > how to do using BIT manipulation ?
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] apti! solve this!

2011-08-17 Thread aditya kumar
answer has to be sqrt(146) . 13 cant be the answer

On Wed, Aug 17, 2011 at 7:55 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> the answer is given as 13... even i got root(146)
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: matrix question ???!!!!!!!!!!??????????

2011-08-17 Thread aditya kumar
@dave : +1
On Wed, Aug 17, 2011 at 4:05 PM, Dave  wrote:

> @Anika: You don't have to find the max and min elements of the entire
> array to find a row that doesn't contain either of them. If you scan 3
> rows, you will find a row that contains the max of those three rows,
> another that contains the min, and the remaining row will contain
> neither. Scanning the rest of the array would serve only to increase
> the maximum and decrease the minimum, but it wouldn't alter the fact
> that that remaining row doesn't contain either. Thus, we don't need to
> scan the rest of the matrix.
>
> Dave
>
> On Aug 16, 11:23 pm, Anika Jain  wrote:
> > i didnt get it tht even if there are distinct elements how scanning sum
> > three lines return us the max n min elements? how will this scan whole
> > matrix for finding the max n  min elements???
> >
> > On Wed, Aug 17, 2011 at 1:32 AM, priya ramesh <
> >
> >
> >
> > love.for.programm...@gmail.com> wrote:
> > > are these algos optimal???
> > > *Algo 1*:
> >
> > > no_min_max   =-1
> > > min_row=   max_row=   -1
> > > for(i=0; i > > {
> > >for(j=0; j > >  find min, max
> > >  }
> > >if(min prev_max){
> > >   no_min_max=i;
> > >   break;
> > > }
> > >   else if(min < prev_min){
> > >min_row=i;
> > >}
> > >  else if(max>prev_max){
> > > max_row=i;
> > >   }
> > > }
> > > if(no_min_max!=-1){
> > > i=0;
> > > while(i!=min_row && i!=max_row)
> > > i++;
> > > no_min_max=i;
> > > }
> >
> > > print no_min_max row;
> >
> > > *Algo 2:*
> >
> > > 1. Copy elements into a linear array
> >
> > > 2. Find min and max. O(n)
> >
> > > 3. for(i=0; i >
> > > serach for min, max in the ith row; O(n)
> > > if (both not found)
> > > break;
> > > }
> >
> > > print the ith row;
> >
> > > Which 1 is better???
> >
> > > --
> > > 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
> > >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] De shaw ques!

2011-08-17 Thread aditya kumar
i guess if the option is provided it would have been an appropiate question
.

On Wed, Aug 17, 2011 at 6:02 PM, Rohit Srivastava wrote:

> +1 to nitin
>
>
> On Wed, Aug 17, 2011 at 6:02 PM, Romil ... wrote:
>
>> People this is not the way to approach this one. This question seems to be
>> unfair. Take the number to be 1939 which also leaves 69 as the remainder
>> when divided by 935 but when it is divided by 38, the remainder is only 1.
>> There is definitely some mistake. Also there doesn't seem to be a
>> mathematical way to solve this.
>>
>>
>> On Wed, Aug 17, 2011 at 5:58 PM, priya ramesh <
>> love.for.programm...@gmail.com> wrote:
>>
>>> i solved it the same way you solved it. Took the same exmpl too :)
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Romil
>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] De shaw ques!

2011-08-17 Thread aditya kumar
@priya . i have shown you my method . write your method and we shall discuss
it .

On Wed, Aug 17, 2011 at 5:52 PM, sukran dhawan wrote:

>
>
> On Wed, Aug 17, 2011 at 5:39 PM, priya ramesh <
> love.for.programm...@gmail.com> wrote:
>
>> if a number is divided by 935 remainder is 69. if same no. is divided by
>> 38, what will be the remainder?
>>
>> -- answer is 16.t
>>
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] probability tough one!

2011-08-17 Thread aditya kumar
no of days in a year shud be 365 or 366 ??

On Wed, Aug 17, 2011 at 5:49 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> what is the probability of having b'days of 2 persons on the same day in a
> gathering of 50 persons?
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] De shaw ques!

2011-08-17 Thread aditya kumar
let the number be 935+69 = 1004
(bcoz divide 1004%935 = 69 )
now 1004 % 38 = 16 ANS

On Wed, Aug 17, 2011 at 5:39 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> if a number is divided by 935 remainder is 69. if same no. is divided by
> 38, what will be the remainder?
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] GS apti ques!

2011-08-17 Thread aditya kumar
take four cases :
1) A success B success C failure
2) A success B failure C success
3) A failure B success C success
4) A , B , C = success

add all the four cases :)

On Wed, Aug 17, 2011 at 5:23 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> A mistake from my side as well!
> Got 78.8% :)
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] matrix question ???!!!!!!!!!!??????????

2011-08-14 Thread aditya kumar
@all: it will take O(3n)  for finding max n min and if and only if all
elements in an array are distinct .

On Mon, Aug 15, 2011 at 1:30 AM, siddharth srivastava
wrote:

>
> One approach could be:
>
> I think the min and max elements can be found in n*n*(3n/2)
> keep a flag(or array of flag--bitvector ??) for the rows in which min or
> max was found
> print all other rows for which flag is not set
>
> another n^3(confirm please) algo could be:
> sort each row individually
> compare first col for min, last col for max
> print all which do not have min or max
>
>
>
>
> On 15 August 2011 01:20, shady  wrote:
>
>> according to me it would be take 4*n time 3 iterations to choose the
>> min. and max. from 1st three rows, and n again to print the chosen one
>>
>>
>> On Mon, Aug 15, 2011 at 1:13 AM, aditi garg wrote:
>>
>>> some how im not able to get the logic...how will i be able to find max
>>> and min of the entire matrix by jst traversing 3 rows??
>>>
>>> for eg
>>>  1 2 3 4 5
>>>  8 1 3 6 9
>>> 4 6 3 2 10
>>> 9 0 5 8 12
>>> 18 2 6 7 3
>>> fr dis matrix how will u find max and min??
>>>
>>>
>>> On Mon, Aug 15, 2011 at 1:04 AM, aditya kumar <
>>> aditya.kumar130...@gmail.com> wrote:
>>>
>>>> just traverse the three rows and get the max and min out of the three
>>>> rows . print the row in which their is no max and min .
>>>>
>>>>
>>>> On Mon, Aug 15, 2011 at 1:02 AM, aditya kumar <
>>>> aditya.kumar130...@gmail.com> wrote:
>>>>
>>>>> yes
>>>>>
>>>>>
>>>>> On Mon, Aug 15, 2011 at 12:58 AM, aditi garg <
>>>>> aditi.garg.6...@gmail.com> wrote:
>>>>>
>>>>>> @shady : does O(3n) include the time required to find the max and min
>>>>>> element as well??
>>>>>>
>>>>>>
>>>>>> On Mon, Aug 15, 2011 at 12:50 AM, shady  wrote:
>>>>>>
>>>>>>> no it is 3*n only read it again
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Aug 15, 2011 at 12:45 AM, Amir Aavani >>>>>> > wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> On 08/14/2011 11:46 AM, aditya kumar wrote:
>>>>>>>>
>>>>>>>>> it can be done in O(3n). in worst case one row will have max and
>>>>>>>>> anothr row
>>>>>>>>> will have min so the third row will be your o/p to print
>>>>>>>>>
>>>>>>>> Do you mean O(n^3)?
>>>>>>>>
>>>>>>>> Consider this { O(n^2) }:
>>>>>>>>
>>>>>>>>  1- Scan the whole matrix and find minimum and maximum entries in
>>>>>>>> the matrix. Let Delta be the difference between maximum and minimum.
>>>>>>>>  2- For each row, find the minimum and maximum entries in that row.
>>>>>>>> If their difference is exactly Delta, then print that row.
>>>>>>>>
>>>>>>>>
>>>>>>>> Amir
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> On Mon, Aug 15, 2011 at 12:00 AM, Karthikeyan palani<
>>>>>>>>> karthikeyan...@gmail.com>  wrote:
>>>>>>>>>
>>>>>>>>>  sorry O(n^2) s the time complexity
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 14 August 2011 23:56, shady  wrote:
>>>>>>>>>>
>>>>>>>>>>  how can it be O(n) when there are itself n*n elements..
>>>>>>>>>>>
>>>>>>>>>>> PS : no sharing of code, else the inevitable
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Aug 14, 2011 at 11:51 PM, Karthikeyan palani<
>>>>>>>>>>> karthikeyan...@gmail.com>  wrote:
>>>>>>>>>>>
>>>>>>>>>>>  Given a n x n matrix. .number are randomly placed. .print any
>>>>>>>>>>>> one row
>>>>>>>>>>>> which doesn’t have min
>

Re: [algogeeks] matrix question ???!!!!!!!!!!??????????

2011-08-14 Thread aditya kumar
just traverse the three rows and get the max and min out of the three rows .
print the row in which their is no max and min .

On Mon, Aug 15, 2011 at 1:02 AM, aditya kumar
wrote:

> yes
>
>
> On Mon, Aug 15, 2011 at 12:58 AM, aditi garg wrote:
>
>> @shady : does O(3n) include the time required to find the max and min
>> element as well??
>>
>>
>> On Mon, Aug 15, 2011 at 12:50 AM, shady  wrote:
>>
>>> no it is 3*n only read it again
>>>
>>>
>>> On Mon, Aug 15, 2011 at 12:45 AM, Amir Aavani wrote:
>>>
>>>>
>>>> On 08/14/2011 11:46 AM, aditya kumar wrote:
>>>>
>>>>> it can be done in O(3n). in worst case one row will have max and anothr
>>>>> row
>>>>> will have min so the third row will be your o/p to print
>>>>>
>>>> Do you mean O(n^3)?
>>>>
>>>> Consider this { O(n^2) }:
>>>>
>>>>  1- Scan the whole matrix and find minimum and maximum entries in the
>>>> matrix. Let Delta be the difference between maximum and minimum.
>>>>  2- For each row, find the minimum and maximum entries in that row. If
>>>> their difference is exactly Delta, then print that row.
>>>>
>>>>
>>>> Amir
>>>>
>>>>
>>>>
>>>>> On Mon, Aug 15, 2011 at 12:00 AM, Karthikeyan palani<
>>>>> karthikeyan...@gmail.com>  wrote:
>>>>>
>>>>>  sorry O(n^2) s the time complexity
>>>>>>
>>>>>>
>>>>>> On 14 August 2011 23:56, shady  wrote:
>>>>>>
>>>>>>  how can it be O(n) when there are itself n*n elements..
>>>>>>>
>>>>>>> PS : no sharing of code, else the inevitable
>>>>>>>
>>>>>>> On Sun, Aug 14, 2011 at 11:51 PM, Karthikeyan palani<
>>>>>>> karthikeyan...@gmail.com>  wrote:
>>>>>>>
>>>>>>>  Given a n x n matrix. .number are randomly placed. .print any one
>>>>>>>> row
>>>>>>>> which doesn’t have min
>>>>>>>> and max elements. Time Complexity : 0(n)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> if anyone know the code.. pls share!!!
>>>>>>>>
>>>>>>>> --
>>>>>>>> karthikeyankkn
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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+unsubscribe@**googlegroups.com
>>>>>>>> .
>>>>>>>> For more options, visit this group at
>>>>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en>
>>>>>>>> .
>>>>>>>>
>>>>>>>>
>>>>>>>  --
>>>>>>> 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+unsubscribe@**googlegroups.com
>>>>>>> .
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en>
>>>>>>> .
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> karthikeyankkn
>>>>>>
>>>>>> --
>>>>>> 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+unsubscribe@*

Re: [algogeeks] matrix question ???!!!!!!!!!!??????????

2011-08-14 Thread aditya kumar
yes

On Mon, Aug 15, 2011 at 12:58 AM, aditi garg wrote:

> @shady : does O(3n) include the time required to find the max and min
> element as well??
>
>
> On Mon, Aug 15, 2011 at 12:50 AM, shady  wrote:
>
>> no it is 3*n only read it again
>>
>>
>> On Mon, Aug 15, 2011 at 12:45 AM, Amir Aavani wrote:
>>
>>>
>>> On 08/14/2011 11:46 AM, aditya kumar wrote:
>>>
>>>> it can be done in O(3n). in worst case one row will have max and anothr
>>>> row
>>>> will have min so the third row will be your o/p to print
>>>>
>>> Do you mean O(n^3)?
>>>
>>> Consider this { O(n^2) }:
>>>
>>>  1- Scan the whole matrix and find minimum and maximum entries in the
>>> matrix. Let Delta be the difference between maximum and minimum.
>>>  2- For each row, find the minimum and maximum entries in that row. If
>>> their difference is exactly Delta, then print that row.
>>>
>>>
>>> Amir
>>>
>>>
>>>
>>>> On Mon, Aug 15, 2011 at 12:00 AM, Karthikeyan palani<
>>>> karthikeyan...@gmail.com>  wrote:
>>>>
>>>>  sorry O(n^2) s the time complexity
>>>>>
>>>>>
>>>>> On 14 August 2011 23:56, shady  wrote:
>>>>>
>>>>>  how can it be O(n) when there are itself n*n elements..
>>>>>>
>>>>>> PS : no sharing of code, else the inevitable
>>>>>>
>>>>>> On Sun, Aug 14, 2011 at 11:51 PM, Karthikeyan palani<
>>>>>> karthikeyan...@gmail.com>  wrote:
>>>>>>
>>>>>>  Given a n x n matrix. .number are randomly placed. .print any one row
>>>>>>> which doesn’t have min
>>>>>>> and max elements. Time Complexity : 0(n)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> if anyone know the code.. pls share!!!
>>>>>>>
>>>>>>> --
>>>>>>> karthikeyankkn
>>>>>>>
>>>>>>> --
>>>>>>> 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+unsubscribe@**googlegroups.com
>>>>>>> .
>>>>>>> For more options, visit this group at
>>>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en>
>>>>>>> .
>>>>>>>
>>>>>>>
>>>>>>  --
>>>>>> 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+unsubscribe@**googlegroups.com
>>>>>> .
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en>
>>>>>> .
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> karthikeyankkn
>>>>>
>>>>> --
>>>>> 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+unsubscribe@**googlegroups.com
>>>>> .
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en>
>>>>> .
>>>>>
>>>>>
>>>>
>>> --
>>> 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+unsubscribe@**
>>> googlegroups.com .
>>> For more options, visit this group at http://groups.google.com/**
>>> group/algogeeks?hl=en <http://groups.google.com/group/algogeeks?hl=en>.
>>>
>>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New Delhi
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] array ques

2011-08-14 Thread aditya kumar
@aditi : sry i dint realise that n > log n .:P

On Mon, Aug 15, 2011 at 12:38 AM, aditi garg wrote:

> @aditya : dis is obviously correct bt here complexity will be O(n) bt we
> are asked to gv O(log n) solution
>
> On Mon, Aug 15, 2011 at 12:37 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> for(j=0;j> {
>> if(a[j]==j)
>>  return j;
>>  else
>>  continue ;
>> }
>>
>> this shud also be correct right ??
>>
>> On Mon, Aug 15, 2011 at 12:31 AM, Akash Mukherjee wrote:
>>
>>> just my 2 cents  in d binary search, replacing key with mid, ie
>>> if(a[mid] > mid)
>>> check lower half
>>> else upper half
>>>
>>> should work??
>>>
>>>
>>> On Mon, Aug 15, 2011 at 12:26 AM, aditi garg 
>>> wrote:
>>>
>>>> Given an ordered array A[1…n] with numbers in strictly increasing
>>>> order. Find a ‘j’ such that A [j]=j or -1 if no such number exist in
>>>> o (log 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 group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New Delhi
>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] array ques

2011-08-14 Thread aditya kumar
for(j=0;jwrote:

> just my 2 cents  in d binary search, replacing key with mid, ie
> if(a[mid] > mid)
> check lower half
> else upper half
>
> should work??
>
>
> On Mon, Aug 15, 2011 at 12:26 AM, aditi garg wrote:
>
>> Given an ordered array A[1…n] with numbers in strictly increasing
>> order. Find a ‘j’ such that A [j]=j or -1 if no such number exist in
>> o (log 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 group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] matrix question ???!!!!!!!!!!??????????

2011-08-14 Thread aditya kumar
it can be done in O(3n). in worst case one row will have max and anothr row
will have min so the third row will be your o/p to print

On Mon, Aug 15, 2011 at 12:00 AM, Karthikeyan palani <
karthikeyan...@gmail.com> wrote:

> sorry O(n^2) s the time complexity
>
>
> On 14 August 2011 23:56, shady  wrote:
>
>> how can it be O(n) when there are itself n*n elements..
>>
>> PS : no sharing of code, else the inevitable
>>
>> On Sun, Aug 14, 2011 at 11:51 PM, Karthikeyan palani <
>> karthikeyan...@gmail.com> wrote:
>>
>>> Given a n x n matrix. .number are randomly placed. .print any one row
>>> which doesn’t have min
>>> and max elements. Time Complexity : 0(n)
>>>
>>>
>>>
>>> if anyone know the code.. pls share!!!
>>>
>>> --
>>> karthikeyankkn
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> karthikeyankkn
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-08-14 Thread aditya kumar
the input should start with \ and end with \ . in between you can take any
string .

On Sun, Aug 14, 2011 at 6:35 PM, Poised~  wrote:

> small correction in my above explanation
>
> the %[^\"] will accept the input till it doesn't encounter a "
> Missed the ^ (XOR) operation completely.
>
>  --
> 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/-/Tn6jNNCGeWoJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: TREE question

2011-08-13 Thread aditya kumar
void find(struct node * tree,struct node *subtree)
{

if((tree==NULL )||(subtree==NULL))
return ;


else
{
printf("the data being compared are tree:%d subtree:%d
\n",tree->data,subtree->data);

if((tree->data)==(subtree->data))
{
flag=1;
find(tree->left,subtree->left);
find(tree->right,subtree->right);
}
else
{
flag=0;
find(tree->left,subtree);
find(tree->right,subtree);
}
}
}
// flag is a global variable to check wehtr ts a subtree or not

On Sat, Aug 13, 2011 at 10:08 PM, Yasir  wrote:

> 
>
> ...
>
> if(something)
>   return true;
> else
>  return false;
> .
> // few statements here
>
> .
>
>
> Will few statements ever execute??
>
> --
> 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/-/zTXTyMwcDGAJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Problems on Linked List

2011-08-12 Thread aditya kumar
@mohit : +1

On Sat, Aug 13, 2011 at 9:20 AM, Raghavan  wrote:

> First question:
>
>- .Read the data from the first list and put it in a stack
>- Traverse the next list and compare by reading elements from the stack
>- This would solve it
>
>
> Second question:
>
>- Take an list like 1->2->-3->4
>- If you are given with 2, juz copy the value and reference of next
>node(i.e : 3) into 2 and delete the node 3 this would solve it
>
> Thanks.
>
>
> On Thu, Aug 11, 2011 at 10:21 AM, Abhishek gupta <
> mailatabhishekgu...@gmail.com> wrote:
>
>> Q2). i think for second question it will be enough to just swap the data
>> of current node to next node,
>> and delete the next node.
>> it will be like,
>> //for swap
>> int temp=current->data;
>> current->data=current->next->data;
>> current->next->data=temp;
>>
>> //for delete
>> struct node *temp;
>> temp=current->next;
>> current->next=current->next->next;
>> free(temp);
>>
>> i think it will be enough even in case of last node.
>> correct me if i am wrong.
>>
>>  --
>> 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/-/N1elA8-W-iUJ.
>>
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks and regards,
> Raghavan.K.L
> 
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] cisco

2011-08-12 Thread aditya kumar
is CISCO cuming fr recruitment ?? they are in huge loss and they have sacked
around 1 employees .

On Fri, Aug 12, 2011 at 7:18 PM, sukran dhawan wrote:

> can anybody tell abt the interview process in cisco ?
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-08-11 Thread aditya kumar
 printf("%d",((int)((int *)0  +  1))*8);
 o/p :: 32/64

On Thu, Aug 11, 2011 at 5:14 PM, sukran dhawan wrote:

> thanks
>
>
> On Thu, Aug 11, 2011 at 5:02 PM, Aditya Virmani 
> wrote:
>
>> u can never find tht thru ur prgm...sizeof int is compiler dependant
>> whether its 32/64 bit...
>>
>> On Thu, Aug 11, 2011 at 4:35 PM, sukran dhawan wrote:
>>
>>> how to determine whether the machine is a 32 bit or 64 bit using a c
>>> program?
>>> is it by sizeof(int) * 4?
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problems on Linked List

2011-08-10 Thread aditya kumar
1)for the fst one you dont have to reverse the linked list just traverse the
linked list recursively and read it from back .
  correct me if m wrong !

On Thu, Aug 11, 2011 at 12:41 AM, Piyush Kapoor  wrote:

> thanks all
>
>
> On Thu, Aug 11, 2011 at 12:21 AM, siddharam suresh <
> siddharam@gmail.com> wrote:
>
>> 1)similar to list palindrome problem(soln already there in net)
>> 2)it has discussed 2 day before on same group. please search once
>>
>> Thank you,
>> Siddharam
>>
>>
>> On Thu, Aug 11, 2011 at 12:01 AM, Piyush Kapoor wrote:
>>
>>> @naveen
>>> for the first one,how will u traverse the list backwards..
>>> I didnt understand  your second solution,since the head is not given so
>>> how can u go from a node to the node to be deleted..
>>>
>>>
>>> I forgot that in the first one,we are not allowed to use extra memory.
>>> Also do please mention the time complexity of your solutions..
>>>
>>> On Wed, Aug 10, 2011 at 11:54 PM, Naveen Kumar <
>>> naveenkumarve...@gmail.com> wrote:
>>>
 for first reverse one of the link list by changing the pointer and
 than traverse one from backward and compare it the the other.

 for second. keep copying data from the next node to the node to be
 delete and remove the tail. This will not work if node to be deleted
 is the last node.

 On Wed, Aug 10, 2011 at 11:44 PM, Piyush Kapoor 
 wrote:
 > Q1)Two linked Lists are given,i.e,their head pointers are given,and
 the
 > problem is to check if the second one is reverse of the first one.Give
 the
 > most efficient algo for it.
 > Q2)A linked list is given,and one of its nodes is given.The problem is
 to
 > delete the given node from the linked list.(The head node is not
 given).
 > (In both of the above cases,the linked lists are singly linked lists.)
 > --
 > Regards,
 > Piyush Kapoor,
 > 2nd year,CSE
 > IT-BHU
 >
 > --
 > 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
 > http://groups.google.com/group/algogeeks?hl=en.
 >



 --
 Cheers
 Naveen Kumar

 --
 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
 http://groups.google.com/group/algogeeks?hl=en.


>>>
>>>
>>> --
>>> *Regards,*
>>> *Piyush Kapoor,*
>>> *2nd year,CSE
>>> IT-BHU*
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *Regards,*
> *Piyush Kapoor,*
> *2nd year,CSE
> IT-BHU*
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-08-08 Thread aditya kumar
check this link http://indiabix.com/

On Mon, Aug 8, 2011 at 10:58 PM, sukran dhawan wrote:

> can anyone plz help me where can v get the aptitude questions (i meant the
> site)
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS test

2011-08-07 Thread aditya kumar
4) c
40%300=120 sec and you got to finish in 150 sec
60%300=180sec so basically we got to finish 180sec work in 30 sec so we need
6 processor .. this is wot i thought while attempting this question
i gave this written test !

On Sun, Aug 7, 2011 at 8:54 PM, iama  wrote:

> I am a little skeptic over the 6th question.
> Adding more RAM does not necessarily decrease page faults. If the page is
> in the disk, then more RAM might help by making the interaction with the
> Hard Disk lesser. But if the page is in some other memory, then this might
> not be the case.
> A better solution can be (d). After all, it is definitely helping in
> fetching the data quicker. (by shifting the 'workplace' to RAM)
>
> --
> 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/-/JVpGwelCJNAJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



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

2011-07-27 Thread aditya kumar
sizeof calculates at compile time so their is no function call . in case of
function it gives the size of return type of that function

On Wed, Jul 27, 2011 at 9:41 PM, Abhinav Arora wrote:

> ya Amit is right...
> sizeof(main()) will return 4 because main will return an
> integer.however it will not execute main()..and sizeof(&main) will give
> 4 too but this time it is 4 because &main is a pointer to main
>
> another example
>
>
> #include
> #include
> double foo();
> main()
> {
>   int a,b,c;
>   int **p;
>   printf("%d",sizeof(foo()));
>   getch();
>   }
> double foo()
> {
>printf("Hi");
>return 123.45;
>}
>
>
> Here sizeof(foo())will return 8 which is the size of double. However it
> will not run the function foo.and sizeof(&foo) gives 4 ...as it is a
> pointer to function foo
>
> --
> 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/-/IP5eG_wpP7oJ.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



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

2011-07-26 Thread aditya kumar
char *s[5] is a array of pointers of type char . but the thing is size of
pointers is 4byte irrespective of its type . coz address is always an
unsigned int which is of 4byte.
On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam wrote:

> @everyone:
> I have this mind strangling doubt..!!!
>
> Why is "char *s[5]" of 20 bytes...?
>
> yes the output is 28...
>
> On 7/26/11, Don  wrote:
> > A reasonable guess would be 28 bytes. But the size of a structure is
> > implementation dependent, and therefore, some other result could be
> > correct as well.
> > Don
> >
> > On Jul 26, 7:40 am, Puneet Gautam  wrote:
> >> #include
> >> #include
> >> struct node{
> >>int a;
> >>char *b[5];
> >>struct node *link;
> >>};
> >> main()
> >> {
> >>   int a;
> >>   a=sizeof(struct node);
> >>   printf("%d",a);
> >>   getchar();
> >>   return 0;
> >>   }
> >>
> >> Whats the output..?
> >
> > --
> > 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
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] size of self referential structure

2011-07-26 Thread aditya kumar
@akshata: here padding wont come into picture coz int a =4byte, char
*b[5]=4*5byte, *link=4byte all are multiple of 4 . ans will be 28 byte

On Tue, Jul 26, 2011 at 6:42 PM, Akshata Sharma
wrote:

> why isn't padding done here? We have seen previous posts on size of
> structures, where due to padding, the size was not just the sum of size of
> datatypes, but also padded bytes.
> like here, int (4 bytes), then why is 3 bytes not padded after this, before
> char* arr[5] (20 bytes)?
>
>
> On Tue, Jul 26, 2011 at 6:16 PM, sunny agrawal wrote:
>
>> 4+20+4 = 28 bytes it should be i think
>>
>> On Tue, Jul 26, 2011 at 6:10 PM, Puneet Gautam 
>> wrote:
>>
>>> #include
>>> #include
>>> struct node{
>>>   int a;
>>>   char *b[5];
>>>   struct node *link;
>>>   };
>>> main()
>>> {
>>>  int a;
>>>  a=sizeof(struct node);
>>>  printf("%d",a);
>>>  getchar();
>>>  return 0;
>>>  }
>>>
>>> Whats the output..?
>>>
>>> --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Graph Based Problems

2011-07-26 Thread aditya kumar
all graph problem need not use tree . most of them can be implemented using
array .

On Tue, Jul 26, 2011 at 3:11 PM, Dipankar Patro  wrote:

> Love your idea Navneet, but I have seen in general that Graph algos are
> difficult to convert into code (at least for me!) May be that's the reason
> why people are not discussing it here.
>
> But like you pointed out we could at least point the scenarios where graph
> algos can be applied. Looking forward to your set of questions for sure.
>
>
> On 26 July 2011 12:25, Navneet Gupta  wrote:
>
>> Hello folks,
>>
>> I have seen some of the best possible string/array/tree based problems
>> being discussed on this thread but somehow i feel this group has been little
>> partial towards Graph problems.
>>
>> Though, in most cases, interviewers don't ask Graph algorithms, but we, as
>> algo lovers, should give due importance to graph problems.
>>
>> Hope this will give some folks some motivations to share/ask good graph
>> based problems.
>>
>> I will try to come up with first set of questions to get things rolling.
>>
>> --
>> Regards,
>> Navneet
>>
>>
>> --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
>
> ___
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C OUTPUT

2011-07-24 Thread aditya kumar
thnks all :)
@rajeev : u are right dats y  *((char*)iPtr+2) will printf 0.

On Mon, Jul 25, 2011 at 11:56 AM, ~*~VICKY~*~ wrote:

> Consider the binary representation of 257 which is 10001
>
> which will be stored in little endain representation as least significant
> eight bits + most significant eight bits as follows
>
> 0001 | 0001
>
> now iptr on casting to char will point to least significant eight bits
> which is 1, when u increment iptr it refers to most sig 8 bits which is also
> 1
>
> hence the o/p will be : 1 1
>
>
> hope it helps!
>
> On Mon, Jul 25, 2011 at 11:41 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> main()
>> {
>> int i = 257;
>> int *iPtr = &i;
>> printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
>> }
>>
>> can any one explain me the o/p ??
>>
>> --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Cheers,
>
>   Vicky
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] C OUTPUT

2011-07-24 Thread aditya kumar
main()
{
int i = 257;
int *iPtr = &i;
printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
}

can any one explain me the o/p ??

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Long string and the first non-repeating character

2011-07-18 Thread aditya kumar
use hash table.characters count will be stored on the basis of their ascii
value . ie a's  count will be stored in array[97] .
at last just check the count of each . count==1 gives u the first non
repeating character

On Tue, Jul 19, 2011 at 12:31 AM, aditi garg wrote:

> @sagar ur solution is very gud...bt wat abt blank spaces and capital
> alphabets dat may be thr...i dnt think it will take care of that...
>
>
> On Mon, Jul 18, 2011 at 11:32 PM, varun pahwa wrote:
>
>> @sagar: that's what i have done i have taken two variables x and y which
>> can show if repetition is there or not. and we can store the initial
>> positions in the array in that case u don't have to traverse the string
>> twice.
>>
>>
>> On Mon, Jul 18, 2011 at 10:33 PM, sagar pareek wrote:
>>
>>> @dumanshu
>>> first read my soution just above yours   :)
>>>
>>> On Mon, Jul 18, 2011 at 10:21 PM, Dumanshu  wrote:
>>>
 heres my solution with TC O(n) and SC O(26)
 input string str
 int arr[26] = {0};
 traverse the string, character by character and increment the
 corresponding counter.
 i.e. arr[str[i]]++;

 Now traverse the string again and print out the first character
 encountered whose arr[str[i]] == 1;

 On Jul 18, 9:20 pm, sagar pareek  wrote:
 > Very good solution :-  but space complexity = O(26)
 >
 > take integer array arr[0-25] and initialise it with 0 by taking it
 static
 > logic is that we have only 26 characters so if i want to map character
 'a'
 > with 0th position of arr[] then it can be done as atoi('a')-97.
 > so whenever we encounter any character say str[i] (where str is array
 of
 > given string) then it can be incremented as arr[atoi(str[i])-97]++
 > so traverse the whole str[] and increment the corresponding values .
 > At the end those characters which never encounter have values 0 in arr
 ,
 > which encounter only once have values 1 and more than once have
 values>1.
 > at the end traverse the whole arr[] and find out the corresponding
 character
 > as itoa(arr[i]+97) :) :)
 >
 > But we have to do extra work to find the first character which repeats
 only
 > once
 >
 > On Mon, Jul 18, 2011 at 8:09 PM, hary rathor 
 wrote:
 > > can we use bit vector ?
 > > because  by  do it we need just 32 bits of one extra variable .
 >
 > >  --
 > > 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
 > >http://groups.google.com/group/algogeeks?hl=en.
 >
 > --
 > **Regards
 > SAGAR PAREEK
 > COMPUTER SCIENCE AND ENGINEERING
 > NIT ALLAHABAD

 --
 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
 http://groups.google.com/group/algogeeks?hl=en.


>>>
>>>
>>> --
>>> **Regards
>>> SAGAR PAREEK
>>> COMPUTER SCIENCE AND ENGINEERING
>>> NIT ALLAHABAD
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Varun Pahwa
>> B.Tech (IT)
>> 7th Sem.
>> Indian Institute of Information Technology Allahabad.
>> Ph : 09793899112
>> Official Email :: rit2008...@iiita.ac.in
>> Another Email :: varunpahwa.ii...@gmail.com
>>
>> People who fail to plan are those who plan to fail.
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New Delhi
>
> 9718388816
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>


Re: [algogeeks] Re: Expression evaluation in C

2011-07-18 Thread aditya kumar
the behaviour is undefined since computer dsnt know which i to evaluate
first .

On Mon, Jul 18, 2011 at 6:15 PM, SAMMM  wrote:

> This has to do with lvalue . because i++ require some place to store
> it value .
>
> On Jul 18, 1:10 pm, XYZ  wrote:
> > I was also thinking about the order of expression evaluation in gcc!
> > No idea though!
>
> --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: C Doubts

2011-07-17 Thread aditya kumar
@Nikhil
thnks :)

On Mon, Jul 18, 2011 at 1:32 AM, Nikhil Gupta wrote:

> That is again compiler dependent. Usually when hardware configuration is
> taken into account, the compiler uses padding of 3 bytes. But in some cases,
> for the ease of hardware access and faster implementation, 11 bytes are
> padded. Possibly depends on your system hardware's synchronization with the
> compiler.
>
>
> On Mon, Jul 18, 2011 at 1:27 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> @Nikhil
>> why is Address of long double : starts at 11 address locations from char
>> variable ??
>> is shud start from 3rd adress location from char variable bcoz memory
>> cycle involves a word so are you padding 11bytes ??
>>
>>
>> On Mon, Jul 18, 2011 at 1:24 AM, Nikhil Gupta 
>> wrote:
>>
>>> @Sagar
>>>
>>> Memory sizes of long double variables are compiler and system
>>> configuration dependent. So obviously, in accordance with your compiler, the
>>> size of long double is 8 bytes.
>>>
>>>
>>> On Mon, Jul 18, 2011 at 1:22 AM, Nikhil Gupta >> > wrote:
>>>
>>>> @Aditya
>>>>
>>>> Here is the padding effect :
>>>>
>>>> Address of char : starts anywhere
>>>> Address of long double : starts at 11 address locations from char
>>>> variable --> 1+11+12=24 bytes
>>>>
>>>>
>>>> On Mon, Jul 18, 2011 at 1:10 AM, sagar pareek wrote:
>>>>
>>>>> @aditya
>>>>> actually first see your post, you have written o/p=24 accordingly
>>>>> padding done is perfect. But actually its printing 16.
>>>>> So now question arises of padding
>>>>>
>>>>> and its pareek not prateek :)
>>>>>
>>>>>
>>>>> On Mon, Jul 18, 2011 at 12:38 AM, aditya kumar <
>>>>> aditya.kumar130...@gmail.com> wrote:
>>>>>
>>>>>> @prateek . can you explain me ?? i dint get padding logic in this
>>>>>> example of mine.
>>>>>>
>>>>>> On Mon, Jul 18, 2011 at 12:30 AM, sagar pareek >>>>> > wrote:
>>>>>>
>>>>>>> sizeof long double is 12. So padding concept is perfectly working
>>>>>>>
>>>>>>>
>>>>>>>  On Mon, Jul 18, 2011 at 12:26 AM, aditya kumar <
>>>>>>> aditya.kumar130...@gmail.com> wrote:
>>>>>>>
>>>>>>>> struct st
>>>>>>>> {
>>>>>>>>  char ch1;
>>>>>>>>  long double ld;
>>>>>>>> }s;
>>>>>>>> printf("%d",sizeof(s));
>>>>>>>> //output : 24 (for 32-bit compiler)
>>>>>>>> ->as i have mentioned above the behaviour is undefined in case of
>>>>>>>> sizeof (struct)
>>>>>>>> can any one explain me why the padding concept does not work here ??
>>>>>>>>
>>>>>>>> On Mon, Jul 18, 2011 at 12:13 AM, Parthiban wrote:
>>>>>>>>
>>>>>>>>> @Abhi:
>>>>>>>>> Answers:
>>>>>>>>> 1. whenever a 'const' qualifier is added previously to a variable
>>>>>>>>> declaration it means that the value of the variable is automatically
>>>>>>>>> initialized to '0'(because of the 'auto' type of the const variable)  
>>>>>>>>> and
>>>>>>>>> cannot be changed in any of the following assignment statements to 
>>>>>>>>> the const
>>>>>>>>> variable.
>>>>>>>>>
>>>>>>>>> 2.
>>>>>>>>> Here for the structure struct s1 since the entire structure is
>>>>>>>>> ending within 8 bytes no padding is done which means
>>>>>>>>> s1: [char a]
>>>>>>>>>1byte
>>>>>>>>> but for the structure struct s2 consider the following:
>>>>>>>>> s2: [ char a
>>>>>>>>> 1byte
>>>>>>>>>-- int a---
>>>>>>>>>--4bytes]
>>>>>>>>&g

Re: [algogeeks] Re: C Doubts

2011-07-17 Thread aditya kumar
@Nikhil
why is Address of long double : starts at 11 address locations from char
variable ??
is shud start from 3rd adress location from char variable bcoz memory cycle
involves a word so are you padding 11bytes ??

On Mon, Jul 18, 2011 at 1:24 AM, Nikhil Gupta wrote:

> @Sagar
>
> Memory sizes of long double variables are compiler and system configuration
> dependent. So obviously, in accordance with your compiler, the size of long
> double is 8 bytes.
>
>
> On Mon, Jul 18, 2011 at 1:22 AM, Nikhil Gupta 
> wrote:
>
>> @Aditya
>>
>> Here is the padding effect :
>>
>> Address of char : starts anywhere
>> Address of long double : starts at 11 address locations from char variable
>> --> 1+11+12=24 bytes
>>
>>
>> On Mon, Jul 18, 2011 at 1:10 AM, sagar pareek wrote:
>>
>>> @aditya
>>> actually first see your post, you have written o/p=24 accordingly padding
>>> done is perfect. But actually its printing 16.
>>> So now question arises of padding
>>>
>>> and its pareek not prateek :)
>>>
>>>
>>> On Mon, Jul 18, 2011 at 12:38 AM, aditya kumar <
>>> aditya.kumar130...@gmail.com> wrote:
>>>
>>>> @prateek . can you explain me ?? i dint get padding logic in this
>>>> example of mine.
>>>>
>>>> On Mon, Jul 18, 2011 at 12:30 AM, sagar pareek 
>>>> wrote:
>>>>
>>>>> sizeof long double is 12. So padding concept is perfectly working
>>>>>
>>>>>
>>>>>  On Mon, Jul 18, 2011 at 12:26 AM, aditya kumar <
>>>>> aditya.kumar130...@gmail.com> wrote:
>>>>>
>>>>>> struct st
>>>>>> {
>>>>>>  char ch1;
>>>>>>  long double ld;
>>>>>> }s;
>>>>>> printf("%d",sizeof(s));
>>>>>> //output : 24 (for 32-bit compiler)
>>>>>> ->as i have mentioned above the behaviour is undefined in case of
>>>>>> sizeof (struct)
>>>>>> can any one explain me why the padding concept does not work here ??
>>>>>>
>>>>>> On Mon, Jul 18, 2011 at 12:13 AM, Parthiban wrote:
>>>>>>
>>>>>>> @Abhi:
>>>>>>> Answers:
>>>>>>> 1. whenever a 'const' qualifier is added previously to a variable
>>>>>>> declaration it means that the value of the variable is automatically
>>>>>>> initialized to '0'(because of the 'auto' type of the const variable)  
>>>>>>> and
>>>>>>> cannot be changed in any of the following assignment statements to the 
>>>>>>> const
>>>>>>> variable.
>>>>>>>
>>>>>>> 2.
>>>>>>> Here for the structure struct s1 since the entire structure is ending
>>>>>>> within 8 bytes no padding is done which means
>>>>>>> s1: [char a]
>>>>>>>1byte
>>>>>>> but for the structure struct s2 consider the following:
>>>>>>> s2: [ char a
>>>>>>> 1byte
>>>>>>>-- int a---
>>>>>>>--4bytes]
>>>>>>> so here the concept of padding comes to make all the variable aligned
>>>>>>> in even boundaries and so the structure after aligning will look as:
>>>>>>> s2: [ -- char b
>>>>>>> --4byte-
>>>>>>>-- int a---
>>>>>>>--4bytes]
>>>>>>>
>>>>>>> so the size of strcut s2 will be 8bytes..
>>>>>>>
>>>>>>>  --
>>>>>>> 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/-/FoHpgvrjnm0J.
>>>>>>>
>>>>>>> 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
&

Re: [algogeeks] Re: C Doubts

2011-07-17 Thread aditya kumar
@pareek..my compiler gives 24 . newazz if ansa is 16 acc to you then it
follows padding principle perfectly. since memory cycle invloves 1 word
hence char will take 1 byte nd 3 bytes will be padded up . rest 12 bytes
will come from long double so 4+12=16 bytes :)
n ya sry abt d name .

On Mon, Jul 18, 2011 at 1:10 AM, sagar pareek  wrote:

> @aditya
> actually first see your post, you have written o/p=24 accordingly padding
> done is perfect. But actually its printing 16.
> So now question arises of padding
>
> and its pareek not prateek :)
>
>
> On Mon, Jul 18, 2011 at 12:38 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> @prateek . can you explain me ?? i dint get padding logic in this example
>> of mine.
>>
>> On Mon, Jul 18, 2011 at 12:30 AM, sagar pareek wrote:
>>
>>> sizeof long double is 12. So padding concept is perfectly working
>>>
>>>
>>>  On Mon, Jul 18, 2011 at 12:26 AM, aditya kumar <
>>> aditya.kumar130...@gmail.com> wrote:
>>>
>>>> struct st
>>>> {
>>>>  char ch1;
>>>>  long double ld;
>>>> }s;
>>>> printf("%d",sizeof(s));
>>>> //output : 24 (for 32-bit compiler)
>>>> ->as i have mentioned above the behaviour is undefined in case of sizeof
>>>> (struct)
>>>> can any one explain me why the padding concept does not work here ??
>>>>
>>>> On Mon, Jul 18, 2011 at 12:13 AM, Parthiban  wrote:
>>>>
>>>>> @Abhi:
>>>>> Answers:
>>>>> 1. whenever a 'const' qualifier is added previously to a variable
>>>>> declaration it means that the value of the variable is automatically
>>>>> initialized to '0'(because of the 'auto' type of the const variable)  and
>>>>> cannot be changed in any of the following assignment statements to the 
>>>>> const
>>>>> variable.
>>>>>
>>>>> 2.
>>>>> Here for the structure struct s1 since the entire structure is ending
>>>>> within 8 bytes no padding is done which means
>>>>> s1: [char a]
>>>>>1byte
>>>>> but for the structure struct s2 consider the following:
>>>>> s2: [ char a
>>>>> 1byte
>>>>>-- int a---
>>>>>--4bytes]
>>>>> so here the concept of padding comes to make all the variable aligned
>>>>> in even boundaries and so the structure after aligning will look as:
>>>>> s2: [ -- char b
>>>>> --4byte-
>>>>>-- int a---
>>>>>--4bytes]
>>>>>
>>>>> so the size of strcut s2 will be 8bytes..
>>>>>
>>>>>  --
>>>>> 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/-/FoHpgvrjnm0J.
>>>>>
>>>>> 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
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> 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
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> **Regards
>>> SAGAR PAREEK
>>> COMPUTER SCIENCE AND ENGINEERING
>>> NIT ALLAHABAD
>>>
>>>  --
>>> 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,

Re: [algogeeks] Re: C Doubts

2011-07-17 Thread aditya kumar
@prateek . can you explain me ?? i dint get padding logic in this example of
mine.

On Mon, Jul 18, 2011 at 12:30 AM, sagar pareek wrote:

> sizeof long double is 12. So padding concept is perfectly working
>
>
> On Mon, Jul 18, 2011 at 12:26 AM, aditya kumar <
> aditya.kumar130...@gmail.com> wrote:
>
>> struct st
>> {
>>  char ch1;
>>  long double ld;
>> }s;
>> printf("%d",sizeof(s));
>> //output : 24 (for 32-bit compiler)
>> ->as i have mentioned above the behaviour is undefined in case of sizeof
>> (struct)
>> can any one explain me why the padding concept does not work here ??
>>
>> On Mon, Jul 18, 2011 at 12:13 AM, Parthiban  wrote:
>>
>>> @Abhi:
>>> Answers:
>>> 1. whenever a 'const' qualifier is added previously to a variable
>>> declaration it means that the value of the variable is automatically
>>> initialized to '0'(because of the 'auto' type of the const variable)  and
>>> cannot be changed in any of the following assignment statements to the const
>>> variable.
>>>
>>> 2.
>>> Here for the structure struct s1 since the entire structure is ending
>>> within 8 bytes no padding is done which means
>>> s1: [char a]
>>>1byte
>>> but for the structure struct s2 consider the following:
>>> s2: [ char a
>>> 1byte
>>>-- int a---
>>>--4bytes]
>>> so here the concept of padding comes to make all the variable aligned in
>>> even boundaries and so the structure after aligning will look as:
>>> s2: [ -- char b
>>> --4byte-
>>>-- int a---
>>>--4bytes]
>>>
>>> so the size of strcut s2 will be 8bytes..
>>>
>>>  --
>>> 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/-/FoHpgvrjnm0J.
>>>
>>> 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
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> **Regards
> SAGAR PAREEK
> COMPUTER SCIENCE AND ENGINEERING
> NIT ALLAHABAD
>
>  --
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: C Doubts

2011-07-17 Thread aditya kumar
 struct st
{
char ch1;
long double ld;
}s;
printf("%d",sizeof(s));
//output : 24 (for 32-bit compiler)
->as i have mentioned above the behaviour is undefined in case of sizeof
(struct)
can any one explain me why the padding concept does not work here ??

On Mon, Jul 18, 2011 at 12:13 AM, Parthiban  wrote:

> @Abhi:
> Answers:
> 1. whenever a 'const' qualifier is added previously to a variable
> declaration it means that the value of the variable is automatically
> initialized to '0'(because of the 'auto' type of the const variable)  and
> cannot be changed in any of the following assignment statements to the const
> variable.
>
> 2.
> Here for the structure struct s1 since the entire structure is ending
> within 8 bytes no padding is done which means
> s1: [char a]
>1byte
> but for the structure struct s2 consider the following:
> s2: [ char a
> 1byte
>-- int a---
>--4bytes]
> so here the concept of padding comes to make all the variable aligned in
> even boundaries and so the structure after aligning will look as:
> s2: [ -- char b
> --4byte-
>-- int a---
>--4bytes]
>
> so the size of strcut s2 will be 8bytes..
>
>  --
> 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/-/FoHpgvrjnm0J.
>
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] C Doubts

2011-07-17 Thread aditya kumar
1) you cannot change the const variable .
2) generally sizeof behaviour in case of structure is just undefined. Either
it follows the summation of size of members or it uses padding concept ie in
your example 4 byte each for character(1 byte for char rest of the 3 bytes
is padded up) and 4 byte for integer .This is more efficient

On Sun, Jul 17, 2011 at 11:38 PM, Abhi  wrote:

> 1.When I declare a variable as const then any subsequent assignment of it
> gives an error "assignment of read only variable". Is a const variable
> treated as a read only variable?
>
>
> 2.
>
> #include
> struct s1 {
>   char a;
>  };
>
> char s2 {
>  char b;
>  int c;
>};
>
> printf("%d",sizeof(struct s1));  // output : 1
> printf("%d",sizeof(struct s2));  // output : 8
>
> please explain..
>
>
>
>  --
> 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/-/nOK4AkuAgW8J.
> 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
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
http://groups.google.com/group/algogeeks?hl=en.



  1   2   >