Caie A2 Level Computer Science 9618 Theory v1
Caie A2 Level Computer Science 9618 Theory v1
ORG
CAIE A2 LEVEL
COMPUTER
SCIENCE (9618)
SUMMARIZED NOTES ON THE THEORY SYLLABUS
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
TYPE
ENDTYPE
<main identifier>
ENDTYPE
<assignment value> ← <identifier>^
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
==Serial files:== contains records that have no defined different key, the next position in the file is used. this
order. A text file may be a serial file where the file has is why a search will involve direct access possibly
repeating lines which are defined by an end of line followed by a limited serial search. That's why it's
character(s). There's no end of record character. A record considered partly sequential and partly serial.
in a serial file must have a defined format to allow data to File access:
be input and output correctly. To access a specific record, The value in the key field is submitted to the hashing
it has to go through every record until found. algorithm which then provides the same value for the
File access:
Successively read record by record until the position in the file that was provided when the algorithm
data required is found thus very slow.
Uses: was used at the time of data input. It goes to that hashed
Batch processing position and through another short linear search because
Backing up data on magnetic tape of collisions in the hashed positions. Fastest access.
Banks record transactions involving customer To edit/delete data:
accounts every time there is a transaction Only create a new file if the current file is full. A deleted
==Sequential files:== has records that are ordered and is record can have a flag set so that in a subsequent reading
suited for long term storage of data and thus is process the record is skipped over. This allows it to be
considered an alternative to a database. A key field is overwritten.
required for a sequential file to be ordered for which the Uses:
values are unique and sequential. This way it can be Most suited for when a program needs a file in which
easily accessed. A sequential database file is more individual data items might be read, updated or deleted.
efficient than a text file due to data integrity, privacy and
less data redundancy. A change in one file would update Factors that determine the file
any other files affected. Primary keys from the
DBMS(database management system) need to be unique organization to use:
but not ordered unlike the key field from the sequential
files which need to be ordered and unique. A particular How often do transactions take place, how often does
record is found by sequentially reading the value of the one need to add data?
key field until the required value is found. How often does it need to be accessed, edited, or
File access: deleted?
Successively read the value In the key field until the
required key is found. 1.3. Real numbers and normalized
To edit/delete data:
Create a new version of the file. Data is copied from the
floating-point representation
old file to the new file until the record is reached which
Real number: A number that contains a fractional part.
needs editing or deleting. For deleting, reading and
Floating-point representation: The approximate
copying of the old file continue from the next record. If a
representation of
a real number using binary digits.
record has been edited, the new version is written to the
new file and the remaining records are copied to the new Format: Number = ±Mantissa × BaseExponent
file. Mantissa: The non-zero part of the number.
==Direct access/random access files:== access isn't Exponent: The power to which the base is raised to in
defined by a sequential reading of the file(random). It's order
to accurately represent the number.
well suited for larger files as it takes longer to access Base: The number of values the number systems allows a
sequentially. Data in direct access files are stored in an digit to
take. 2 in the case of floating-point
identifiable record which could be found by involving representation.
initial direct access to a nearby record followed by a
The floating point representation stores a value for the
limited serial search. The choice of the position chosen
mantissa and a value for the exponent.
must be calculated using data in the record so the same
A defined number of bits are used for what is called the
calculation can be carried out when subsequently there's
significant/mantissa, +-M. Remaining bits are for the
a search for the data. One method is the hashing
exponent, E. The radix, R is not stored in the representation
algorithm which takes the key field as an input and
as it has an implied value of 2(representing 0 and 1's).
If a
outputs a value for the position of the record relative to
real number was stored using 8 bits: four bits for the
the start of the file. To access, the key is hashed to a
mantissa and four bits for the exponent with each using two
specific location. This algorithm also takes into account
complement representation. The exponent is stored as a
the potential maximum length of the file which is the
signed integer. The mantissa has to be stored as a fixed point
number of records the file will store.
real value.
The binary point can be in the beginning after the
eg: If the key field is numeric, divide by a suitable large
first bit(immediately after the sign bit) or before the last bit.
number and use the remainder to find a position. But
The former produces smaller spacing between the values
we won't have unique positions. If a hash position is
calculated that duplicates one already calculated by a
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
that can be represented and is more preferred. It also has a Usually, the choice for the total number of bits will be
greater range than the fixed representation. provided as an option when the program is written,
however, the split between the two parts will have been
determined by the floating point processor.
If there were a choice, it's convenient to note that
increasing the number of bits for the mantissa would give
better precision but would leave fewer bits for the
exponent thus reducing the range of possible values and
vice versa.
For maximum precision, it is necessary to
normalize a floating point number.
Optimum precision will only be made once full use is
made of the bits in the mantissa therefore using the
largest possible magnitude for the value represented by
the mantissa.
Also, the two most significant bits must be different. 0 1
for positives and 10 for negatives.
-they both equal 2 but the most precise is the second one
with the, higher bits in the mantissa.
\
0.125 * 2^4 = 2 0 001 0100
0.5 * 2^2 = 2 0 100 0010
-For negatives.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
eg: One use of floating point numbers are in extended packets to hold all of the data. Each packet consists of a
mathematical procedures involving repeated calculations like header plus the user data.
TCP needs to ensure safe
weather forecasting which uses the mathematical model of delivery and that any response is directed back to the
the atmosphere. application protocol. The header has a port number
which identifies the application layer protocol at the
sending and receiving end system (however the TCP isn't
2. Communication and concerned with the receiving end system). If the packet is
one of a sequence, a sequence number is included to
Internet technologies ensure eventual correct reassembly of the user data. The
TCP is connection oriented, initially just one packet of a
2.1. Protocols sequence is sent to the network layer. Once the
connection has been established, TCP sends the other
Protocols are essential for successful transmission of data packets and receives response packets containing
over a network. Each protocol defines a set of rules that must acknowledgements. This allows missing packets to be
be agreed between sender and receiver. At the simplest identified and resent.
level, a protocol could define that a positive voltage TCP/IP Suite: A common protocol used to send data over
represents a bit with value 1. At the other extreme, a a
network.
protocol could define the format of the first 40 bytes in a Protocols are split into separate layers, which are
packet.
The complexity of networking requires a very large arranged as
a stack.
number of protocols, a protocol suite is a collection of They service each other thus maintaining the flow of
related protocols. TCP/IP is the dominant protocol suite for the data.
internet usage. Layer: A division of the TCP/IP suite.
Stack: A collection of elements/protocols/layers.
Protocol: A set of rules governing communication
between
computers.
Ensures the computers that communicate understand
each other.
MAC address: A unique number assigned to each device’s
networking hardware across the world.
IP address: A unique number assigned to each
node/networking
device in a network.
Port number: A software-generated number that specifies
an
application or a process communication endpoint
attached to an IP
address.
IP: Internet Protocol – The function of the network layer,
and the IP, is to ensure correct routing over the internet.
To do so, it takes the packet received from the transport Layer Purpose
layer and adds a further header containing the IP Application Encodes the data being sent
addresses of both the sender and receiver. To find the IP Adds IP addresses stating where the
Network/Internet
address of the receiver, the DNS system can be used to data is from and where it is going
find the address corresponding to the URL supplied in the Adds MAC address information to
user data. The IP packet(datagram) is sent to the data link specify which hardware device the
layer and therefore to a different protocol suite. The data Link message came from and which
link layer assembles datagrams into frames. Transmission hardware device the message is
now begins. Once the IP packet has been sent to the data going to
link layer, IP has no further duty. IP is a connectionless
Enables the successful transmission
service so if it receives a packet which contains an Physical
of data between devices
acknowledgement of a previously sent packet, it will
simply pass the packet on to TCP with no awareness of
When a message is sent from one host to another:
the content.
Sender side: Application Layer
TCP: Transfer Control Protocol. If an application is
Encodes the data in an appropriate format.
running on an end system where a message is to be sent
Sender side: Transport Layer
to a different end system the application will be
The data to be sent is broken down into smaller
controlled by an application layer protocol. The protocol
chunks known as
packets
will transmit the user data to the transport layer, the TCP
Sender side: Network Layer
operating in the transport layer now has to take
IP addresses (sender and receiver) and a
responsibility for ensuring the safe delivery of the
checksum are added to
the header
message to the receiver. To do this it creates sufficient
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
download rare chunks for preference. Each time a 6. Client sends an encrypted message to the server
rare chunk is downloaded it automatically becomes using the server’s public key.
less rare. 7. The server can use its private key to decrypt the
3. How do peers encourage other peers to provide message and get data needed for generating
content rather just using the protocol to download for symmetric key .
themselves? This answer requires dealing with the 8. Both server and client compute symmetric key (to be
free riders/leachers who only download. The solution used for encrypting messages) // session key
is for a peer to initially randomly try other peers but established.
then to continue to upload to those peers that 9. The client sends back a digitally signed
provide regular downloads. If a peer is not acknowledgement to start an encrypted session.
downloading or downloading slowly, it will eventually 10. The server sends back a digitally signed
be isolated/choked. acknowledgement to start an encrypted session.
Transport Layer Security (TLS) Star topology: A network topology in which each
workstation is
connected to a central node/connection
TLS(transport layer security) protocol: Purpose of TLS is to point through which the
network is established.
provide for secure communication over a network, maintain The central node (hub) re-directs and directs the
data integrity and add an additional layer of security. TLS packets
according to the data traffic and their
provides improved security over SSL(secure sockets layer). recipient.
TLS is composed of two layers: record protocol and Wireless networks: A computer network that uses
handshake protocol. TLS protects this information by using wireless data
connections between its network
encryption. It also allows for authentication of servers and components.
clients. A handshake process has to take place before any Bluetooth: A type of short-range wireless communication
exchange of data using the TLS protocol. The handshake that
uses
process establishes details about how the exchange of data Wi-Fi OR IEEE 802.11x.– A type of wireless communication
will occur. Digital certificates and keys are used. The that
allows the users to communicate within a particular
handshake process starts with:
area/ access
internet.
1. The client sending some communication data to the
Component Purpose in a LAN
server.
Allows different networks to
2. The client asking the server to identify itself. Switch
connect
3. The server sending its digital certificate including the
public key. Directs the incoming packets
Router
4. The client validates (the server’s) TLS Certificate. into
5. The client sends its digital certificate (to the server if
requested).
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Component Purpose in a LAN for the sender and receiver and is the reason they are
Provides a medium for the called the MAC addresses.
storage, sharing of usage of
Servers
files and applications for its Hardware Connection Device
users
Consists of the electronic An end system on an ethernet LAN needs a network
Network Interface Cards circuitry required to interface card(NIC). Each NIC has a unique physical
(NICs) communicate with other address, MAC address. The end system itself has no
networks/devices. identification on the network. If the NIC is removed and
inserted into a different end system, it takes the address
Ethernet: an array of networking technologies and with it.
The simplest device used for the center of the star
systems used
in local area networks (LAN), where
topology LAN is the hub which ensures that any incoming
computers are connected within a
primary physical
communication is broadcast to all connected end
space.
systems. However, the use of a hub is not restricted to
CSMA/CD:
Standard ethernet was implemented on a LAN configured supporting an isolated network, it can have a hierarchical
configuration with one hub connected to other hubs,
as a bus or a star topology with a hub as the central
which support individual LANs. A hub can also have a
device where the transmission was broadcast in a
built in broadband modem which allows all of the end
connectionless service.
Because of the broadcast
user systems on the LAN to have an internet connection
transmission, there was a need for the access to the
shared medium by end systems to be controlled. If there when this modem is connected to a telephone line.
A switch can function as a hub but it's more intelligent
wasn’t any control, two messages sent at the same time
and can keep track of the addresses of connected
would collide and each message would be corrupted. The
devices, this allows a switch to send an incoming
method adopted was CSMA/CD(carrier sense multiple
transmission to a specific end system as a unicast. This
access with collision detection). If a frame was being
transmitted there was a voltage level on the ethernet reduces the amount of network traffic compared to the
hubs.
cable which could be detected by an end system. If this
A router is the most intelligent of the connecting devices.
was the case, the protocol defined at a time that the end
It can function as a switch and make decisions about
system had to wait before it tried again. However
because two end systems could have waited then both which device it will transmit a received transmission to.
decided to transmit at the same time collisions could still The main use of routers is in the backbone fabric of the
internet. Nearer to the end systems, a router may
happen thus there was also a need to incorporate a
function as a gateway, as a network address translation
means for an end system to detect a collision and to
box or be combined with a firewall.
discontinue transmission if a collision occurred. Before
transmitting a device checks if the channel is busy. If it is
busy the device waits, if channel free data is sent. When
WIreless networks
transmission begins the device listens for other devices
The dominant technology is no longer using cables now, it's
also beginning transmission. If there is a collision,
wireless. The following are discussed in order of increasing
transmission is aborted/ transmitting a jam signal. Both
scale of operation.
devices wait a (different) random time, then try again.
The
modern implementation of ethernet is switched. The star Bluetooth: this has been standardized as IEEE802.15.
configuration has a switch as the central device which Communication is by short range radio transmission in a
controls transmission to specific end systems. Each end confined area. A Bluetooth LAN is an ad hoc network thus
system is connected to the switch by a full duplex link so no defined infrastructure and network connections are
no collision is possible along the link and therefore created spontaneously. eg Wireless keyboard
CSMA/CD is no longer needed as collisions are Wi-Fi: aka WLAN and is a wireless ethernet known as
impossible.
Ethernet is the most likely protocol to be IEEE802.11. This is a wireless LAN protocol which uses
operating in the data link layer when the IP in the radio frequency transmission. Mostly a Wi-Fi LAN is
network layer sends a datagram to the data link layer. centered on a wireless access point in an infrastructure
When the data link layer uses ethernet, the protocol network and not an ad hoc network. The wireless access
defines 2 sub layers. The upper one is the logical link point communicates wirelessly with any end systems that
layer which handles flow control, error control and part of have connected to the device. It also has a wired
the framing process. The lower is the media access connection to the internet. •WiMAX(worldwide
control(MAC) sublayer which completes the framing interoperability for microwave access): an IEEE802.16 is a
process and defines the access method. The MAC layer protocol for a MAN or WAN. It's designed for use by
transmits the frames that contain the physical address PSTNs to provide broadband access to the internet
without having to lay underground cables. Local
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
A B Output
3.1. Logic gates & circuit design 0 0 1
0 1 1
Logic gates: A component of a logical circuit that can perform 1 0 1
a
Boolean operation (logical function).
1 1 0
AND Gate: A.B = X
A B X
0 0 0
0 1 0
1 0 0
1 1 1
NOR Gate: A + B =X
A B Output
0 0 1
0 1 0
1 0 0
1 1 0
OR Gate: A + B =X
A B Output
0 0 0
0 1 1
1 0 1
1 1 1
A B Output
0 0 0
0 1 1
1 0 1
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
A B Output Adsorption
1 1 0 A. (A + B ) = A
A + A.B = A
De Morgan’s Law
(A.B ) = A + B
(A + B) = A.B
{S15-P33} Question: 5
a) i. Complete the truth table for this logic circuit:
Circuit 1: X =
Circuit 2: X =
Input Output
ii. Write the De Morgan’s Law which is shown by your
A B S C
answers to
part (a) and part (b)(i).
0 0 0 0
0 1 1 0 c) Write the Boolean algebraic expression corresponding to
the
following logic circuit:
1 0 1 0
1 1 0 1
3.2. Boolean algebra d) Using De Morgan’s laws and Boolean algebra, simplify your
answer to
part (c).
Double Complement: A =A
Identity Law Show all your working.
1.A = A Solution:
0 + A = A Part a):
Null Law
0.A = 0 i. Assume that the letter “C” equates to the first
1 + A = 1 function/logic gate.
Idempotent Law A+B =C
A.A = A
A B C
A+A=A
Inverse Law 0 0 0
A.A = 0 0 1 1
A + A = 1 1 0 1
Commutative Law 1 1 1
A.B = B.A
A + B = B + A 0 = 0
$$
Associative De Morgan's law: the inverse of a Boolean product becomes
(A.B).C = A.(B.C) the sum of the inverses of the individual values in the
(A + B) + C = A + (B + C) product. The inverse of a Boolean sum is the product of the
Distributive Law individual inverses.
A + B.C = (A + B).(A + C) Not (A and B) is the same as Not A or Not B.
A. (B + C ) = A.B + A.C
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Not (A or B) is the same as Not A and Not B. Karnaugh maps: a method of obtaining a Boolean algebra
expression from a truth table involving the
RISC processors give the opportunity of providing efficient Benefits of using Karnaugh Maps:
pipelining. Pipelining is instruction level parallelism. Its Minimises the number of Boolean expressions.
underlying principle is that the fetch decode execute cycle Minimises the number of Logic Gates used, thus
can be separated into a number of stages. One of the providing a more
efficient circuit.
possibilities include: Methodology
Try to look for trends in the output, thus predict the
1. Instruction fetch (IF)
presence
of a term in the final expression
2. Instruction decode (ID)
Draw out a Karnaugh Map by filling in the truth table
3. Operand fetch (OF)
values
into the table
4. Instruction execute (IE)
Column labelling follows Gray coding sequence
5. Result write back (WB)
Select groups of ‘1’ bits in even quantities (2, 4, 6 etc),
PIPELINING FOR FIVE STAGE INSTRUCTION HANDLING if
not possible then consider a single input as a group
Note: Karnaugh Maps wrap around columns
Within each group only the values that remain
constant are
retained
{S17-P31} Question: 3
Consider the following logic circuit, which contains a
redundant logic
gate.
clock cycle 6 the first instruction has left the pipeline, the last 1
1
1
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Scheduling ensure that the computer system is able to An OS has to be structured in order to provide a platform for
serve all
requests and obtain a certain quality of service. resource management and the provision of facilities for
Interrupt: users. The logical structure provides 2 modes of operation:
Causes OS kernel to invoke ISR
The kernel may have to decide on priority 1. The user mode is the one available for the user or an
Register values stored in PCB application program.
Reasons 2. Privileged/kernel mode has the sole access to parts of
Errors the memory and to certain system functions that the
Waiting for I/O user mode cant access.
Scheduler halts process
Low-level scheduling: Allocation specific processor 4.3. Virtual machine
components
to complete specific tasks.
Low-level scheduling algorithms Virtual machine:
Preemptive: Will stop the process that would have Process interacts with software interface provided by
otherwise have
continued to execute normally. the OS.
This provides exact copy of hardware.
First-come-first-served OS kernel handles interaction with actual host
Non-preemptive hardware
FIFO(First In First Out) queue
Round-robin Pros Cons
Allocates time slice to each process Allows more than one OS to Performance drop from
Preemptive run on a system native OS
Can be FIFO queue Allows multiple copies of the Time and effort needed for
Does not prioritize same OS implementation is high
Priority-based
Most complex Examples and usage:
Priorities re-evaluated on queue change
Priority calc. Requires computation Used by companies wishing to use the legacy software on
Criteria for priority time newer hardware and server consolidation companies
Estimated time of execution Virtualizing machines allows developers to test
Estimated remaining time of execution applications on a multitude of systems without having to
Is the CPU/IO bound? make expensive hardware purchases.
Length of time spent in waiting queue
Paging:
4.4. Translation software
Process split into pages, memory split into frames
Lexical analysis: The process of converting a sequence of
All pages loaded into memory at once
characters to a sequence of tokens.
Virtual memory: Tokens: Strings with an assigned meaning
No need for all pages to be in memory Syntax analysis: The process of double-checking the code
CPU address space thus larger than physical space for
grammar mistakes (syntax errors).
Addresses resolved by memory management unit Code generation: The process by which an intermediate
Benefits code is
generated after syntax analysis.
Not all of the program has to be in memory at Optimization: A process in which the code is edited to
once make
improvements in efficiency.
Large programs can be run with or without large
physical
memory
Process
All pages on disk initially
One/more loaded into memory when process
‘ready’
Pages replaced from disk when needed
Can be done with FIFO queue or usage-
statistics based
algorithm
Disk thrashing: Perpetual loading/unloading of pages due
to a
page from disk immediately requiring the page it
replaced**.**
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
and can therefore decrypt the message. This is not for individuals, the public key must be made available in a way
confidential messages but can be used to verify who the that ensures authentication. The would-be receiver would
sender was. Only the sender has the private key and the need to obtain the digital certificate to allow safe public key
public keys only work with that one specific private key. delivery:
Therefore, used this way, the message has a digital
signature identifying the sender. However the digital 1. An individual(A) who is a would-be receiver and has a
signature is associated with an encryption of the whole public-private key pair contacts a local CA.
message. 2. The CA confirms the identity of A.
Cryptographic one way hash function creates from the 3. A's public key is given to the CA.
message a number, uniquely defined for the particular 4. The CA creates a public-key certificate(a digital
message, a digest. The private key is used as a signature certificate) and writes A's key into this document.
for this digest. This speeds up the process of confirming 5. The CA uses encryption with the CA's private key to
the sender's identity. add a digital signature to this document.
It is assumed that the message is transmitted as plaintext 6. The digital certificate is given to A.
together with the digital signature as a separate file. The 7. A posts the digital certificate on a website.
same public hash key function is used that was used by
![PROCESSES INVOLVED IN OBTAINING A DIGITAL
the sender so the same digest is produced if the message
CERTIFICATEThe individual places the digital certificate on
has been transmitted without alteration. The decryption
that person's website but you can post it on a website
of the digital signature produces an identical digest if the
designed specifically for keeping digital certificate data.
message was genuinely sent by the original owner of the
Alternatively, a digital certificate might be used solely for
public key that the receiver has used. This allows the
authenticating emails. Once a signed digital certificate has
receiver to be confident that the message is both
been posted on a website, any other person wishing to use
authentic and unaltered. However someone might forge
A's public key downloads the signed digital certificate from
a public key and pretend to be someone else. Therefore,
the website and uses the CA's public key to extract A's public
there is a need for a more rigorous means of ensuring
key from the digital certificate. For this overall process to
authentication. This can be provided by a Certification
work there is a need for standards to be defined.
Authority (CA) provided as part of a Public Key
Infrastructure (PKI).
5.3. Encryption protocols
SSL and TLS encryption protocols are used in client-server
applications.
SSL(Secure Socket Layer) and TLS(Transport Layer
Security) are two closely related protocols providing
security in using the Internet. TLS is a slightly modified
version of SSL. The main use of SSL is in the client server
application. The interface between an application and
TCP uses a port number. In the absence of a security
protocol, TCP services an application using the port
number. The combination of an IP address and a port
number is the socket. When the SSL protocol is
implemented it functions as an additional layer between
TCP in the transport layer and the application layer. When
the SSL protocol is in place, the application protocol HTTP
becomes HTTPS.
Provides:
Encryption
Compression of data
Integrity checking
Connection process:
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Virus: tries to replicate inside other executable programs. Split the data into two or more predefined groups. Example:
Worm: runs independently and propagates to other spam email filtering where emails are split into either spam
network hosts. or not spam.
Spyware: collects info & transmits to another system.
Phishing: email from seemingly legit source requesting
confidential info.
Pharming: setting up a bogus website that appears to be
legit.
6. Artificial Intelligence
6.1. Intro
Artificial Intelligence is the ability for computers perform
tasks that usually only a human would be able to do, such
as decision making, speech recognition, etc.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Limitations
A lack of heuristics
Dijkstra’s algorithm has no notion of the overall shortest
direction to the end goal, so it will actually spend a lot of
Non time searching in completely the wrong direction if the
Linear Regression routes in the wrong direction are shorter than the route
Used where there is a correlation but it is not linear in the correct direction. It will find the shortest route in
the end but it will waste a lot of time.
In small networks this isn’t a problem but when you have
massive networks (like road networks or the internet)
then it will result in massive inefficiencies.
Negative Weighted Costs
On physical networks with physical distances you can’t
have negative weights, but one some networks where
you are calculating costs you might have negative costs
for a particular leg. Dijkstra’s cant handle these negative
costs.
Directed networks
Dijkstra’s algorithm doesn’t always work best when there
are directed networks (such as motorways that only run
Clustering
in one direction.
Split the data into smaller groups or clusters based on
certain features. The programmer might specify a target
number of groups or let the algorithm decide. 6.4. A* Algorithm
One of the biggest problems with Dijkstra’s algorithm is
that it is that it has the potential to be inefficient when
searching for the shortest path, because it just looks for
the next shortest leg.
A* is an informed search algorithm, or a best-first search,
meaning that it is formulated in terms of weighted
graphs: starting from a specific starting node of a graph,
it aims to find a path to the given goal node having the
smallest cost (least distance travelled, shortest time, etc.).
It does this by maintaining a tree of paths originating at
the start node and extending those paths one edge at a
time until its termination criterion is satisfied.
At each iteration of its main loop, A* needs to determine
which of its paths to extend. It does so based on the cost
of the path and an estimate of the cost required to
extend the path all the way to the goal.
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
Trained model is ready to test \n The trained model can then be deployed \n
Un supervised Learning
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
7. Computational thinking
and problem-solving
7.1. Big O Notation
What is Big O Notation?
Time Complexity
Time complexity refers to the growth in the number of
instructions executed (and therefore the time taken) as
the length of the array to be searched increases.
Space Complexity
Space complexity refers to the growth in the size of
memory space that is required as the length of the array
is increased.
Algorithm Performance
There are a number of factors that affect the
performance of search / sorting algorithms. Some
algorithms perform well with high entropy (randomness)
data, other algorithms work better when the data is
partially sorted in some manner. This means that no one At each iteration, insertion sort removes one element from
the input data, finds the location it belongs within the sorted
algorithm works best in every situation and the nature of
the data being sorted needs to considered. list, and inserts it there. It repeats until no input elements
remain.
Merge Sort Lighter bubbles rise to the top, Heavier ones sink to the
bottom.
Divide and Conquer Paradigm
7.3. Recursion
Recursion is a function which it call itself
WWW.ZNOTES.ORG
CAIE A2 LEVEL COMPUTER SCIENCE (9618)
WWW.ZNOTES.ORG
CAIE A2 LEVEL
Computer Science (9618)