Archive

Archive for December, 2005

My Fun Time ;) !

December 20, 2005 1 comment

Was just sitting in the office at 4:30 P.M when I just read this problem.

“Arrange the letters in a sequence , if there are given letters in a random order as abcbcabcabcabb, we have to arrange them in a sequence means in a fashion of aaaabbbbbcccc(means all the a should come first then all b’s and then all c’s) in O(n) complexity”.

Now thats a very easy problem if i have to solve it for english alphabets. At 4:33 P.M I finished coding it in C++.

P.S: I am able to code so fast as I have always opened a Windows of Visual Studio for C++.

Here is the code I Wrote.

void ArrangeLetters(char input[], int size)
{

int freq_lett[26] = {0};
char * temp = new char[size+1];
for(int index = 0 ; index
freq_lett[input[index]-97]++;
for(int index = 1 ; index
freq_lett[index] = freq_lett[index] + freq_lett[index-1];
for(int index = 0 ; index
{
temp[(freq_lett[input[index]-97]) -1] = input[index];
freq_lett[input[index]-97]–;
}
temp[size] = ”;
for(int index = 0 ; index
input[index] = temp[index];
}

Some of you might be thinking about kind of my fun. But believe me there is so much variety of
people in this world that 1 can expect anything from any one. So thats my way of seeing
fun and hitting a solution of any existing small/long but trickier or at times tougher computational problem or algorithm.

99 Zeroes and Google ^ Google!

Advertisements
Categories: Computer Programming

Error message when you install or start an MS-DOS or 16-bit Windows-based program !

December 5, 2005 Leave a comment

Hi,

Well once again I had to re-install windows on my machine. Just installed the latest version iof Windows XP available with all the service packs so far. After installing it however I faced one serious problem. The 16-Bit dos executables and DOS itself was not running on my machine. Now this was a serious situation for a still Borland C++ 3.0 DOS version and BASIC IDE user, so just I tried something and found a fix to this problem.

The error message that is prompted is something like this when, Config.nt, Autoexec.nt or Command.com or any combination of them is missing or corrupt, that [some file name] your version of OS is not suitable for running DOS executables. So the workaround for this problem is to insert your Windows CD in your CD ROM and then in command prompt run the following command in sequence ( this worked in my case) .

1. expand CD-ROM Drive Letter:\i386\config.nt_ c:\windows\system32\config.nt
2. expand CD-ROM Drive Letter:\i386\autoexec.nt_ c:\windows\system32\autoexec.nt
3. expand CD-ROM Drive Letter:\i386\command.co_ c:\windows\system32\command.com
4. exit

Hopefully your problem will be resolved by now. If some how the problem still prevails follow the following link.

http://support.microsoft.com/default.aspx?scid=kb;en-us;324767&Product=winxp

Hope your problems resolves.

Regards,
I, Haroon

Categories: Computer Science