You are on page 1of 2

[TMD presents Introduction to Computer Science · 2023.11.

23]
[PART ONE · Information Compilation]
GENERAL · Static variables in functions are allocated only once, values taken forward ·
Constant pointer cannot be reassigned to another memory location, constant reference is an
alias to an object and cannot be changed to another object
OOP · Inheritance: Acquiring all properties and behaviours of parent(s) · Polymorphism:
one task, different ways; changing superclass behaviour in subclass · Abstraction: Hiding
internal details, showing functionality · Encapsulation: Binding code and data into a
single unit · Overloading: Multiple functions of same name, with different implementations
· Public (seen from outside class) does not change, Protected (can be seen in inherited)
and Private (DEFAULT, seen only within class) do it (to Public and Private) · Friend of
class (must be declared in class first) can access private and protected · Friend
functions can access all private and protected · First (base -> derived) constructor, then
(derived -> based) destructor · Static variables do NOT belong to objects but are shared
by objects · CANNOT initialise value for static variable inside class constructor · Static
functions can only call other static methods, NOT non-static methods in same class
MACHINE LEARNING · Optimises decision to user object · Started in 80s · Supervised (X ->
Y) has two types: Regression for continuous, Classification for discrete · Unsupervised (X
-> ?) finds structure or distribution, has two types: Clustering to inherent group,
Association to make rules of large portions · Reinforcement maximises reward, minimises
penalty · Data mining is to search for information and patterns · Deep Learning is
inspired by artificial neural networks, from 2010s · Edge computing is a distributed
computing paradigm making necessary computation and data storage closer to devices where
it’s collected · Edge AI can be run at multiple network nodes to close data-proc. gap,
reducing bottlenecks and speed up apps
NETWORK AND IOT · Block diagram: Source -> Transmitter -> Transmission System -> Receiver
-> Destination · LANs include: Switched (Ethernet), Wireless, Asynchronous Transfer Mode
(ATM) · WANs include techs: circuit switching, packet switching, frame relay, ATM · TCP/IP
architecture: Application -> Transport -> Internet -> Data link (Network access) ->
Physical · IOT blocks: Do -> Learn -> Collect -> Collect -> Things · (Modern Access
Control – MAC) Protocol is combination of framing, flow control (restricting amount to
send) and error control (detecting/correcting) to achieve delivery of data between nodes ·
Synchronous (more complex but greater output) and Asynchronous (simpler, cheaper, low data
rate but large relative overhead) types · S-MAC and T-MAC: communications are synced in
time with two states: active and sleep, may waste energy · Receiver Initiated Cycled
Receiver (RICER): Receiver sends a BEACON, transmitter waits for it before sending DATA,
ACK is used to confirm communication · Extended versions of RICER: RICERn, ODMAC, SymMAC =
RICER + TICER · Noiseless channels [NONEXISTENT] have two types: Simplest (no flow/error
control) and Stop-and-Wait (1 frame/time, with ACK frames coming from other side) · Noisy
channels have three types w/ Auto Repeat: Stop-and-Wait, Go-Back-N, Selective Repeat
DATABASES · Physical and logical views of data · Ways to organise data: characters,
fields, records, tables and databases · Processing in batch (process later) v. real-time
(immediate) · DBMS = Database management systems · Five common database models:
hierarchical, network, relational, multidimensional, object-oriented (used with
unstructured data) · Database types: individual (/microcomputer, stored on LAN or hard
disk), company, distributed, commercial (/information/data banks) · Key field = Primary
field = Unique identifier · Structured Query Language (SQL) is a language to store,
manipulate and retrieve data stored in relational databases, containing: Data def.
language (DDL – commands for defining, deleting and modifying relation schemes),
Interactive Data-manipulation language (DML), View definition, Transaction control · DBMS
programs work with logically structured/arranged data · DBMS (e.g. Foxpro) acts as
interface between database app and database
SOFTWARE TECHNOLOGY · Life cycle: Requirements analysis (use case diagram) -> Design
(sequence diagram, flowchart, state machine) -> Development -> Testing ->
Maintenance/Operations (DevOps or CD/CI – Build -> Code -> Plan -> Monitor -> Operate ->
Deploy -> Release) · Framework: set of built-in libraries or classes · Finite-State
Machine (FSM) or Deterministic Finite Automata (DFA), finite automaton, or state machine,
is a mathematical model of computation · Model – View – Controller: M notifies C, updates
V, acts to C, updates to M
[PART TWO · Other Questions]
MACHINE LEARNING · Rule-based interference is NOT machine learning · Regression is used
for predictions, interpretations and relations · Machine learning disciplines: Info
theory, Optimisation and Control, Physics · Unlabelled data uses clustering · An AI agent
perceives and acts upon environment using sensors and actuators · Learning improves AI
performance · Building a model = training data · Case-based is NOT a numerical function
NETWORK AND IOT · Toggles of buttons sends data to IOT server topic · Default port of MQTT
protocol = 1883, Django Webserver or Python 3 server http port = 8000, Alt. port for HTTP
= 8080, HyperVM over HTTP(S) or IPython/Jupyter dashboard port = 8888 · Two protocols in
Transport layer of TCP/IP are TCP and UDP · MQTT pub/sub mechanism at gateway belongs to
Collect layer of IOT Architecture · A sensor node is normally based on a micro-controller,
connects sensors and actuators, normally equipped w/ a wireless transceiver · Advantages
of Edge computation: improve system autonomous, reduce processing delay, smarter w/ AI ·
IOT networks: Network topology is normally stable, communications are based on TCP/IP
architecture
SOFTWARE TECHNOLOGY · Controller receives events (executes incoming request), including
database access · View corresponds to interface layer · Model defines the business-logic
layer · Execution: Receive first request, create MVC request handler, update app from
handler
[PART THREE · Example C++ Code]
GENERAL · string sa = std::to_string(a); // converting a to string sa
const int *p1 = &a; int * const p2 = &b; // p1 to const int, const p2 to int
const int &r1 = a; int & const r2 = b; // r1 to const int, const r2 to int
void swapref(int &a, int &b) {int temp = a; a = b; b = temp;}
CLASSES · class cname2: public cname, public cname1 {}; // multiple inheritance
cname(int x = 0, int y = 0) {this->x = x; this->y = y;}
cname operator +(cname Z) {cname temp; temp.x = x + Z.x; temp.y = y + Z.y; return temp;}
friend class F; friend void frFn(cname &obj);
void frFn(cname &obj) {cout << obj.x << “ ” << obj.y;}
LINKED LISTS · struct Node {int num; Node next;}; struct Node *head = NULL;
void insert(int n) {struct Node *nn = new Node; nn->num = n; nn->next = head; head = nn;}
void disp() {struct Node *tp = head; while (tp != NULL) {cout << temp->num << “ ”; temp =
temp -> next;} cout << endl;}

You might also like