0% found this document useful (0 votes)
9 views17 pages

Group 3

The document discusses various methods for representing algorithms, including narrative, pseudocode, and flowcharts, highlighting their advantages and disadvantages. It also outlines the stages of the compilation process, programming languages suitable for web and game development, and the differences between parallel processing and multi-core systems. Additionally, it covers variable declaration and decision logic in C++ and JavaScript, providing examples of both languages.

Uploaded by

Giaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views17 pages

Group 3

The document discusses various methods for representing algorithms, including narrative, pseudocode, and flowcharts, highlighting their advantages and disadvantages. It also outlines the stages of the compilation process, programming languages suitable for web and game development, and the differences between parallel processing and multi-core systems. Additionally, it covers variable declaration and decision logic in C++ and JavaScript, providing examples of both languages.

Uploaded by

Giaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

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.

04 Diagram showing Flowchart


05
Stages in the compilation
process.
The compilation process consists of several stages that transform source code into machine code. These stages
include:

1. Lexical Analysis (Scanning)


• The compiler scans the source code and converts it into a sequence of tokens.
• It removes whitespace and comments.
• Example: int x = 10; is broken into tokens like int, x, =, 10, and ;.

2. Syntax Analysis (Parsing)


• The tokens are checked against grammar rules to ensure correct syntax.
• A syntax tree (parse tree) is generated.
• Example: Detecting missing semicolons or incorrect parentheses.

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.

7. Code Linking and Assembly


• Resolves references to external libraries and functions.
• Converts assembly code into executable machine code.

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.

2. CSS (Cascading Style Sheets) 3. JavaScript


• Type: Styling language. • Type: Front-end and back-end scripting language.
• Purpose: Controls the visual appearance of web • Purpose: Adds interactivity and dynamic behavior to
pages. web pages.
• Features: • Features:
⚬ Applies colors, fonts, and layouts to HTML ⚬ Can update web page content without reloading.
elements. ⚬ Works with APIs to fetch and display real-time data.
⚬ Supports responsive design, ensuring sites work on ⚬ Widely supported by browsers and used with
different screen sizes. frameworks like React and Angular.
⚬ Enables animations and transitions for smoother
user experiences. 07
Game 08
Development
Game development requires languages that can
handle graphics rendering, physics, and user
interaction.
2. C#
1. C++
• Type: Object-oriented programming language.
• Type: Object-oriented programming language.
• Purpose: Used primarily in Unity for cross-platform game
• Purpose: Powers high-performance games, especially
development.
AAA titles.
• Features:
• Features:
⚬ Easier to learn than C++, with a structured and
⚬ Provides direct hardware access for optimized
readable syntax.
performance.
⚬ Supports game mechanics like physics and
⚬ Used in Unreal Engine for 3D game development.
⚬ Offers memory management for precise control animations.
⚬ Enables rapid prototyping and development of 2D and
over game resources.
3D games.

3. JavaScript (Three.js, Babylon.js) 4. Python (Pygame)


• Type: Scripting language for web-based games. • Type: High-level programming language.
• Purpose: Creates browser-based games using HTML5 • Purpose: Used for 2D game development, especially for
and WebGL. beginners.
• Features: • Features:
⚬ Allows real-time game rendering in web browsers. ⚬ Simple and easy-to-read syntax, making it accessible
⚬ Works well for interactive educational games and for new developers.
simple online multiplayer games. ⚬ Strong support for game logic and AI-driven
⚬ Enables integration with cloud-based services for characters.
online gaming. ⚬ Works well for prototyping and indie game
development.
09

Storage devices: capacity, access speed,


access method, portability.

Capacit Access Speed Access Method Portabilit


y y
Solid State 500GB - 4TB
500 - Direct Access High
Drive
3500MB/s Portability
Hard Disk Up to 15 TB
Drive (fixed)
30-150MB/s Direct Acess Not portable
Hard Disk Up to 16TB
Drive
(removable)
Movable Hard disk drive:
Fixed Hard Disk Drive:
The access time(time taken to
get data) from a spinning hard
Due to all the tracks having a read\write head, 10
the time taken to access the data and
disk depends on:
instructions is reduced, and the seek time is
eliminated.
• Seek time- the amount of
time it takes the head to get
the correct track

• Rotational delay/latency
time- how long it takes for
the data to rotate under the
head

• Transmission time- the time


taken to read the data and
transmit it to the CPU

Solid State Drive:


Solid State Drive(SSD) stores data electronically rather
than magnetically, it is also non-volatile and doesn’t
contain any moving parts. This results in faster data
transfer and input/output.
Define parallel processing, and multi-core
systems.
11
Parallel Processing
Parallel processing is where a computer system uses two or more processors or CPUs simultaneously to handle the various
components of a single activity or instruction. Systems can reduce a program’s execution time by dividing a task’s many parts
among several processors, with the program executing totally at the end of all it’s components being processed.

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.

Decision Logic: There are two mains types of loops in C++:


A conditional statement executes code based on certain pre- 1. Bounded - The number of times the code will
set conditions. loop is known (predetermined). Eg. For loop
There are many decision logic statements in C++. Most
notably: if statement, if-else statement, else-if and switch. 2. Unbounded - The number of times the code
will loop is unknown. Eg. While loop
The general format for an if statement conditional is:
if (condition) { Common C++ loops:
//code executed only when the condition is true • For loop - Loops for a certain number of times
} • While loop - Loops while a condition is met
//code after if statement • Do while loop - Executes at least once then
checks condition for loop
13
In 14

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

// If statement to check if the number is positive if (number > 0) {


if (number > 0) { console.log("You entered a positive number.");
cout << "You entered a positive number." << } else if (number < 0) {
endl;
console.log("You entered a negative number.");
} else if (number < 0) {
} else {
cout << "You entered a negative number." <<
console.log("You entered zero."); }
endl;
} else {
cout << "You entered zero." << endl; // Loop to print numbers from 1 to 5
} console.log("Counting from 1 to 5:");
for (let i = 1; i <= 5; i++) {
// Loop to print numbers from 1 to 5 console.log(i);
cout << "Counting from 1 to 5:" << endl; }
for (int i = 1; i <= 5; i++) {
cout << i << " "; 15
}
Thank You!

You might also like