We know that the world's first computer program was written by Ada Lovelace in 1848. It would have run a theoretical computer called the Analytical Engine designed by Charles Babbage, but he never actually built the computer. However, computer programs are made up of data, flow charts, and calculations. People understood those things, at least some smart people did, long before the algorithms they produced were usable.
For example, if you had enough data, you could forecast the weather. British mathematician Lewis Fry Richardson compiled the necessary data in 1913 and worked out how to calculate the weather of the future. The problem was that the calculations took so long that the "forecast" had passed before it was predicted. If he had a computer, it would have worked much better. Various people worked out the same types of algorithms for playing chess, tabulating the census, and generating random numbers. They worked, but not well, because human calculation just isn't fast enough. Read about the algorithms that predated the computers that would make them work at Cracked.