Once again, the order is
incorrect, so it swaps 7 and 4. End of scan 1:
6 3 1 4 7
Scanning left to right again results in:
3 1 4 6 7
Scanning left to right again results in a correct ordering:
1 3 4 6 7
Write pseudocode for the bubble sort.
2.8 What is the bubble sort T?
2.9 How will the bubble sort compare for speed with the merge sort when the task is to sort 1,000,000 social
security numbers which initially are in random order?
30 ALGORITHMS [CHAP. 2
CHAPTER 3
Computer
Organization
VON NEUMANN ARCHITECTURE
Most computers today operate according to the ???von Neumann architecture.??? The main idea of the von
Neumann architecture is that the program to be executed resides in the computer??™s memory, along with the
program??™s data. John von Neumann published this idea in 1945.
Today this concept is so familiar it seems self-evident, but earlier computers were usually wired for a certain
function. In effect, the program was built into the construction of the computer. Think of an early calculator; for
example, imagine an old hand-cranked mechanical calculator. The machine was built to do one well-defined
thing. In the case of an old hand-cranked calculator, it was built only to add. Put a number in; crank it; get the
new sum.
Pages:
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89