Thursday, August 28, 2014

0397 Longest monotonically increasing subsequence

Given a random sequence, find the longest subsequence such that all subsequence elements are in monotonically increasing order.

Example, given sequence {7,8,9,1,2,3,6}, longest increasing sequence (LIS) is {1,2,3,6}.

I come across this classical problem while reading Dynamic Programming chapter in CLRS algorithm book. Given the dynamic programming context, trying dynamic programming becomes my first thought.

Wednesday, August 27, 2014

Configuring a new internal hard drive with docking station

This was frustrating. I bought a hard drive docking station from amazon and a 3TB hard drive from Rakuten lately with high expectation that I finally find a place to put my messy documents and archives. Both arrived today in one piece. So I thought it should be frustration-free to hook those up to my laptop. It turns out to be a nightmare (for newbies like me).

With the out-of-factory hard drive plugged in and usb docking station connected, I was 'surprised' to find out the new hard drive has 'not been recognized' by the laptop. I see device activated with a nice beeping sound from my laptop indicating new hardware connected, and the new hard drive starts its engine, But, no new volume shows up, no autoplay starts. This error could comes from any of those three devices:
  1. Defected hard drive;
  2. Docking station needs a driver or broken;
  3. My laptop.
Tuning the hard drive itself would be hard since I do not have a spare hard drive at hand. I tried to disassemble my other external hard drive but its screwless design stopped me from destroying it.

As to the docking station, my laptop displays chipset ASM1053E. A driver for this chipset is not needed as far as I know.

Besides, I can hear the hard drive spins happily and all lights on (it would be great if they are blinky). I don't think I'm that bad luck to get a defected hard drive. Time to fix my laptop.

What can I think of? 

  1. USB 3.0 controller driver issue;
  2. Disk driver issue;
  3. BIOS or MB issue (No one want this to happen)
That's about it. I am using an Intel 7 series usb host controller. Users on the forums had posted issues about usb 3.0 connection but none looks like mine. An update from official forum suggests a driver update since my old driver is already 2.5 years old. I did not uninstall my old driver in case doing so will cause unexpected issues. Luckily during the new driver installation most old files have been overwritten. A reboot is required. But unfortunately this does not solve my problem.

Disk driver issue? Let's check DISKPART.  


Actually the above images are not what I got. Diskpart crashed before me when I tried to access disk info. By then I suddenly realized what DISKPART is trying to tell me. I can detect the existence of this new hard drive, but cannot read any partition info from it. What is the problem? Broken file system? I don't even have one! Yes, A disk partition is needed before I use any internal disk. Just like what we did during system installation.

The remaining part is simple once I am finally on the right track. With the help of dskmgr.exe, partitions were built and disk shows up correctly in my explorer now. Hooray.

It was not fun to play until 4am, right?