Group 3
Group 3
Liam Bidaisee
Chakera Baker
Malachi Johnson
Jovaun Baptiste
Giana Schneider
Dominic Baptiste
02
Narrative vs Flowcharts
vs Psuedocode.
Ways of Representing Algorithms:
1. Narrative (expressed in natural language:
English)
2. Pseudocode (mixture of natural language and
mathematical notation)
3. Flowchart(diagrams that use particular symbols
+ arrows to represent algorithms)
03
Narrative Pseudocode
• Algorithms are expressed in words, forming • Used by programmers to develop algorithmic sol’ns &
is universal for programmers because it DOES NOT
complete sentences using natural language.
DEPEND ON A PARTICULAR PROGRAMMING
• Describing the concept of the algorithm & the LANGUAGE
story defines the transition over time. • It is essentially English with some defined rules of
structure and some keywords that make it appear a bit
Example: Task Making Tea
like program code.
1. Boil water. Example Keywords:
2. Add tea bag to cup. • start and finish : BEGIN , END , or START , STOP
3. Pour water, add sugar/milk, stir. • selection : IF, THEN, ELSE, ENDIF
4. Serve. • repetition (pre-test) : WHILE, DO , ENDWHILE
• repetition (post-test) : REPEAT, UNTIL
Disadvantages:
• Difficult to write a complex algorithm this way. Guidelines for pseudocode:
• Keywords are written in capitals.
• Not clear how to create a computer language
• Structural elements come in pairs eg: for every BEGIN
description of an algorithm from a natural there must be an END, every IF must be an END IF,
language description of it. WHILE, ENDWHILE.
• Indenting is used to show structure.
• Each line of the algorithm is numbered.
Flowchart
• A diagrammatic method of representing entire
Table showing all the Flowchart symbols and what
algorithms.
they represent.
• Intuitive scheme of showing operations in boxes
connected by lines and arrows that graphically show
the flow of control in an algorithm.
• More useful to have a visual representation of an
algorithm.
3. Semantic Analysis
• Checks for logical and type-related errors.
• Ensures correct usage of variables, functions, and types.
• Example: Detecting type mismatches like adding an integer to a string.
4. Intermediate Code Generation 06
• Converts the syntax tree into an intermediate representation (IR).
• IR is easier to optimize and can be translated into multiple machine codes.
5. Optimization
• Improves performance by reducing unnecessary instructions.
• Example: Removing redundant calculations or loop unrolling.
6. Code Generation
• Converts the optimized intermediate code into machine code (assembly).
• Example: Converting high-level operations into CPU instructions.
These stages ensure that the source code can be easily and efficiently executed without errors.
Programming Languages suitable for
developing games and developing web
applications. 1. HTML (HyperText Markup Language)
• Type: Markup language (not a programming
Web Development language).
Web development involves creating websites and web • Purpose: Defines the structure of web pages.
applications. These languages are categorized into front- • Features:
end (what users see), back-end (server-side processing), ⚬ Uses tags (e.g., <h1>, <p>) to organize content.
and full-stack (both). ⚬ Supports multimedia like images, videos, and links.
⚬ Works with CSS and JavaScript to create interactive
websites.
• Rotational delay/latency
time- how long it takes for
the data to rotate under the
head
Traditionally( or serial processing), the processor is presented with a queue of instructions which it processes one by one and
outputs the respective processed data. The main problem with this type of computing is that there is a limitation on how fast
processors can be accelerated, basically a limitation on how much faster the computer system could process data, mainly due to
the heat they would generate(from their compact manufacturing), although there are others. Since this is virtually unavoidable
for most available processors, parallel processing was invented. This type of processing is more seen in older computers, as the
first step in handling the issue met with serial processing.
Examples Include:
1. The American Summit Computer-This computer is one of the most notable supercomputers worldwide mainly due to its
processing speed. It was designed by the Oak Ridge National Laboratory of the United States Department of Energy and has a
processing speed of 200 petaFLOPS, or 200 quadrillion operations per second. To put it into perspective, if every human on earth
accomplished one computation every second, it would take roughly ten months to accomplish what the Summit can do in one. It
requires 4,000 gallons of water per minute to cool and weighs 340 tons, and this is with the application of parallel processing. It’s
used primarily to better understand weather patterns, earthquakes, genetics, and physics and to create new materials to better
our lifestyles.
2. Laptops and Desktops- Another example of parallel processing is Intel processors, which run most high-power modern
computers. The HP Specter Folio and HP EliteBook x360’s Intel Core i5 and Core i7 CPUs each have four processing cores. The HP
Z8, among the most efficient workstations in the industry, contains 56 computing cores, allowing it to handle complex 3D
simulations and real-time 8K video editing.
12 Multi-core Systems
Not to be confused with multicore processing, a multicore system works in similar fashion to parallel
processing, however, multicore systems differ in one main respect. Multicore systems are systems with
multiple cores or processing units within a singular chip(a hardware element). These cores each work on a
seperate program simultaneously, creating the illusion of multiple processors, which is not the case.
These systems are mostly seen in newer model computers as they allow the greatest computing speed
through the execution of numerous programs at the same time, minimising the heat generated by a
processor during computation.
Examples Include:
1) Modern Desktop CPUs: Many processors from Intel and AMD, such as the Intel Core i7 or AMD Ryzen
series, are multicore systems. These processors typically have 4, 6, 8, or more cores to handle multiple
tasks simultaneously, improving performance for multitasking and “beefy” or resource-demanding
applications.
2) Smartphones: Most smartphones today, such as those running on Apple A-series, or Samsung Exynos
chips, feature multicore processors. These systems often have 4, 6, or 8 cores to handle multitasking,
gaming, and other demanding applications while maintaining efficiency.
3) Servers: High-performance servers, like those running Intel Xeon or AMD EPYC processors, often use
multicore systems with dozens of cores. These are designed to handle multiple concurrent workloads, large-
Declare Variables and Show Decision Logic
and looping constructs in C++ and
Javascript.
In C++
Declare
Looping
Variables:
The general format for declaring a variable in C+
+ is: Constructs:
A loop is a set of code which allows for
datatype variablename = value; instructions to be repeated for a set number of
Eg: int mynumber = 10; times or until a condition which governs the loop
Other datatypes are double, char, string and bool can no longer be met.
JavaScript
Declare Looping Constructs:
Variables:
The general format for declaring a variable in JS Loops in JS:
is: • For loop - loops through a block of code a number of
var variablename = value; times
Eg: var x = 5; • For In loop - loops through the properties of an object
Other Keywords used to declare in JS are: const • For Of loop - loops through the values of an iterable
(used for unchanged variables) and let (used object (eg array)
only when you can’t use const). • While loop - loops while a condition is met
• Do While loop - executes at least once then checks
Decision Logic: condition for looping
Basic conditional statements in JS are: if statement, if-else.
else-if and switch. JS Do While structure:
do {
The general format for an if-else statement conditional is: //block of code
if (condition) { }
//code executed only if the condition is true while (condition);
} else {
//code executed only if condition is false Example:
} do {
//code after if-else statement text += "<br>The number is " + i;
i++;
}
while (i < 10);
Code examples of both C++ and
Javascript
C++ JavaScript
#include <iostream>
Code
using namespace std; Code
// Prompt the user to enter a number
let number = prompt("Enter a number:");
int main() {
int number; // Convert input to a number
number = Number(number);
// Ask the user for input
cout << "Enter a number: "; // If statement to check if the number is positive, negative, or
cin >> number; zero