Train is not always the cheapest. Be sure to check both buses and trains. Also, note the length varies greatly when choosing bus or train on certain routes. It is a reasonable assumption that train would be faster and cheaper but this is not always the case. One more thing, there are different types of trains and each of them will have at least 2 different classes of service.
There are plenty of hostel review websites out there, be sure to check them out because they have the latest reviews and hostel quality can change over time. I have one reccomendation for you and that is for you to stop in Cesky Krumlov, Czech Republic on your way from Vienna to Prague. It is a wonderful medieval town and although it is touristy, you will definetly love it. Double rooms in a pension can be had for $20/room. Hostel beds were between $7-$10. A day or two is enough but somehow people allows stay longer because they just love it there. Enjoy your travels...