i answered with the...system call too..but he said...do it in C programming
language only don't use...system call here!!

On Tue, Dec 11, 2012 at 10:32 PM, saurabh singh <saurab...@gmail.com> wrote:

> stdin is a file pointer.
> freopen returns a file pointer..
> I suggest using read system call.
>
> For the second question it would be simply
> (len)!/((frequency_0)!*(frequency_1)!*(frequency_2)!.......)
>
> However this will also contains permutations which begin with 0. So
> subtract the number of permutations that begin with 0 from this number.
>
> Since any factorial in the denominator part will be less than or equal to
> (len)! we can calculate and store them while calculating len! Hence the
> overall operation will take O(len) time which would be O(log n) where n is
> the number.
>
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT
> blog:geekinessthecoolway.blogspot.com
>
>
>
> On Tue, Dec 11, 2012 at 11:02 AM, amrit harry <dabbcomput...@gmail.com>wrote:
>
>> 1st:
>>
>> freopen("filename","r",stdin);
>>
>> while(scanf("%s",str)!=-1)
>> {
>> printf("%s\n",str);
>> }
>>
>>
>> On Sun, Dec 9, 2012 at 3:22 PM, manish untwal <manishuntw...@gmail.com>wrote:
>>
>>> I gave this interview in August this year, two of the question i was not
>>> able to answer properly
>>> 1) how to print the content of file in C without using the file pointer.
>>> 2) count the total number of permutation of a number in order O(n)
>>>
>>> --
>>>
>>>
>>>
>>
>>
>>
>> --
>> Thanks & Regards
>> Amritpal singh
>>
>>  --
>>
>>
>>
>
>  --
>
>
>



-- 
With regards,
Manish kumar untwal
Indian Institute of Information Technology
Allahabad (2009-2013 batch)

-- 


Reply via email to