Mindmap
Algorithmic Constructs
Inhalt der Mindmap
Algorithmic Constructs
Assignment
- Assignment is used to store the value of an expression into a variable.
- Pseudocode Example: DECLARE studentName SET studentName TO Bob
Selection and Conditions
- A selection statement uses a condition to select, or determine, the next line of the program that is to be executed.
- Pseudocode Example: CALCULATE totalCost IF (totalCost > $10) THEN OUTPUT 'no delivery charge' ELSE OUTPUT '$5 delivery charge' ENDIF OUTPUT 'thankyou'
Iteration (FOR Loop)
- Iteration is also called repetition and is used when something is repeated over and over again, so anything where the program goes round in a loop. Typically programmed using code such as WHILE, REPEAT and FOR statements. See the example of Pseudocode using a FOR loop to write out numbers 1 to 10:
- Pseudocode Example: DECLARE count SET count TO 0 FOR count = 1 to 10 OUTPUT count END FOR OUTPUT ‘finished’
- Iteration (WHILE Loop)
- In comparison, a WHILE loop is used to repeat while a condition is true or false. In this example, the WHILE loop will loop until a pile of items are all counted:
- Pseudocode Example: DECLARE count SET count TO 0 WHILE (there are items in a pile) ADD 1 TO count END WHILE OUTPUT the number of items
Modularisation
- Modularisation is used to reduce the complexity of a system by deconstructing it into independent units or modules.
- We use the term "function" as that is what they are called in most of the popular programming languages of today. Functions are important because they allow us to take large complicated programs and divide them into smaller manageable pieces that are more easily maintained.
- Pseudocode Example: FUNCTION delivery_charge CALCULATE totalCost IF (totalCost > $10) THEN OUTPUT ‘no delivery charge’ ELSE OUTPUT ‘$5 delivery charge’ ENDIF OUTPUT ‘thankyou’ END FUNCTION
Calculating
- Calculating involves performing mathematical or logical operations to derive results. It is a core part of algorithms that require data manipulation.
- # Example: Calculating the area of a rectangle length = 5 width = 3 area = length * width print(area) # Output: 15
Sequencing
- Sequencing ensures that instructions are executed in a specific order. It is the foundation of procedural programming, where each step follows logically from the previous one.
- # Example: Sequential steps print("Step 1: Start") print("Step 2: Process data") print("Step 3: End")
Accumulation
- Accumulation involves collecting or aggregating values over iterations or conditions. It is commonly used to compute sums, products, or other aggregates.
- # Example: Summing numbers in a list numbers = [1, 2, 3, 4, 5] total = 0 for num in numbers: total += num print(total) # Output: 15
Informationen
- Beschreibung
- Mindmap am Algorithmic Constructs, erstellt von Bryan John Ramos am 01/05/2026.
- Erstellt von
- Bryan John Ramos
- Aufrufe
- 0
- Bewertung