Question: Give a linked list [unsorted], remove consecutive duplicate elements :

input :

1 2 3 5 5 6 6 3 2 7 

output :

1 7

* after first iteration 3 and 3 become consecutive duplicate, and after 2nd iteration 2 and 2 become consecutive duplicates

Programming language is not a concern, java/c/c++, anything will do.
Using extra memory is not preferred, no extra stacks or queues, need to be done in one iteration.

Answer: 
I myself am working on a self-written OS two (over one year now). I have written a two-stage boot loader for FAT12/16 and FAT32 and there is a significant difference:

* On FAT12/16 it is quite easy to write a boot loader
* On FAT32 it is very difficult because a lot of things that are located in the first sector of the second stage in the FAT12/16 loader must already be in the boot sector for FAT32.

As far as I know even Windows either insists that the stage two file is one of the first files on the root directory (in this case less code in the boot sector is required) or some extra sectors with fixed sector numbers are used to "extend" the boot sector to a size > 512 bytes.

For an own operating system that should co-exist with other systems on the same disk both approaches won't work.

My boot loader works the following way:

It calculates the sector number of the first cluster. It contains a sub-routine that can read a sector by a given cluster number (they are 32-bit!) and a cluster-relative sector.

The first sector of the root directory (the cluster number is known) is read and searched for the file containing the stage two code. Then the second sector is read and so on.

When all sectors of a cluster are read then the FAT must be read to get the cluster number of the next cluster of the root directory. This is the part that is in the stage two code for FAT12/16 boot loaders but must be located in the boot sector itself for FAT32 boot loaders.

As soon as the directory entry is found you'll load the first sector of the first cluster of the stage two file. Loading the rest of the file can be done by code in the first sector of the stage two file!

When using INT 13h, function 42h (linear disk read supported by BIOSs newer than 1995) the 512 bytes of the boot sector are just enough if you use very short error messages only. Using INT 13h, function 2 (C/H/S disk read) I didn't manage to write a FAT32 boot sector because 512 bytes are just not enough.
Are you sure you need to write your own bootloader?

There are already plenty of x86 bootloaders available (Lilo, Grub, and Extlinux among others). They are not specific to Linux; so long as your OS conforms to [the multiboot specification](http://www.gnu.org/software/grub/manual/multiboot/multiboot.html), any of them will be able to boot your OS. Using any one of them will save you a lot of development time.

That all being said, the most common approaches to locating the second-stage bootloader are to either:

1. Store it in the slack space after the MBR, before the first partition. (This assumes that such space exists, but it does on most disks.)

OR

2. Embed a list of sector numbers into the first-stage bootloader, directing it to where it will find the second-stage bootloader.