The registration program, in effect, lines up the whole student body and asks each student, in turn, a pair of questions. Each question depends on the answer to the one before it. The first question is "what class do you most want?" The second question is "what do you want if that one is unavailable?" Questions like that continue until the student gets one course. The program then goes to the next student in line. After working through the whole student body once when everyone has one class, the process is repeated until every student either has a second class or gives up trying to answer the questions. Each one of questions now starts with something like "given that you already have a certain class (or classes...)". The questioning continues until everyone either has a 3rd and 4th class or has run out of answers. Basically it registers one class at a time, to one student at a time, with the opportunity to specify at least one alternate class every time the preferred class is not available.
The purpose of WebTree is to gather all the answers in advance so you don't have to stand in line. WebTree gathers your preferences (your answers to questions) in the order in which you'll need them. The registration program then sorts out the results.