my hash table was my bits....read again....I have posted this soln. earlier
post too,,,posting again..
1.scan string.
let the ascii value of each char visited be i
if ith bit set
   then check visited region(last 4 ints) for ith bit
   if ith bit set do nothing
   else set it
2.if not set set the ith bit in the count region(first four ints) set it.
3.Now you done with scanning scan again checking the visited region for the
ith bit.If set continue.
else return the char,
4.If out of loop return -1

Hope I am clear now????If I am still not clear sorry I can't be more clear
than this......
On Tue, Aug 2, 2011 at 7:31 PM, muthu raj <muthura...@gmail.com> wrote:

> 1) subjective question:
>
> To find the first repetitive character how can you use bits because you
> cannot keep track of first repeated character and also if a character is
> present more than twice for ex thrice its mask shows 1 indicating it has
> occured once. So  please tell how to implement in O(1) space. If we use Hash
> table we can do it in O(n) space and time.
>
>
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Tue, Aug 2, 2011 at 7:24 PM, saurabh singh <saurab...@gmail.com> wrote:
>
>> and optimize as much as you can...even if the interviewer says that he is
>> satisfied....
>> I was asked Q.1 mentioned above.I  first used bitset.He asked me if I
>> could do in pure c without using *any other function.*While I was working
>> on my  code he said he will be ok if I use an int array of 256.I kept
>> telling him I could do better,he need not worry.I ended up with just 8 int
>> variables(and an internship with MS) :)* *
>>
>>
>> On Tue, Aug 2, 2011 at 6:55 PM, sourabh jakhar 
>> <sourabhjak...@gmail.com>wrote:
>>
>>> abe dce se kitne leke gaye ms final year se aur package kya offer kiya
>>>
>>>
>>> On Tue, Aug 2, 2011 at 6:21 PM, Anurag atri <anu.anurag....@gmail.com>wrote:
>>>
>>>> you have to be in formals for sure !
>>>> yes , people who clear the written will have 3 interviews .
>>>>
>>>>
>>>> On Tue, Aug 2, 2011 at 2:15 PM, saurabh modi <
>>>> saurabhmodi102...@gmail.com> wrote:
>>>>
>>>>> hey man,could you tell something abt the attire and all.?
>>>>> we dont need to go in formals,right?
>>>>> plus,koi interview and all hoga?
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the 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
>>>> Anurag Atri
>>>> III year
>>>> Computer Engineering
>>>> Delhi College Of Engineering
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the 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.
>>>>
>>>
>>>
>>>
>>> --
>>> SOURABH JAKHAR,(CSE)(Final year)
>>> ROOM NO 167 ,
>>> TILAK,HOSTEL
>>> 'MNNIT ALLAHABAD
>>>
>>>  The Law of Win says, "Let's not do it your way or my way; let's do it
>>> the best way."
>>>
>>>  --
>>> You received this message because you are subscribed to the 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.
>>>
>>
>>
>>
>> --
>> 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.
>



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

Reply via email to