finding suitable substitute for 2n3904 transistor
First, find the datasheet of the device you want to replace. That's the easy bit. 

Now the harder bit. Obviously the replacement must be of the same type (bipolar NPN) and preferably designed for the same applications (general purpose amplifier). But beyond that the datasheet may provide a lot of parameters. The chances of of finding an identical substitute are slim, so you will have to decide which numbers are important, and how closely they must match. 

Top of the list is Absolute Maximum Ratings. These must never be exceeded, or the device will fail. The perfect replacement would have the same or higher ratings, but they could be lower provided that your circuit doesn't come close to them. 

The 2N3904 is rated for a maximum of 40V between Collector and Emitter, and 200mA Collector current. Your circuit is only powered with 9V, and the current passing through each transistor is limited to less than 20mA, so any replacement that can handle eg. 20V and 100mA will be fine.

Next is Electrical Characteristics. Depending on the application, some may be more important than others. Your circuit compares a slowly changing DC voltage to an adjustable reference voltage, and switches on one of two LEDs. So you don't have to worry about high frequencies, AC signals, or switching speed, and you have plenty of voltage available so saturation voltage is not critical. 

That leaves DC current gain as the essential parameter that must be duplicated. But confusingly, the datasheet doesn't provide a single number. Instead you are given a range with minimum, maximum, and perhaps 'typical' values for different currents and voltages. Why so many numbers? The reason relates to how transistors are made. The diffusion process that creates its elements is not precise, so every transistor that is produced has different characteristics. The manufacturer may sort them and label similar units with the same part number, but they don't throw away any that aren't identical because that would make the 'perfect' remainders too expensive. 

At 10mA Collector current the 2N3904's current gain could be anywhere between 100 and 300. Any substitute that is within or close to that range should be fine (assuming the circuit was designed to accommodate such a wide variation). In your circuit higher gain is better, but 100 is plenty enough. So just look for a substitute that has HFE of at least 100 at an IC of around 10mA, and you should be OK.

Finally, before settling on a particular part you might want to check its Packaging - case style, lead designations etc. The 2N3904 comes in a TO-92 case with leads in the order C,B,E. Some equivalent transistors have the opposite pinout (E,B,C) and some are B,C,E. This won't be a problem so long as you are aware of the difference, and refer to the datasheet of the part you are using when wiring up the circuit.