Ad

Friday, 19 July 2013

Algo#49: Sort the input character array based on the given dictionary order.

Sort the input character array based on the given dictionary order.

E.G. If input word is “SHEEP“, sorting will make it as “EEHPS“.

But in the given dictionary, E may not be at first. As per the dictionary in given problem, if P is first, S followed and E later and finally H.

Then sorted array should be “PSEEH“.

Following is implementation of above problem in c language.





Please write comments if you find anything wrong or you want to add something more related to this topic.

Thursday, 18 July 2013

Algo#48: Find minimum window length which accommodate all given character.

Given problem is purely string manipulation problem. Here we have to find minimum window length which accommodate all given character for second string.

E.g. Given string ABBACBAA, and if we want to find minimum window length which can accommodate "AAA", it will be 5 (index 3 to 7). "CCC" should return MAX length as no window in original string can accommodate "CCC".

Following is implementation of above algorithm in c language.





Please write comments if you find anything wrong or you want to add something more related to this topic.

Ad