• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
55%
SHARE
TWEET

# Alice project 3 review

Helium Feb 25th, 2013 214 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. ALICE PROJECT 3 REVIEW
2.
3.
4. LOGIC STRUCTURE OF ALGORITHMS
5.         - Every computer is an algorithm - a step by step process
6.         - In modern OOP, each method is an algorithm
7.         - Algorithms are sequenced by default
8.         - steps in algorithm form a kind of sequential logic
9.
10. THREE MAJOR LOGICAL STRUCTURES IN ALGORITHMS:
11.         - branching routines
12.         - loops
13.         - linear sequences (No branch or loops)
14.
15.         These 3 elements are the building blocks for algorithms
16.
17. FLOW CHART: a diagram that shows the structure of an algorithm
18.         - rectangles represent algorithm
19.         - diamond shaped boxes represents branching
20.         - Oval shaped boxes represents beginning and ends
21.
22. LINEAR SEQUENCES:
23.         - clear starting and ending point
24.         - entry and exit conditions have to be clearly stated
25.                 What conditions need to exist before the sequence starts
26.                 What can we expect the situation when the sequence is finished
27.         - sequence of instructions must be complete
28.         - sequence of instructions need to be in the proper order
29.         - all instruction in the sequence must be correct and valid, a single mistake could cause the entire algorithm to fail
30.
31. BRANCHING ROUTINE (SELECTION SEQUENCES):
32.         - occurs whenever the flow of instructions in a computer program splits into separate paths
33.         - there must be a condition to determine which path the computer will follow each time the selection sequence is being executed (Binary branching splits in 2 paths, true or false)
34.         - there are 2 types of binary branching sequences:
35.                 binary bypass: an instruction is either executed or passed
36.                         Example: if <condition> do <instruction> else do <nothing>
37.                 binary choice: one of two instructions, NOT both, is executed.
38.                         Example: if <condition> do <instruction> else do <different instruction>
39.         MULTIPLE BRANCHING:
40.                 - a series of If/Else instructions
41.                 - it can always be rewritten as a series of nested binary branchings
42.                 Example:        If <condition> do
43.                                         <instruction>
44.                                 elseif <condition> do
45.                                         <instruction>
46.                                 else do
47.                                         <instruction>
48.
49. LOOPING SEQUENCES (REPETITION SEQUENCES):
50.         - in loops, word WHILE is used instead of IF
51.                 Example: while <condition (true)> do <instructions>
52.
53.                 ------[condition]---False--->
54.                   ^        |
55.                   |      True
56.                   |        V
57.                   ---[instruction]
58.
59.                 It will keep doing the instructions until the condition becomes false
60.         - loops have conditions that controls whether or not the repetition sequence will be executed
61.         - a set of instructions to be repeated in a loop is called a body of the loop
62.         PRETEST LOOPS - if test comes BEFORE the body of the loop
63.         POSTTEST LOOPS - if test comes AFTER the body of the loop
64.
65.                 --------[test]---False--->
66.                   ^        |
67.                   |      True                                   PRETEST LOOP
68.                   |        V
69.                   ---[instruction]
70.
71.                 --------[instruction]-->[test]---False--->
72.                     ^                     |
73.                     |                    True                   POSTTEST LOOP
74.                     |_____________________|
75.
76.         COUNT-CONTROLLED AND SENTINEL LOOPS:
77.                 Major 4 parts:
78.                 - Initialization: an instruction that sets the first value of the control variable
79.                 - Test: looks at the control variable to see if the loop should be executed
80.                 - Processing: instructions or set of instructions to be repeated in the loop
81.                 - Update: changes the value of the control variable each time it goes through the loop
82.
83.                         Example:
84.                         i = 1                   [Initialization]
85.                         while i < 5 do          [Test]
86.                         say i                   [Processing]
87.                         i = i + 1               [Update]
88.
89. BOOLEAN LOGIC
90.         The six different logical comparison operation in computer programming
91.                 - A equal B
92.                 - A does not equal B
93.                 - A is less than B
94.                 - A is greater than B
95.                 - A is less than or equal to B
96.                 - A is greater than or equal to B
97.
98.         3 basic operations:
99.                 AND:    Need 2 equal to be true
100.                         true and true = true
101.                         true and false = false
102.                         false and true = false
103.                         false and false = true
104.                 OR:     anyone is true is true
105.                         true or true = true
106.                         true or false = true
107.                         false or true = true
108.                         false or false = false
109.                 NOT:    opposite
110.                         not true = false
111.                         not false = true