vault backup: 2025-03-16 18:59:42

This commit is contained in:
boris
2025-03-16 18:59:42 +00:00
parent 6befcc90d4
commit ae837183f1
188 changed files with 17794 additions and 409 deletions

BIN
.DS_Store vendored

Binary file not shown.

5
.obsidian/app.json vendored
View File

@@ -1,13 +1,14 @@
{
"showInlineTitle": true,
"useMarkdownLinks": true,
"promptDelete": true,
"promptDelete": false,
"showLineNumber": true,
"attachmentFolderPath": "images",
"pdfExportSettings": {
"includeName": true,
"pageSize": "A4",
"landscape": false,
"margin": "0",
"margin": "2",
"downscalePercent": 64
},
"readableLineLength": false,

View File

@@ -1,11 +1,11 @@
{
"accentColor": "",
"theme": "system",
"theme": "moonstone",
"cssTheme": "Tokyo Night",
"nativeMenus": true,
"baseFontSize": 14,
"interfaceFontFamily": "AppleGothic,Inter",
"textFontFamily": "AppleGothic,Inter",
"interfaceFontFamily": "AppleGothic,Ubuntu Mono",
"textFontFamily": "AppleGothic,DejaVu Math TeX Gyre",
"monospaceFontFamily": "PT Mono,Andale Mono",
"baseFontSizeAction": false,
"translucency": true

View File

@@ -7,5 +7,6 @@
"obsidian-style-settings",
"url-into-selection",
"obsidian-csv-table",
"mermaid-tools"
"mermaid-tools",
"obsidian-latex"
]

File diff suppressed because one or more lines are too long

15605
.obsidian/plugins/obsidian-latex-suite/main.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
{
"id": "obsidian-latex-suite",
"name": "Latex Suite",
"version": "1.9.8",
"minAppVersion": "1.0.0",
"description": "Make typesetting LaTeX math as fast as handwriting through snippets, text expansion, and editor enhancements",
"author": "artisticat",
"authorUrl": "https://github.com/artisticat1",
"fundingUrl": "https://ko-fi.com/artisticat",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,235 @@
/* Settings panel */
.setting-item.hidden {
display: none;
}
.setting-item.setting-item-heading .latex-suite-settings-icon {
margin-right: var(--size-4-2);
display: inline-flex;
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) {
border-bottom: 1px solid var(--background-modifier-border);
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) + .setting-item {
border-top: none;
}
.setting-item.setting-item-heading:has(.latex-suite-settings-icon) ~ .setting-item:not(.setting-item-heading), .latex-suite-snippet-variables-setting + .setting-item-control {
width: calc(100% - 26px);
margin-left: 26px;
}
.latex-suite-snippet-variables-setting .setting-item-control {
height: 120px;
}
.latex-suite-snippet-variables-setting .setting-item-control textarea {
width: 100%;
height: 100%;
}
.snippets-text-area, .latex-suite-snippet-variables-setting {
display: inline-block;
}
.snippets-text-area .setting-item-info, .latex-suite-snippet-variables-setting .setting-item-info {
margin-bottom: 0.75rem;
}
.snippets-text-area .setting-item-control {
flex-direction: column;
align-items: flex-end;
}
.snippets-editor-wrapper {
width: 100%;
margin-bottom: 0.75rem;
}
.snippets-editor-wrapper .cm-editor {
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
font-size: var(--font-inputs);
height: 20em;
outline: none !important;
text-align: left;
}
.snippets-editor-wrapper .cm-line, .snippets-editor-wrapper .cm-lineNumbers {
font-family: var(--font-monospace);
}
.snippets-footer {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.snippets-editor-validity {
display: flex;
align-items: center;
}
.snippets-editor-validity-indicator {
color: white;
display: inline-block;
border-radius: 1em;
margin-right: 10px;
cursor: default;
visibility: hidden;
}
.snippets-editor-validity-indicator svg {
width: 16px !important;
height: 16px !important;
}
.snippets-editor-validity-indicator:hover {
color: white;
}
.snippets-editor-validity-indicator.valid {
background-color: var(--color-green);
visibility: visible;
}
.snippets-editor-validity-indicator.invalid {
background-color: var(--color-red);
visibility: visible;
}
.snippets-editor-buttons {
display: flex;
flex-direction: row;
}
.latex-suite-confirmation-modal .setting-item {
border: none;
}
.search-input-container input.latex-suite-location-input-el {
width: initial;
}
/*
Snippet color classes.
*/
/* These extra selectors enforce their color on all children, because CodeMirror does weird nesting of spans when
nesting multiple decorations. */
.latex-suite-snippet-placeholder {
border-radius: 2px;
background-color: var(--placeholder-bg);
outline: var(--placeholder-outline) solid 1px;
}
.latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
--placeholder-bg: #87cefa2e;
--placeholder-outline: #87cefa6e;
}
.theme-dark .latex-suite-snippet-placeholder-0, span.latex-suite-snippet-placeholder-0 span {
--placeholder-outline: #87cefa43;
}
.latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
--placeholder-bg: #ffa50033;
--placeholder-outline: #ffa5006b;
}
.theme-dark .latex-suite-snippet-placeholder-1, span.latex-suite-snippet-placeholder-1 span {
--placeholder-outline: #ffa5004d;
}
.latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
--placeholder-bg: #00ff0022;
--placeholder-outline: #00ff0060;
}
.theme-dark .latex-suite-snippet-placeholder-2, span.latex-suite-snippet-placeholder-2 span {
--placeholder-outline: #00ff003d;
}
/* Conceal */
span.cm-math.cm-concealed-bold {
font-weight: bold;
}
span.cm-math.cm-concealed-underline {
text-decoration: underline;
}
span.cm-math.cm-concealed-mathrm, sub.cm-math.cm-concealed-mathrm {
font-style: normal;
}
/* Conceal superscripts without changing line height */
sup.cm-math {
line-height: 0;
}
sup.cm-math, sub.cm-math {
font-style: italic;
}
/* Inline math tooltip styling */
.theme-light .cm-tooltip.cm-tooltip-cursor {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.028), 0px 3.4px 6.7px rgba(0, 0, 0, .042), 0px 5px 20px rgba(0, 0, 0, .07);
}
.theme-dark .cm-tooltip.cm-tooltip-cursor {
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1),
0px 3.4px 6.7px rgba(0, 0, 0, 0.15),
0px 0px 30px rgba(0, 0, 0, 0.27);
}
/* Highlight brackets */
.theme-light .latex-suite-highlighted-bracket, .theme-light .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
background-color: hsl(var(--accent-h), var(--accent-s), 40%, 0.3);
}
.theme-dark .latex-suite-highlighted-bracket, .theme-dark .latex-suite-highlighted-bracket [class^="latex-suite-color-bracket-"] {
background-color: hsl(var(--accent-h), var(--accent-s), 70%, 0.6);
}
/* Color matching brackets */
.theme-light .latex-suite-color-bracket-0, .theme-light .latex-suite-color-bracket-0 .cm-bracket {
color: #527aff;
}
.theme-dark .latex-suite-color-bracket-0, .theme-dark .latex-suite-color-bracket-0 .cm-bracket {
color: #47b8ff;
}
.theme-light .latex-suite-color-bracket-1, .theme-light .latex-suite-color-bracket-1 .cm-bracket {
color: #ff50b7;
}
.theme-dark .latex-suite-color-bracket-1, .theme-dark .latex-suite-color-bracket-1 .cm-bracket {
color: #ff55cd;
}
.theme-light .latex-suite-color-bracket-2, .theme-light .latex-suite-color-bracket-2 .cm-bracket {
color: #69ba00;
}
.theme-dark .latex-suite-color-bracket-2, .theme-dark .latex-suite-color-bracket-2 .cm-bracket {
color: #73ff63;
}
/* .latex-suite-color-bracket-3 {
color: #8de15c;
} */

206
.obsidian/plugins/obsidian-latex/main.js vendored Executable file
View File

@@ -0,0 +1,206 @@
'use strict';
var obsidian = require('obsidian');
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var DEFAULT_SETTINGS = {
preamblePath: "preamble.sty",
};
var JaxPlugin = /** @class */ (function (_super) {
__extends(JaxPlugin, _super);
function JaxPlugin(app, manifest) {
var _this = _super.call(this, app, manifest) || this;
_this.app = app;
_this.settings = DEFAULT_SETTINGS;
return _this;
}
JaxPlugin.prototype.loadPreamble = function () {
return __awaiter(this, void 0, void 0, function () {
var preamble;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.app.vault.adapter.read(this.settings.preamblePath)];
case 1:
preamble = _a.sent();
if (MathJax.tex2chtml == undefined) {
MathJax.startup.ready = function () {
MathJax.startup.defaultReady();
MathJax.tex2chtml(preamble);
};
}
else {
MathJax.tex2chtml(preamble);
}
return [2 /*return*/];
}
});
});
};
JaxPlugin.prototype.loadSettings = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, _b, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
_a = this;
_c = (_b = Object).assign;
_d = [{}, DEFAULT_SETTINGS];
return [4 /*yield*/, this.loadData()];
case 1:
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
return [2 /*return*/];
}
});
});
};
JaxPlugin.prototype.saveSettings = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.saveData(this.settings)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
JaxPlugin.prototype.onload = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.loadSettings()];
case 1:
_a.sent();
this.addSettingTab(new JaxPluginSettingTab(this.app, this));
// Load MathJax so that we can modify it
// Otherwise, it would not be loaded when this plugin is loaded
return [4 /*yield*/, obsidian.loadMathJax()];
case 2:
// Load MathJax so that we can modify it
// Otherwise, it would not be loaded when this plugin is loaded
_a.sent();
if (!MathJax) {
console.warn("MathJax was not defined despite loading it.");
return [2 /*return*/];
}
return [4 /*yield*/, this.loadPreamble()];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
JaxPlugin.prototype.onunload = function () {
// TODO: Is it possible to remove our definitions?
console.log('Unloading Extended MathJax');
};
return JaxPlugin;
}(obsidian.Plugin));
var JaxPluginSettingTab = /** @class */ (function (_super) {
__extends(JaxPluginSettingTab, _super);
function JaxPluginSettingTab(app, plugin) {
var _this = _super.call(this, app, plugin) || this;
_this.plugin = plugin;
return _this;
}
JaxPluginSettingTab.prototype.display = function () {
var _this = this;
var containerEl = this.containerEl;
containerEl.empty();
new obsidian.Setting(containerEl)
.setName('Preamble path')
.setDesc('Path to global preamble. (Requires reload!)')
.addText(function (text) {
return text
.setValue(_this.plugin.settings.preamblePath)
.onChange(function (value) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.plugin.settings.preamblePath = value;
return [4 /*yield*/, this.plugin.saveSettings()];
case 1:
_a.sent();
return [2 /*return*/];
}
});
}); });
});
};
return JaxPluginSettingTab;
}(obsidian.PluginSettingTab));
module.exports = JaxPlugin;
/* nosourcemap */

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-latex",
"name": "Extended MathJax",
"version": "0.4.1",
"minAppVersion": "0.12.16",
"description": "Adds support for a MathJax preamble and enables additional MathJax extensions for specific domains (chemistry, proofs).",
"author": "Xavier Denis & Ng Wei En",
"authorUrl": "https://github.com/wei2912/obsidian-latex",
"isDesktopOnly": false
}

View File

@@ -13,33 +13,58 @@
"state": {
"type": "markdown",
"state": {
"file": "Penetration Testing/Exploitation Assignment/Discovery.md",
"file": "AI & Data Mining/Week 22/Chapter 22 Validity and Inference Rules.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Discovery"
"title": "Chapter 22 Validity and Inference Rules"
}
}
]
},
{
"id": "ccb530263275547c",
"type": "tabs",
"children": [
},
{
"id": "874d2d014b491baf",
"id": "e186aac04d6f44bd",
"type": "leaf",
"state": {
"type": "pdf",
"type": "markdown",
"state": {
"file": "AI & Data Mining/Exercise Booklet.pdf"
"file": "AI & Data Mining/Week 23/Week 23 - Deductive Proofs.md",
"mode": "source",
"source": false
},
"icon": "lucide-file-text",
"title": "Exercise Booklet"
"icon": "lucide-file",
"title": "Week 23 - Deductive Proofs"
}
},
{
"id": "3ee69deee29aa157",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Penetration Testing/Exploitation Assignment/Task 2 - Web Attacks.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Task 2 - Web Attacks"
}
},
{
"id": "9d5df515e1a9868d",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Career Development/Assessment 2 Diary.md",
"mode": "source",
"source": false
},
"icon": "lucide-file",
"title": "Assessment 2 Diary"
}
}
]
],
"currentTab": 3
}
],
"direction": "vertical"
@@ -97,7 +122,7 @@
}
],
"direction": "horizontal",
"width": 395.5
"width": 204.5
},
"right": {
"id": "ee8f6df41634f71e",
@@ -217,53 +242,54 @@
"mermaid-tools:Open Mermaid Toolbar": false
}
},
"active": "874d2d014b491baf",
"active": "ff4e63a36b080692",
"lastOpenFiles": [
"Client Server Systems/Ecobuddy/test-admin.js",
"Client Server Systems/Ecobuddy/logincontroller.php.deprecated",
"Client Server Systems/Ecobuddy/public/css/fonts/bootstrap-icons.woff2",
"Client Server Systems/Ecobuddy/public/css/fonts/bootstrap-icons.woff",
"Client Server Systems/Ecobuddy/public/js/simpleAuth.js",
"Client Server Systems/Ecobuddy/public/js/facilityData.js",
"Client Server Systems/Ecobuddy/public/js/comments.js",
"Client Server Systems/Ecobuddy/public/js/bootstrap.bundle.js",
"Client Server Systems/Ecobuddy/public/js/auth.js",
"Client Server Systems/Ecobuddy/public/js/apiClient.js",
"Client Server Systems/Ecobuddy/public/css/my-style.css",
"Career Development/Assessment 2 Plan.md",
"Career Development/Assessment 2 Diary.md",
"Career Development/Assessment.md",
"AI & Data Mining/Week 26 - Deductive Proofs.md",
"AI & Data Mining/Week 25/Chapter 25 - Predicate Logic Quantifiers.md",
"AI & Data Mining/Week 25/Week 25 - Predicate Logic Quantifiers.md",
"Penetration Testing/Exploitation Assignment/Task 2 - Web Attacks.md",
"AI & Data Mining/Week 23/Untitled.md",
"AI & Data Mining/Week 23/Week 23 - Deductive Proofs.md",
"AI & Data Mining/Week 24/Week 24 - Predicate Logic.md",
"AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/search.php",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/searchinator.php",
"Penetration Testing/Exploitation Assignment/Discovery.md",
"AI & Data Mining/Week 21",
"Client Server Systems/PHPStorm Repo/students.sqlite",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/Views/index.phtml",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/index.php",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/Views/page1.phtml",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/Views/studentISv1.phtml",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/studentISv1.php",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/Models/StudentsDataSet.php",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/images/new_uos_logo.jpg",
"Client Server Systems/PHPStorm Repo/ajax_workshop_2/fonts/glyphicons-halflings-regular.svg",
"Client Server Systems/PHPStorm Repo/images/new_uos_logo.jpg",
"Client Server Systems/PHPStorm Repo/fonts/glyphicons-halflings-regular.svg",
"Client Server Systems/PHPStorm Repo/ajax_workshop_1/favicon.png",
"images/Pasted image 20250131145917.png",
"images/Pasted image 20250131144439.png",
"images/Pasted image 20250131144425.png",
"AI & Data Mining/Week 20/Week 20 - Intro to Propositional Logic.md",
"AI & Data Mining/Week 20/Chapter 20 Tutorial - Introduction to Propositional Logic.md",
"AI & Data Mining/Week 20/Propositional Logic Examples.md",
"AI & Data Mining/Week 19/Timeline of History.md",
"Penetration Testing/Week 20/Week 20 - Web Attacks.md",
"AI & Data Mining/Week 21/Chapter 21 - Transformational Proofs.md",
"AI & Data Mining/Week 22/Week 22 Validity and Inference Rules.md",
"AI & Data Mining/Week 22/Chapter 22 Validity and Inference Rules.md",
"AI & Data Mining/Assessment/Coursework Prep Notes.md",
"AI & Data Mining/Week 23/Chapter 23 - Deductive Proofs.md",
"images/Pasted image 20250221132524.png",
"Penetration Testing/Week 21/Week 21 - Exploits and Post-Exploitation.md",
"Penetration Testing/Week 21/Public Exploitation Workshop.md",
"Penetration Testing/Week 20/Week 20 - Web Application Attacks.md",
"Penetration Testing/Week 23/Week 23 - Password Attacks.md",
"Penetration Testing/Week 22/Week 22 - Web Attacks.md",
"images/Pasted image 20241025141348.png",
"images/Pasted image 20241017132059.png",
"images/Pasted image 20241011131542.png",
"images/Pasted image 20241003133342.png",
"images/Pasted image 20241003092201.png",
"images/Pasted image 20241003092549.png",
"images/Pasted image 20241017130933.png",
"images/Pasted image 20240920133316.png",
"images/Pasted image 20240920133706.png",
"README.md",
"CWC 3 - Fit for Trade.md",
"images/Pasted image 20250129154055.png",
"CWC 1 - Consistency.md",
"CWC 2 - Warm Welcome.md",
"Penetration Testing/Week 19/Steps to Complete Workshop 2.md",
"AI & Data Mining/Week 18/Week 18 - Tutorial.md",
"Data Structures/GPT Answers to Past Paper/Question 4.md",
"Data Structures/GPT Answers to Past Paper/Question 1.md",
"Data Structures/GPT Answers to Past Paper/Question 6.md",
"Penetration Testing/Week 19/AI Summary.md",
"Penetration Testing/Week 19/Week 19 - Buffer Overflow.md",
"Client Server Systems/PHPStorm Repo/php-s1/MVCtemplate-23-24/images/new_uos_logo.jpg",
"AI & Data Mining/Week 18/Week 18 - What AI?????.md",
"Networking and Security/Week 18/Workshop.md",
"Data Structures/AI Notes/Stack.md",
"Data Structures/AI Notes/Trees.md",
"Data Structures/AI Notes/Linear List.md",
"Data Structures/AI Notes/Exceptions.md",
"Data Structures/AI Notes/Double linked lists.md",
"Data Structures/AI Notes/Data Structures and Abstract Data Types.md",
"Client Server Systems/Week 1/Workshop 1 - Intro to PHP.md",
"Welcome.md",
"Database Systems/Untitled.canvas",
"Untitled 1.canvas",
"Untitled.canvas"

View File

@@ -0,0 +1,6 @@
Lectures 5,6,7,8,9,10,11,12
Chapters 20,21,22,23
texlive-recommended
texlive-luatex
texlive-fonts-recommended

View File

@@ -1,4 +1,5 @@
# 1R: (AV)CTARs
(foreach) Attribute
(foreach) Value
Count (class)
@@ -8,6 +9,7 @@
Smallest (error rate)
# Missing Values: Ma $\Delta$D CPS
Malfunctioning Equipment
Change in Design
Collation of Datasets

View File

@@ -1,11 +1,15 @@
# 1R
### (AV)CTARs
Simple
Classification
One-Level tree
Tie, make arbitrary choice
## Issue with Numerics
- Discretise
- List values of attribute
- Sort asc
@@ -13,11 +17,15 @@ Tie, make arbitrary choice
- Breakpoints between change in class
- Interval assigned to majority class
- Enforce bucket size, if adjacent interval has same class, merge.
## Issue with Missing Values
- Assign "missing" as a value
- Treat normally
## Issue with Overfitting
- Bucket Enforcement
- Ensure attribute tested is applicable
# PRISM
# PRISM

View File

@@ -0,0 +1 @@

View File

@@ -8,4 +8,4 @@
2. Search Engines recognise language
3. Telephone menus recognise language and can "hear"
4. Dynamic routing algorithms utilise machine learning
7. Following the principles defined by the turing test, AI should classify as both science and engineering. The concepts and programming are scientific, however robotics and hardware are engineering.
7. Following the principles defined by the turing test, AI should classify as both science and engineering. The concepts and programming are scientific, however robotics and hardware are engineering.

View File

@@ -134,7 +134,7 @@ Limited rationality means acting appropriately when there is not enough time to
Perfect rationality remains a good starting point for theoretical analysis.
#### Value Alignment Problem
#### Value Alignment Problem
A problem with perfect rationality is that it would assume a fully specified objective given to the machine.
Artificially defined problems such as chess, come with an objective.
@@ -147,7 +147,8 @@ Problem of achieving this is called the value alignment problem
### Bad Behaviour
If a machine is intelligent enough to reason and act, such a machine may attemt to increase chances of winning by immoral means:
If a machine is intelligent enough to reason and act, such a machine may attempt to increase chances of winning by immoral means:
- Blackmail
- Bribery
- Grabbing additional computing resources for itself
@@ -157,5 +158,5 @@ These behaviours are rational, and are logical for success, however immoral.
We do not want machines that are intelligent in the sense of pursuing their objectives.
We want them to pursue our objectives.
If we cannot transfer our objectives perfectly to the machine, we need the machine to know that is does not know the complete objective and have the incentive to act cautiously, ask for permission, learn about preferences through observation, defer to human control.
We want agents that are provably beneficial to humans.
If we cannot transfer our objectives perfectly to the machine, we need the machine to know that is does not know the complete objective and have the incentive to act cautiously, ask for permission, learn about preferences through observation, defer to human control.
We want agents that are provably beneficial to humans.

BIN
AI & Data Mining/Week 18/test.pdf Executable file

Binary file not shown.

View File

@@ -27,16 +27,16 @@ Formula: p => q
(b) Increased spending overheats the economy.
Atomic Propositions:
Increased spending
Increased spending
Overheats the economy
Connectives:
Connectives:
None, implied non-linguistic
Formula: p => q
(c) Increased spending coupled with tax cuts overheats the economy.
Atomic Propositions:
Increased spending
There are tax cuts
There are tax cuts
Overheated economy
Connectives:
Coupled with
@@ -56,7 +56,7 @@ Atomic Propositions:
Inflation does not rise
Connectives:
either / or
Formula: p
Formula: p
1. Remove as many brackets as possible from the following propositions without altering their meaning (i.e. the truth table).

View File

@@ -19,7 +19,9 @@
- Disjunction (): p q is true if and only if at least one of p or q is true
- Implication (⇒): p ⇒ q is false if and only if p is true and q is false
- Equivalence (⇔): p ⇔ q is true if and only if p and q have the same truth value
## Precedence Order of Connectives
1. Negation (¬)
2. Conjunction (∧)
3. Disjunction ()
@@ -27,6 +29,7 @@
5. Equivalence (⇔)
This means that in a formula without parentheses, ¬ takes precedence over ∧ and , ∧ and have the same precedence but associativity to the left, and ⇒ and ⇔ also have the same precedence but associativity to the right. For example, p ∧ q ⇒ r is equivalent to (p ∧ q) ⇒ r, not p ∧ (q ⇒ r).
### Propositions and Connectives (Examples)
#### Atomic Propositions:
@@ -119,6 +122,7 @@ This means that in a formula without parentheses, ¬ takes precedence over ∧ a
- Formalized as: p ∧ q ⇒ ¬r
- Argument: If Bob eats carrots, then he will be able to see in the dark. Therefore, if Bob cant see in the dark, then he hasnt eaten carrots.
- Formalized as: p ⇒ q ≡ ¬q ⇒ ¬p
# Summary
- Logicians focus on argument form

View File

@@ -0,0 +1,44 @@
1. George Boole
2. Truth Tables for a) Negation b) Contraposition
a)
Negation Law
¬¬p ≡ p
| p | ¬p | ¬(¬p) | ¬(¬p) ⇔ p |
| --- | --- | ----- | --------- |
| T | F | T | T |
| F | T | F | T |
b)
Contraposition Law
p ⇒ q ≡ ¬q ⇒ ¬p
| p | ¬p | q | ¬q | p ⇒ q | ¬q ⇒ ¬p | p ⇒ q ⇔ ¬q ⇒ ¬p |
| --- | --- | --- | --- | ----- | ------- | --------------- |
| T | F | T | F | T | T | T |
| T | F | F | T | F | F | T |
| F | T | T | F | T | T | T |
| F | T | F | T | T | T | T |
p ⇒ q ⇔ ¬q ⇒ ¬p MUST be true, since p ⇒ q and ¬q ⇒ ¬p are shown in the truth table to be the same logical equivalence
1. Provide names of laws
1. Negation Law
2. De Morgan's Law
3. Negation Law
4. De Morgan's Law
5. Negation Law Twice
6. Associative Law
7. De Morgan's Law
8. De Morgan's Law
9. Negation Law Twice
2. Show logical equivalence
p ⇒ q
¬q ⇒ ¬p
p ⇒ q
≡ (¬p) v q
≡ q v (¬p)
≡ ¬ (¬q) v (¬p)
≡ (¬q) ⇒ (¬p)

View File

@@ -151,4 +151,4 @@
2. Prove De Morgan's laws using truth tables or transformational proofs.
3. Prove the laws involving true and false using truth tables or transformational proofs.
4. Prove the laws of simplification using truth tables or transformational proofs.
5. Prove the equivalence of two given formulae using transformational proofs (as demonstrated in slides 21 and 22).
5. Prove the equivalence of two given formulae using transformational proofs (as demonstrated in slides 21 and 22).

View File

@@ -0,0 +1,53 @@
1. A syllogism is an instance of a form of reasoning in which a conclusion is drawn from two given or assumed propositions; a common or middle term is present in the two premises but not in the conclusion, which may be invalid.
2. Aristotle
**Double Negation ¬ Elim ¬ ¬ p p**
| Propositions | Premises | Conclusion |
| ------------ | ------------ | ---------- |
| p | $\neg\neg p$ | p |
| T | T | T |
| F | F | F |
**Hypothetical syllogism; this says that if p implies q and q implies r, then it can be logically concluded that p implies r. p ⇒ q q ⇒ r p ⇒ r**
| Propositions | | | Premises | | Conclusion |
| ------------ | --- | --- | -------------- | -------------- | -------------- |
| p | q | r | $p \implies q$ | $q \implies r$ | $p \implies r$ |
| T | T | T | T | T | T |
| T | T | F | T | F | |
| T | F | T | F | T | |
| T | F | F | F | T | |
| F | T | T | T | T | T |
| F | T | F | T | F | |
| F | F | T | T | T | T |
| F | F | F | T | T | T |
1. Involves linking implications together in a sequential manner, much like the links in a chain.
**p q q Therefore, p**
| Propositions | | Premises | | Conclusion |
| ------------ | --- | ---------- | --- | ---------- |
| $p$ | $q$ | $p \lor q$ | $q$ | p |
| T | T | T | T | T |
| T | F | T | F | T |
| F | T | T | T | F |
| F | F | F | F | F |
**p ⇒ q q ⇒ p Therefore, p ∧ q**
| Propositions | | Premises | | Conclusion |
| ------------ | --- | -------------- | -------------- | ----------- |
| p | q | $p \implies q$ | $q \implies p$ | $p \land q$ |
| T | T | T | T | T |
| T | F | F | T | F |
| F | T | T | F | F |
| F | F | T | T | F |
$p \implies q$
$r \implies s$
$p \lor r$ (p disjunction (or) r)
Conclusion: $q \lor s$
The "Constructive Dilemma": If the disjunction of the antecedent of two implications holds then the disjunction of the conclusions also must hold

View File

@@ -0,0 +1,163 @@
**Detailed Notes on Lectures 9 & 10: Validity and Inference Rules**
**Slide 1: Learning Objectives**
- Define the notion of validity in an argument.
- Establish validity using truth tables.
- Demonstrate invalidity using truth tables.
- Understand inference rules.
**Slide 2: Contents**
- Objectives
- Transformational proofs are not sufficient.
- Comparison of deduction with induction.
- Validity.
- Demonstrating validity/invalidity using truth tables.
- Problem with truth tables.
- Inference rules.
- Summary, reading, and references.
**Slide 3: Transformational Proofs do not Suffice**
- Understanding transformations of formulas is useful but insufficient.
- Logic uses rules of inference to deduce true propositions from other true propositions.
- Invalid premises cannot lead to valid conclusions, preventing proofs of contradictions or useless systems.
**Slide 4: Premises and Conclusions**
- An argument consists of premises (basis for accepting) and a conclusion.
- Example:
- Premises: Every adult is eligible to vote; John is an adult.
- Conclusion: Therefore, John is eligible to vote.
**Slide 5: Deduction vs. Induction**
- Deductive arguments: Conclusion is wholly justified by premises.
- Inductive arguments: More general new knowledge inferred from facts or observations.
**Slide 6: Valid vs. Invalid Arguments**
- Valid arguments: Conclusion always true when premises are true.
- Invalid arguments: At least one assignment where premises are true, but conclusion is false.
**Slide 7: Example of Valid Argument**
- If John is an adult, then he is eligible to vote (premise).
- John is an adult (premise).
- Therefore, John is eligible to vote (conclusion).
**Slide 8: Example of Valid Argument with False Conclusion**
- If I catch the 19:32 train, I'll arrive in Glasgow at 19:53 (premise).
- I catch the 19:32 train (premise).
- Therefore, I arrive in Glasgow at 19:53 (conclusion) Factually false but valid argument.
**Slide 9: Example of Invalid Argument**
- If I win the lottery, then I am lucky (premise).
- I do not win the lottery (premise).
- Therefore, I am unlucky (conclusion) Invalid argument with factually true premises and conclusion.
**Slide 10: Demonstrating Validity Using Truth Tables**
- View argument as implication (p ⇒ q).
- If premises entail conclusion, then argument is valid.
**Slide 12: Demonstrating Validity Using Truth Table (Example)**
- Argument: If John is an adult, then he is eligible to vote; John is an adult; Therefore, John is eligible to vote.
- Atomic Propositions: p (John is an adult), q (John is eligible to vote).
| p | q | p ⇒ q | p ∧ q |
|---|---|------|-------|
| T | T | T | T |
| F | T | F | F |
- Argument is valid because conclusion (q) is always true when premises are true.
**Slide 13: Viewing Argument as Implication**
- If premises logically imply conclusion, argument is valid.
- Example: ((p ⇒ q) ∧ p) ⇒ q
**Slide 15: Demonstrating Invalidity Using Truth Tables**
- Argument is invalid if there's at least one assignment where premises are true, but conclusion is false.
**Slide 16: Demonstrating Invalidity Using Truth Table (Example)**
- Argument: p ⇔ q; p ⇒ r; Therefore, p Invalid argument.
| p | q | r | p ⇔ q | p ⇒ r |
|---|---|------|-------|--------|
| T | T | T | T | T |
| F | T | F | F | F |
- Argument is invalid because there's a row where premises are true, but conclusion (p) is false.
**Slide 17: Exercise**
- Demonstrate the invalidity of the argument: p q; ¬p; Therefore, ¬q.
**Slide 18: Solution to Exercise**
- Atomic Propositions: p, q.
| p | q | p q | ¬p |
|---|---|------|-----|
| F | T | T | T |
- Argument is invalid because there's a row where premises are true, but conclusion (¬q) is false.
**Slide 19: A Problem with Truth Tables**
- Using truth tables to establish validity becomes tedious as the number of variables increases.
**Slide 20: Deductive Proofs**
- Approach to establishing validity using a series of simpler arguments known to be valid.
- Uses laws of logic (logical equivalences) and inference rules.
**Slide 21: Inference Rules**
- Primitive valid argument forms eliminating or introducing logical connectives.
- Categories: Intro (introduces connective), Elim (eliminates connective).
**Slide 22: The Layout of an Inference Rule**
- Premises (above the line): List of formulas already in proof.
- Conclusion (below the line): What may be deduced by applying the inference rule.
**Slide 23: Conjunction (∧Intro)**
- Introduces the connective ∧.
- Example: p, q; Therefore, p ∧ q.
**Slide 24: Simplification (∧Elim)**
- Eliminates the connective ∧.
- Example: p ∧ q; Therefore, p.
**Slide 25: Addition (Intro)**
- Introduces the connective .
- Example: p; Therefore, p q.
**Slide 26: Exercise on Disjunctive Syllogism**
- Demonstrate the validity of the inference rule using a truth table.
**Slide 27: Solution to Exercise**
- Atomic Propositions: p, q.
| p | q | ¬p |
|---|---|-----|
| F | T | T |
- Argument is valid because conclusion (q) is always true when premises are true.
**Slide 28: Modus Ponens (⇒Elim)**
- Eliminates the connective ⇒.
- Example: p ⇒ q; p; Therefore, q.
**Slide 29: Modus Tollens (⇒Elim)**
- Eliminates the connective ⇒.
- Example: p ⇒ q; ¬q; Therefore, ¬p.
**Slide 30: Other Inference Rules**
- Double Negation (¬Elim): ¬¬p; Therefore, p.
- Laws of Equivalence (⇔Elim): p ⇔ q; Therefore, p ⇒ q and q ⇒ p.
**Slide 31: Transitive Inference Rules**
- Transitivity of Equivalence: If p ≡ q and q ≡ r, then p ≡ r.
- Hypothetical Syllogism: If p ⇒ q and q ⇒ r, then p ⇒ r.
**Slide 32: Summary**
- Valid arguments: Conclusion always true when premises are true.
- Invalid arguments: At least one assignment where premises are true, but conclusion is false.
- Truth tables demonstrate invalidity.
- Inference rules deduce true propositions from other true propositions.
**Slide 33: Reading and References**
- Russell, Norvig (2022). Artificial Intelligence. 4th Edition.
- Nissanke (1999). Introductory Logic and Sets for Computer Scientists.
- Gray (1984). Logic, Algebra and Databases.

BIN
AI & Data Mining/Week 22/test.pdf Executable file

Binary file not shown.

View File

@@ -0,0 +1,16 @@
![](Pasted%20image%2020250221132524.png)
| Line | | | |
| ---- | --------------------------- | ---------- | --------------------------------- |
| 1 | $A \implies \lnot B$ | Premise | |
| 2 | $(B \lor C) \lor D$ | Premise | |
| 3 | $\lnot C \lor D \implies A$ | Premise | |
| 4 | $\lnot C$ | Premise | |
| 5 | $\lnot C \lor D$ | From 4 | $\lor Intro$ |
| 6 | $A$ | From 3 & 5 | $\implies Elim$ Modus Ponens |
| 7 | $\lnot B$ | From 1 & 6 | $\implies Elim$ Modus Ponens |
| 8 | $\lnot B \land \lnot C$ | From 2 & 7 | $\land Intro$ |
| 9 | $\lnot (B \lor C)$ | From 8 | De Morgans Law |
| 10 | $D$ | From 9 | $\lor Elim$ Disjunctive Syllogism |
B or C is not true, therefore D must be true from step 2.

View File

@@ -0,0 +1,204 @@
**Slide 3: Recap on Logical Implication (Entailment) |-|=-**
- Entailment notation: p |=q if and only if the implication p$\implies$q is a tautology.
- Example:
- p $\land$ q |=q
- Truth table for p $\implies$ q:
| p | q | p $\land$ q | p $\implies$ q |
|---|---|------|--------|
| T | T | T | T |
| T | F | F | F |
| F | T | F | T |
| F | F | F | T |
**Slide 4: (r $\implies$ s) $\land$ (r $\implies$ $\lnot$s) |-|=-**
- Intuitively, if r implies both s and $\lnot$s, then r must be false.
- Truth table for (r $\implies$ s) $\land$ (r $\implies$ $\lnot$s):
| r | s | $\lnot$s | (r $\implies$ s) $\land$ (r $\implies$ $\lnot$s) |
|---|---|---|------------------------|
| T | T | F | F |
| T | F | F | F |
| F | T | T | T |
| F | F | T | T |
**Slide 5: p $\vdash$ q**
- Notation: p $\vdash$ q means q is provable from p using inference rules.
- Example:
- A $\implies$ B, $\lnot$A, therefore $\lnot$B
**Slide 6: Differences Between |-|=- and $\vdash$**
- |= indicates semantic entailment (truth conditions).
- $\vdash$ represents syntactic derivation (inference rules).
**Slide 7: Recap on Inference Rules**
- Example inference rules:
- Modus Ponens ($\implies$Elim):
p $\implies$ q, p $\vdash$ q
- Conjunction Introduction ($\land$Intro):
p $\vdash$ q, p $\vdash$ r $\vdash$ p $\land$ q
- Conditional Proof ($\implies$Intro):
p $\vdash$ r, p $\vdash$ s $\vdash$ p $\implies$ (r $\land$ s)
**Slide 8: Layout of an Inference Rule**
- Premises above the line, conclusion below the line.
- Example inference rule ($\implies$Intro):
p $\vdash$ r, p $\vdash$ s
p $\implies$ (r $\land$ s)
**Slide 9: Presentation of Proofs**
- Steps:
- Number each step.
- Justify each step with previous line(s) and inference rule used.
**Slide 10: Deriving $\lnot$p $\implies$ r From (p $\land$ q) $\lor$ r**
- Example proof:
(p $\land$ q) $\lor$ r, $\lnot$E
$\lnot$p $\implies$ r
**Slide 11: Two Special Inference Rules**
- Deductive Theorem ($\implies$Intro):
p $\vdash$ r, p $\vdash$ s
p $\implies$ (r $\land$ s)
- Reductio ad absurdum ($\lnot$Intro):
p $\vdash$ r, p $\vdash$ $\lnot$s
p $\vdash$ $\lnot$r
**Slide 12: Conditional Proofs**
- Strategy: Assume p, deduce q if possible, discharge assumption.
- Example:
(p $\land$ q) $\lor$ r
$\lnot$p $\implies$ r
**Slide 13: Indirect Proofs**
- Strategy: Assume negation of goal, deduce contradiction.
- Example:
(p $\land$ q) $\lor$ r
$\lnot$p $\implies$ r
**Slide 14: Solution to Exercise**
Given argument:
A (You eat carefully) ⇒ B (You have a healthy digestive system)
C (You exercise regularly) ⇒ D (You are very fit)
B D ⇒ E (You live to a ripe old age)
¬E
Therefore, ¬A ∧ ¬C
**Proof:**
| Line | Formula | Justification |
| ---- | --------- | -------------------- |
| 1 | A ⇒ B | Premise |
| 2 | C ⇒ D | Premise |
| 3 | B D ⇒ E | Premise |
| 4 | ¬E | Premise |
| 5 | ¬(B D) | Modus Tollens (3, 4) |
| 6 | ¬B ∧ ¬D | De Morgan's Law (5) |
| 7 | ¬B | ∧Elim (6) |
| 8 | ¬A | Modus Tollens (1, 7) |
| 9 | ¬D | ∧Elim (6) |
| 10 | ¬C | Modus Tollens (2, 9) |
| 11 | ¬A ∧ ¬C | ∧Intro (8, 10) |
**Conclusion:**
We have proven that ¬A ∧ ¬C, i.e., you did not eat carefully and you did not exercise regularly.
**Slide 15: Two Special Inference Rules (continued)**
- Deductive Theorem:
p $\vdash$ r, p $\vdash$ s
p $\implies$ (r $\land$ s)
- Reductio ad absurdum:
p $\vdash$ r, p $\vdash$ $\lnot$s
p $\vdash$ $\lnot$r
**Slide 16: Soundness and Completeness**
- Sound: Valid argument with true premises.
- Complete: Derives any sentence entailed by premises.
**Slide 17: Formal Proofs of Natural Language Arguments**
- Steps:
- Identify atomic propositions.
- Formalize argument in logic.
- Check for invalidity.
- Attempt proof.
**Slide 18: Example - Travel**
- Argument:
Therefore, if my neighbours claim to be impressed then they are just pretending.
**Slide 19: Example - Travel (continued)**
- Formalize argument:
p $\implies$ q, $\lnot$p $\implies$ $\lnot$r, $\lnot$q
$\lnot$r
- Proof:
$\lnot$p $\implies$ r
**Slide 20: Example - Nutrition**
- Argument:
Therefore, you did not eat carefully and you did not exercise regularly.
**Slide 21: Example - Nutrition (continued)**
- Formalize argument:
A $\implies$ B, C $\implies$ D, B $\lor$ D $\implies$ E, $\lnot$E
$\lnot$A $\land$ $\lnot$C
- Proof:
$\lnot$A $\land$ $\lnot$C
**Slide 22: Application to Software Engineering**
- Questions about software specifications and claims are arguments.
**Slide 23: Reading and References**
- Russell and Norvig, Artificial Intelligence (4th Edition)
- Nissanke, Introductory Logic and Sets for Computer Scientists
- Gray, Logic, Algebra and Databases

BIN
AI & Data Mining/Week 23/test.pdf Executable file

Binary file not shown.

View File

@@ -0,0 +1,18 @@
1. Just the following propositions hold true:
1. male(Ahmed) male(Patel) male(Scott) tall(Ahmed) tall(Patel) short(Khan) short(Scott)
Evaluate the truth of the following formula
| x | tall(x) | male(x) | short(x) | $\lnot$short(x) | male(x) $\land \lnot$short(x) | tall(x) $\iff$ male(x) $\land \lnot$short(x) | $\forall x \bullet$tall(x) $\iff$ male(x) $\land \lnot$short(x) |
| --- | ------- | ------- | -------- | --------------- | ----------------------------- | -------------------------------------------- | --------------------------------------------------------------- |
| Ah | T | T | F | T | T | T | |
| Kh | F | F | T | F | F | T | |
| Pa | T | T | F | T | T | T | |
| Sc | F | T | T | F | F | T | |
| | | | | | | | T |
2. Using appropriate binary predicates, express each of the following sentences in predicate logic
a) Salford stores only supply stores outside of Salford.
- $\forall x \bullet \forall y \bullet \textsf{in(x, Salford)} \land \textsf{supples}$
b) No store supplies itself
c) There are no stores in Eccles but there are some in Trafford.
d) Stores do not supply stores that are supplied by stores which they supply
e) Stores which supply each other are always in the same place

View File

@@ -0,0 +1,171 @@
**Slide 1: Learning Objectives**
- Understand when the order of quantifiers is important.
- Understand how ∀ and ∃ are connected.
- Use and remember scoping rules.
- Identify bound and free variables in formulae.
- Establish the truth of formulae in predicate logic.
- Understand why predicate logic is described as undecidable.
- Understand the difference between zero-order, first-order, and higher-order predicate logics.
**Slide 2: Objectives & Recap**
- Quantifiers and their alternative view.
- Distributive laws of quantifiers.
- De Morgan's laws with quantifiers.
- Scope of quantifiers.
- Bound and free variables.
**Slide 3: The Universal Quantifier (∀)**
- Pronounced as "for all".
- Example: ∀x (human(x) ⇒ mortal(x)) = All humans are mortal.
- In terms of conjunction: ∀x p(x) ≡ p(x₁) ∧ p(x₂) ∧... ∧ p(xₙ)
**Slide 4: The Existential Quantifier (∃)**
- Pronounced as "there exists" or "for some".
- Example: ∃x (human(x) ∧ happy(x)) = Some humans are happy.
- In terms of disjunction: ∃x p(x) ≡ p(x₁) p(x₂) ... p(xₙ)
**Slide 5: Distributive Laws of Quantifiers**
- ∀x (p(x) ∧ q(x)) ≡ (∀x p(x)) ∧ (∀x q(x))
- ∃x (p(x) q(x)) ≡ (∃x p(x)) (∃x q(x))
**Slide 6: The Order of Quantification**
- Example 1 (Everyone loves someone): ∀x ∃y loves(x, y)
- Example 2 (There is someone loved by everyone): ∃y ∀x loves(x, y)
**Slide 7: De Morgan's Laws and Quantifiers**
- ¬∃x p(x) ≡ ∀x ¬p(x)
- ¬∀x p(x) ≡ ∃x ¬p(x)
**Slide 8: Scope of Quantifiers**
- In absence of brackets, scope extends to the end of the formula.
- Brackets can enforce different scoping patterns.
**Slide 9: Bound and Free Variables**
- Bound variable: occurrence introduced by a quantifier within its scope.
- Example:
```
Formula Variable status
child(x) Only one occurrence of x, free.
∀x child(x) ∧ clever(x) Both occurrences of x are bound by the same quantifier.
((∀x child(x)) ∧ clever(x)) The first occurrence of x is bound, the second is free.
```
- Free variable: occurrence not within any quantifier's scope.
**Slide 10: Meaning of Bound Variables**
- The meaning of a bound variable does not depend on its name.
- Example:
```
∀x (child(x) ∧ clever(x)) ⇒ ∃y loves(y, x)
∀B (child(B) ∧ clever(B)) ⇒ ∃C loves(C, B)
```
**Slide 11: Meaning of Free Variables**
- Free variables denote unknowns or unspecified objects.
- Example:
```
∀x (child(x) ∧ clever(x)) ⇒ x is loved.
∀x (child(x) ∧ clever(x)) ⇒ z is loved.
```
**Slide 12: Exercise**
- Identify bound and free variables in the formula:
```
∃x taller(y, x) ∃x ∃y taller(x, y) ∧ taller(x, z)
```
- Solution:
- In the first formula: x is bound, y is free.
- In the second formula: y is bound by ∃y, z is free. Both occurrences of x are bound and refer to the same variable.
**Slide 13: The Equality Symbol (=)**
- ⊢ Richard has at least two brothers:
```
∃x ∃y (brother(x, richard) ∧ brother(y, richard) ∧ ¬(x = y))
```
- Definition of sibling using parent:
```
∀x ∀y sibling(x, y) ≡ (¬(x = y) ∧ ∃m ∃f ¬(m = f) ∧ parent(m, x) ∧ parent(f, x) ∧ parent(m, y) ∧ parent(f, y))
```
**Slide 14: Establishing the Truth Values of Formulae**
- Example (slide 21 and 22):
- Individuals: Ahmed, Khan, Patel, Scott.
- Properties: male, tall, short.
- Formula: ∀x (male(x) ⇒ tall(x) short(x))
- Truth table shows the formula is false (Patel is male but not tall or short).
**Slide 15: Exercise**
- Given individuals, properties, and true propositions as in slide 23.
- Evaluate the truth of: ∀x ¬male(x) ⇒ short(x)
- Solution (slide 24):
```
x male(x) ¬male(x) short(x) ¬male(x) ⇒ short(x)
Ahmed T F F F T
Khan F T T T T
Patel T F F F T
Scott T F T F F
```
- The formula is false (Patel is male but not short).
**Slide 16: Example Involving ∃**
- Given individuals, properties, and true propositions as in slide 25.
- Formula: ∃x (male(x) ∧ ¬tall(x) ⇒ short(x))
- Truth table (slide 26):
```
x male(x) ¬tall(x) short(x) ¬tall(x) ⇒ short(x) male(x) ∧ ¬tall(x) ⇒ short(x)
Ahmed T F F F T T
Khan F F T F F F
Patel T F F F F F
Scott T T T F T F
```
- The formula is true (Scott is male, not tall but short).
**Slide 17: Exercise**
- Given individuals, properties, and true propositions as in slide 27.
- Evaluate the truth of: ∃x (male(x) ∧ (tall(x) ¬short(x)))
- Solution (slide 28):
```
x male(x) tall(x) short(x) ¬short(x) tall(x) ¬short(x) male(x) ∧ (tall(x) ¬short(x))
Ahmed T T F T T T T
Khan F F T F F F F
Patel T T F F T T F
Scott T F T F F F F
```
- The formula is true (Ahmed and Patel are males, tall or not short).
**Slide 29: Predicate Logic is Undecidable**
- Universal quantification introduces computational impossibility when testing truth values with an infinite number of possible values.
**Slide 30: First-order Predicate Logic**
- Quantifiers refer only to objects (constants), not predicate or function names.
- Propositional logic is zero-order logic.
**Slide 31: Summary**
- Order of quantifiers matters when both ∀ and ∃ are present.
- Quantifiers are connected through negation, obey De Morgan's laws.
- Scope of quantifiers extends to the end of the formula without brackets.
- Bound variables are introduced by a quantifier within its scope; free variables are not within any quantifier's scope.
**Slide 32: Reading, References and Acknowledgements**
- Reading from Artificial Intelligence textbook by Russell and Norvig.
- References: Introductory Logic and Sets for Computer Scientists by Nissanke.

View File

@@ -0,0 +1,159 @@
### **Slide Notes:**
---
#### **Slide 0: Learning Objectives**
- Identify genuine variables and variables standing for unknowns.
- Describe the role of inference rules for eliminating and introducing quantifiers.
- Justify constraints on handling variables when eliminating and introducing quantifiers.
- Conduct proofs in predicate logic.
- Prove the validity of an argument presented in English.
---
#### **Slide 1: Contents**
- Recap on inference rules
- Deductive proof in predicate logic
- Genuine variables versus unknown variables
- Extra inference rules for predicate logic
- Constraints on variables
- Summary, reading and references
---
#### **Slide 2: Recap on Inference Rules**
| **Connective** | **Introduction Rule** | **Elimination Rule** |
| ------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------ |
| ∧ (and) | ∧ Intro:$p, q \vdash p \land q$ | ∧ Elim:$p \land q, p \vdash q$ |
| (or) | Intro:$p \vdash p \lor q$,$q \vdash p \lor q$ | Elim:$p \vdash \varnothing$,$p \lor q \vdash \varnothing$x |
| ¬ (not) | N/A | ¬ Elim:$\neg p, q \vdash p$ |
| ⇒ (implies) | ⇒ Intro:$p, p \Rightarrow q \vdash q$ | ⇒ Elim (Modus Ponens):$p \Rightarrow q, p \vdash q$ |
| ⇔ (if and only if) | ⇔ Intro:$p \Rightarrow q, q \Rightarrow p \vdash p \leftrightarrow q$ | ⇔ Elim:$p \leftrightarrow q, p, q \vdash \varnothing$ |
---
#### **Slide 3: Deductive Proof in Predicate Logic**
1. Reduce formulae to propositional form by removing quantifiers.
2. Manipulate formulae using inference rules and logical laws of propositional logic.
3. Reintroduce quantifiers at the end, depending on the goal.
---
#### **Slide 4: Genuine Variables vs. Unknown Variables**
- **Genuine variable**:
- A free variable whose universal quantification yields a true formula.
- **Unknown variable**:
- A free variable whose existential quantification yields a true formula.
---
#### **Slide 5: Exercise**
**Example**:
-$\frac{9}{z} = 3$
-$\text{even}(n) \lor \text{odd}(n)$
| **Variable** | **Status** | **Justification** |
|--------------|-------------------------|-----------------------------------|
|$z$ | Unknown variable |$\exists z \cdot \frac{9}{z} = 3$|
|$n$ | Genuine variable |$\forall n \cdot (\text{even}(n) \lor \text{odd}(n))$|
---
#### **Slide 6: Extra Inference Rules for Predicate Logic**
| **Quantifier** | **Introduction Rule** | **Elimination Rule** |
|-----------------|----------------------------------------|---------------------------------------------------|
|$\forall$(for all) |$\forall \text{Intro}: \varphi(x), x \neq y \vdash \varphi(x)$|$\forall \text{Elim}: \forall x \cdot \varphi(x), \varphi(x) \vdash \varnothing$|
|$\exists$(there exists) |$\exists \text{Intro}: \varphi(x), x \neq y \vdash \exists x \cdot \varphi(x)$|$\exists \text{Elim}: \exists x \cdot \varphi(x), \varphi(x) \vdash \varnothing$|
---
#### **Slide 7: Freeing Variables from$\forall$**
- Example:
-$\forall x \cdot \text{lecturer}(x), \text{lecturer}(bryant)$
-$\forall x \cdot \text{lecturer}(x), \text{lecturer}(y)$
-$y$is a genuine variable.
---
#### **Slide 8: Freeing Variables from$\exists$**
- Example:
-$\exists x \cdot \text{student}(x), \text{student}(y)$
-$y$is an unknown variable.
---
#### **Slide 9: Introduction of$\forall$**
- Constraint:
- Do not introduce$\forall$on the basis of an individual (a constant).
---
#### **Slide 10: Constraint 1**
- When eliminating$\exists$, do not instantiate its variable with a constant.
---
#### **Slide 11: Constraint 2**
- When eliminating$\exists$, do not instantiate its variable with an existing free variable.
---
#### **Slide 12: Constraint 3**
- Do not introduce$\forall$on the basis of an individual (a constant).
---
#### **Slide 13: Constraint 4**
- Do not introduce$\forall$on the basis of an unknown.
---
#### **Slide 14: Constraint 5**
- Do not quantify a variable by introducing$\forall$in a formula if the formula contains another var obtained by eliminating$\exists$.
---
#### **Slide 15: Constraint 6**
- Within the scope of an assumption, do not introduce$\forall$on the basis of a variable appearing in the assumption.
---
#### **Slide 16: Constraint 7**
- Every instantiation, whether following the elimination of a$\forall$or$\exists$, must always be done with a free var, rather than a bound var.
---
#### **Slide 17: Constraint 8**
- Beware of binding any newly quantified var by an unintended quantifier.
---
#### **Slide 18: Summary**
- Use inference rules to eliminate and introduce logical connectives.
- Handle quantifiers carefully, following constraints when eliminating and introducing them.
---
#### **Slide 19: Summary of Constraints**
1. Do not assume a property holds for a particular individual based on it holding for at least one individual.
2. When eliminating$\exists$, do not instantiate its var with a constant or existing free var.
3. Do not introduce$\forall$on the basis of a constant or unknown.
4. Do not quantify a variable by introducing$\forall$if the formula contains another var from$\exists$elimination.
5. Within an assumption, do not introduce$\forall$based on a var in the assumption.
6. Instantiate variables only with free vars, not bound vars.
7. Avoid binding newly quantified vars by unintended quantifiers.
---
#### **Slide 20: Deducing a Conclusion**
Example:
1.$\forall x \cdot (\text{master}(x) \lor \text{slave}(x)) \Rightarrow \text{adult}(x) \land \text{man}(x)$
2.$\neg \forall x \cdot (\text{adult}(x) \land \text{man}(x))$
3.$\exists x \cdot (\neg (\text{adult}(x) \land \text{man}(x)))$
4.$\neg (\text{master}(x) \lor \text{slave}(x))$
5.$\neg \text{master}(x) \land \neg \text{slave}(x)$
6.$\neg \text{master}(x)$
7.$\exists y \cdot (\neg \text{master}(y))$
---

View File

@@ -55,13 +55,17 @@
# Modified Probability Estimates
- Consider attribute *outlook* for class *yes*
# $\frac{2+\frac{1}{3}\mu}{9+\mu}$
Sunny
# $\frac{4+\frac{1}{3}\mu}{9+\mu}$
Overcast
# $\frac{3+\frac{1}{3}\mu}{9+\mu}$
Rainy
- Each value treated the same way
@@ -73,13 +77,16 @@ Rainy
## Fully Bayesian Formulation
# $\frac{2+\frac{1}{3}\mu p_1}{9+\mu}$
Sunny
# $\frac{4+\frac{1}{3}\mu p_2}{9+\mu}$
Overcast
# $\frac{3+\frac{1}{3}\mu p_3}{9+\mu}$
Rainy
- Where $p_1 + p_2 + p_3 = 1$
- $p_1, p_2, p_3$ are prior probabilities of outlook being sunny, overcast or rainy before seeing the training set. However, in practice it is not clear how these prior probabilities should be assigned.
- Where $p_1 + p_2 + p_3 = 1$
- $p_1, p_2, p_3$ are prior probabilities of outlook being sunny, overcast or rainy before seeing the training set. However, in practice it is not clear how these prior probabilities should be assigned.

View File

@@ -27,20 +27,25 @@
| High | 2/5 | 1/9 | Red | 3/5 | 2/9 | | | | | | | | |
# Problem 1
# $Pr[Diagnosis=N|E] = \frac{2}{5} \times \frac{2}{5} \times \frac{4}{5} \times \frac{3}{5} \times \frac{5}{14} = 0.027428571$
# $Pr[Diagnosis = B|E] = \frac{3}{9} \times \frac{4}{9} \times \frac{3}{9} \times \frac{3}{9} \times \frac{9}{14} = 0.010582011$
# $p(B) = \frac{0.0106}{0.0106+0.0274} = 0.2789$
# $p(N) = \frac{0.0274}{0.0106+0.0274} = 0.7211$
# $p(N) = \frac{0.0274}{0.0106+0.0274} = 0.7211$
Diagnosis N is much more likely than Diagnosis B
# Problem 2
# $Pr[Diagnosis = N|E] = \frac{2}{5} \times \frac{1}{5} \times \frac{3}{5} \times \frac{5}{14} = 0.0171$
# $Pr[Diagnosis = B|E] = \frac{3}{9} \times \frac{6}{9} \times \frac{3}{9} \times \frac{9}{14} = 0.0476$
# $p(N) = \frac{0.0171}{0.0171+0.0476} = 0.2643$
# $p(B) = \frac{0.0474}{0.0476+0.0171} = 0.7357$
Diagnosis B is much more likely than Diagnosis N
@@ -48,4 +53,5 @@ Diagnosis B is much more likely than Diagnosis N
# Problem 3
# $Pr[Diagnosis = N|E] = \frac{0}{5} \times \frac{2}{5} \times \frac{4}{5} \times \frac{3}{5} \times \frac{5}{14} = 0$
# $Pr[Diagnosis = B|E] = \frac{5}{9} \times \frac{4}{9} \times \frac{3}{9} \times \frac{3}{9} \times \frac{9}{14} = 0.018$

View File

@@ -274,4 +274,4 @@ Root mean squared error 0.3223
Relative absolute error 70.1487 %
Root relative squared error 68.0965 %
Total Number of Instances 3
```
```

View File

@@ -12,6 +12,7 @@
# $a_i = \frac{v_i - minv_i}{maxv_i - minv_i}$
Where:
- $a_i$ is normalised value for attribute $i$
- $v_i$ is the current value for attribute $i$
- $maxv_i$ is largest value of attribute $i$
@@ -19,8 +20,10 @@ Where:
## Example
# $maxv_{humidity} = 96$
# $maxv_{humidity} = 96$
# $minv_{humidity} = 65$
# $v_{humidity} = 80.5$
# $a_i = \frac{80.5-65}{96-55} = \frac{15.5}{31} = 0.5$
@@ -28,8 +31,11 @@ Where:
## Example (Transport Dataset)
# $maxv_{doors} = 5$
# $minv_{doors} = 2$
# $v_{doors} = 3$
# $a_i = \frac{3-2}{5-2} = \frac{1}{3}$
# Nearest Neighbor Applied (Transport Dataset)
@@ -39,14 +45,18 @@ Where:
- Right most column shows euclidean distances between each vehicle and new vehicle
- New vehicle is closest to the 1st example, a taxi, NN predicts taxi
![](Pasted%20image%2020241010133818.png)
# $vmin_{doors} = 2$
# $vmax_{doors} = 5$
# $vmin_{seats} = 7$
# $vmax_{seats} = 65$
# Missing Values
## Missing Nominal Values
## Missing Nominal Values
- Assume missing feature is maximally different from any other value
- Distance is:
@@ -72,7 +82,7 @@ Where:
- Number of seats of one example = 16
- Normalised = 9/58
- One missing
- 1 - 9/58 = 49/58
- 1 - 9/58 = 49/58
## Normalised Transport Data with Missing Values
@@ -85,13 +95,13 @@ Where:
## Euclidean Distance
# $\sqrt{(a_1-a_1')^2) + (a_2-a_2')^2 + ... + (a_n-a_n')^2}$
# $\sqrt{(a_1-a_1')^2) + (a_2-a_2')^2 + + (a_n-a_n')^2}$
Where $a$ and $a'$ are two examples with $n$ attributes and $a'$ is the value of attribute $i$ for $a$
## Manhattan Distance
# $|a_1-a_1'|+|a_2-a_2'|+...+|a_n-a_n'|$
# $|a_1-a_1'|+|a_2-a_2'|++|a_n-a_n'|$
Vertical bar means absolute value
Negative becomes positive
@@ -109,4 +119,3 @@ Euclidean distance is generally a good compromise
- Does not detect noise
- Use k-NN, get k closest examples and take majority vote on solutions
![](Pasted%20image%2020241011131542.png)

View File

@@ -1,18 +1,21 @@
![](Pasted%20image%2020241011131844.png)
## Normalisation Equation
# $a_i = \frac{v_i - minv_i}{maxv_i - minv_i}$
## Euclidean Distance Equation
# $\sqrt{(a_1-a_1')^2) + (a_2-a_2')^2 + ... + (a_n-a_n')^2}$
# $a_i = \frac{v_i - minv_i}{maxv_i - minv_i}$
## Euclidean Distance Equation
# $\sqrt{(a_1-a_1')^2) + (a_2-a_2')^2 + … + (a_n-a_n')^2}$
# $vmax_{temp} = 85$
# $vmin_{temp} = 64$
# $a_{temp} = \frac{v_{temp} - 64}{21}$
# $vmax_{humidity} = 96$
# $vmin_{humidity} = 65$
# $a_{humidity} = \frac{v_{humidity} - 65}{31}$

View File

@@ -39,4 +39,4 @@ Root mean squared error 0.3409
Relative absolute error 90.9091 %
Root relative squared error 90.9091 %
Total Number of Instances 2
```
```

View File

@@ -18,6 +18,7 @@
## Selecting a Test
Goal: Maximise probability of desired class
- $t$ = total number of examples covered by rule
- $p$ = number of positive examples of the class covered by rule
- $t - p$ = number of errors made by rule
@@ -44,7 +45,7 @@ Stop Condition: $t-p=0$
![](Pasted%20image%2020241017131912.png)
#### Modified Rule and its Coverage
#### Modified Rule and Its Coverage
- Rule with best test added: If astigmatism = Yes and tear rate = Normal { then recommendation = Hard }
![](Pasted%20image%2020241017132019.png)
@@ -92,4 +93,4 @@ For each class C
- Default Rule
- If no rules cover example, prediction is the majority class (most frequent in training data)
- Conflict Resolution Strategy
- If more than one rule covers an example, select predicted class with highest recurrance in training data
- If more than one rule covers an example, select predicted class with highest recurrence in training data

View File

@@ -41,6 +41,7 @@ IF Income = 0-15k THEN risk = high
| debt = high | 4/6 |
| debt = low | 2/4 |
| **collateral = none** | **6/6** |
IF Income = 0-15k AND collateral = none THEN risk = high
| Credit History | Debt | Collateral | Income | Risk |
@@ -59,5 +60,3 @@ IF Income = 0-15k AND collateral = none THEN risk = high
| credit history = unknown | 1/4 |
| debt = high | 2/4 |
| debt = low | 2/4 |

View File

@@ -1,6 +1,7 @@
# Logarithms
$log_2X$ used for generating decision trees
- Power to which we have to raise 2 to get X
- When using, X will be probability between 0 and 1
- log of probability is always negative
@@ -48,19 +49,23 @@ $log_2X$ used for generating decision trees
- Given probability distribution, info required to predict an event is the distributions entropy
- Entropy gives the information required in bits
# $I(p_1,p_2,...,p_n)=-p_{1}\log_{2}p_1 -p_{2}\log_{2}p_2 ... -p_{n}\log_{2}p_n$
Where n = number of classes, and $p_1 + p_2 + ... p_{n} = 1$
# $I(p_1,p_2,,p_n)=-p_{1}\log_{2}p_1 -p_{2}\log_{2}p_2 -p_{n}\log_{2}p_n$
Where n = number of classes, and $p_1 + p_2 + … p_{n} = 1$
Minus signs included since output must be positive
### Expected Information for Outlook
- Outlook = Sunny
# $info([2,3]) = I(\frac{2}{5},\frac{3}{5}) = -\frac{2}{5}\log_2(\frac{2}{5}) - \frac{3}{5}\log_2(\frac{3}{5}) = 0.971 bits$
- Outlook = Overcast
# $info([4,0]) = I(\frac{4}{4},\frac{0}{4}) = -1\log_2(1) -0\log_2(0) = 0 bits$
- Outlook = Rainy
# $info([3,2]) = I(\frac{3}{5},\frac{2}{5}) = -\frac{3}{5}\log_2(\frac{3}{5}) - \frac{2}{5}\log_2(\frac{2}{5}) = 0.693 bits$
### Computing Information Gain

View File

@@ -1,2 +1 @@
![](Pasted%20image%2020241025132339.png)

View File

@@ -0,0 +1 @@

View File

@@ -1,21 +1,21 @@
1)
a) Binomial Distribution
b) Measures dispersion of probabilities with respect to a mean average value. Each possible value of S from 0 to N, the probability of observing S correct predictions given a sample of N independent examples of true accuracy P
2)
a) (150 + 180 + 420) / (150 + 180 + 420 + 30 + 50 + 50 + 40 + 50 + 30) = 0.75
# Variance of S $\sigma^2_S = N_p(1-p)$
# Variance of S $\sigma^2_S = N_p(1-p)$
# Std Dev of S $\sigma_S = \sqrt{N_p(1-p)}$
# Variance in F $\sigma_f = \frac{\sigma_S}{N} = \sqrt{\frac{N_p(1-p)}{N^2}} = \sqrt{\frac{p(1-p)}{N}}$
# Estimate of Predictive Accuracy $\mu_f = \frac{S}{N}$
# Successful Trials $S$
# Number of Trials $N$
750 Successes 1000 Trials
S = 750
S = 750
N = 1000
$\mu_f$ = 0.75
$\sqrt{(0.75 \times 0.25)/1000} = 0.0137$
@@ -25,9 +25,7 @@ $\mu_f \pm z \times \sigma_f = 0.75 \pm (1.28 \times 0.0137)$
$= 0.75 \pm 0.0175$
p lies between 73.25% and 76.75%, with 80% confidence.
3)
a)
Stratified Holdout, data split to guarantee same distribution of class values in training and test set
b)
Repeated Holdout, training and testing done several times with different splits. Overall estimate of predictive accuracy is average of predicted accuracy in different iteration
Repeated Holdout, training and testing done several times with different splits. Overall estimate of predictive accuracy is average of predicted accuracy in different iteration

View File

@@ -1,20 +1,23 @@
# Questions
A bit of confusion in our store which we haven't been able to find out is the Code S in the training, we are unsure where that would go or if it is even still used.
A bit of confusion in our store which we haven't been able to find out is the Code S in the training, we are unsure where that would go or if it is even still used.
- Purposefully write information wrong, call agent "Code S referral"
Churn option, loyalty bonus not clear, should say for leaving customers only.
Churn option, loyalty bonus not clear, should say for leaving customers only.
- Discretion, case by case.
Should have in-store device guides
Where can we feed-back suggestions
Where can we feed-back suggestions
- (Area Manager, or Manager)
If existing customer, can we use banking app for card information
Human Connection
- Treat how wanted to be treated
- Try hard for customers
- Be yourself (already do)
Why Tesco Mobile?
- People come to Tesco Mobile for our reliability, competitive deals and information we can give, but they stay for our consistent customer service and lack of hassle
- 1 in 100k official ofcom complaints
- EU roaming
@@ -24,6 +27,7 @@ Why Tesco Mobile?
- Convenience, people come with their shopping
Why
- Long standing MVMO (2003)
- 5m customers
- Clubcard prices
@@ -39,10 +43,12 @@ Love
- anytime upgrade
*********
Every upgrade, TM app.
Start pushing for 4G upgrades
Home insurance, show the excess compared to protect. Claim = higher insurance
Log notes as much as possible on carehub, open cases and close for everything less than inquiry
****
Excellent; Trustpilot
@@ -52,8 +58,11 @@ Network of the year, best customer service; Uswitch (3rd year)
# Consistency
Everyday, dedication, simple stuff.
## Pillars
### Customer Ready <<<<
- Not distracted, someone available in our shops all the time, unless impossible
- Not on phones all the time, browsing on computers, etc
- If cleaning for example, be ready to drop it quickly to serve a customer
@@ -64,7 +73,9 @@ Everyday, dedication, simple stuff.
- Stand up
- Understand the Customer's needs
- Engagement
### Safe and Legal
- Ensuring protection of PII
- CLEANING MODE? Quantum Stores!
- Must Informs
@@ -72,13 +83,17 @@ Everyday, dedication, simple stuff.
- mpro
- Fraud
- Panic Alarms
### Fit for Trade
- Professional
- POS > WGLL
- Standards
- Clean, Tidy
- Accessories and SIMs
### Walk out Happy
- Teaching rather than doing
- SmartSwitch > Public WiFi unsafe, banking.
- TM App
@@ -86,4 +101,3 @@ Everyday, dedication, simple stuff.
- App Activations
- More time with all customers
- Reduce unnecessary contact and visits

View File

@@ -1,10 +1,13 @@
# Questions to ask people
# Questions to Ask People
- Trade / Business Account?
- Colleague?
- Prioritise person over phone, dont ask "what phone do you have" as first question.
# Tesco Families
Roshni - Single, Cohabitance, Work, Middle (Class)
- Social schedule 10 activities per week, social
- Health wellness
- Phone 24/7
@@ -37,6 +40,7 @@ Dawn - Rich retired, working adults
- Pleasure in top quality, pays the best for gadgets.
# Understanding Customers
- Who are our customers
- Family composition
- Buying on behalf of someone else?
@@ -53,6 +57,7 @@ Dawn - Rich retired, working adults
- Researcher
# Consistent Conversations
1. Genuine and Transparent
2. Listen Actively and Empathetic
3. Focus on building relationships
@@ -64,6 +69,7 @@ Dawn - Rich retired, working adults
4. Provide Value and Solve Problems
# Pre-Welcome
Looking around, eye contact
Looking at phones rather than colleagues
On their phones outside the shop
@@ -79,7 +85,7 @@ Engagement
Warm Welcome
Understand Needs
# What you See
# What You See
Clothing
Uniform
@@ -88,7 +94,7 @@ Sports Watch
Shopping Basket
Family
# What you hear
# What You Hear
Most needed apps
Hobbies
@@ -99,4 +105,4 @@ Pets
# Network Switch-Off
Get people on new 4G handsets, 2G unreliable to recommend.
Get people on new 4G handsets, 2G unreliable to recommend.

View File

@@ -93,6 +93,7 @@ Want to think about it - Urgency, deal only on for x days.
- Device Helps
- WebChat & Customer Care
- SMS Support
## Set up Customers
Turn on WiFi calling & VoLTE
@@ -126,10 +127,11 @@ Factory reset customer's phone.
# Returning Customers
Sales IS more important than service. Service will bring people through the door, but 50 served with 0 sales < 5 served with 5 sales.
Sales IS more important than service. Service will bring people through the door, but 50 served with 0 sales < 5 served with 5 sales.
Mediocre / Good NPS in exchange for more sales is unfortunately a good thing.
Why do customers return to your store?
- CCP, satisfied with pricing.
- Communications sent to them.
- Happy with customer service.
@@ -137,5 +139,6 @@ Why do customers return to your store?
- Physical stores, can see phones and reps.
- Consistent colleagues, customer knows what they're going to get.
# Growth vs Fixed Mindset
![](Pasted%20image%2020250129154055.png)
# Growth Vs Fixed Mindset
![](Pasted%20image%2020250129154055.png)

View File

@@ -0,0 +1,79 @@
### Lecture 1 - Overview and Basic Skills
The lecture focused on the importance of soft skills in career development, exploring communication, problem-solving, and time management with the goal of equipping us with knowledge to enhance our employability and prepare for professional environments.
The most relevant aspect of the session to me was the emphasis on soft skills like interpersonal communication and adaptability. As a computer scientist, these skills require enhancement to further increase employability. I also acknowledge that my ability to reflect on performance could be improved. For example, I struggle with time management and self-organisation during note taking and assignments.
While I feel I excel in problem solving, I need to work on my communication, priorities and self reflection habits; I plan to implement a structured note-taking system using digital tools, such as Obsidian, to improve my time management. Additionally, I will practice reflective writing to gain better understanding of my progress as I learn.
### Lecture 2 - CVs and Placements
The lecture focused on creating effective CVs, writing covering letters, and preparing for interviews with the goal of helping us present ourselves professionally, increasing our chances of securing job placements. The CV section stood out to me, since it applies to me the most. I learned that a CV is not a list of qualifications, but a tool to give good impressions, helping employers see how my skills align with their needs. One area I need to work on is highlighting achievements, not just duties. For example, knowing certain languages and having relevant experience - these are definitely selling points, however by incorporating metrics alongside actions, will make my CV more impactful. Additionally, I appreciated the emphasis on proofreading and clarity; I regularly overlook key requirements in briefs and skip important points. Implementing checklists for proofreading and checking grammar with tools will help improve the professionalism of my CV.
### Lecture 3 - Skills Audit
The lecture focused on understanding the importance of both soft and hard skills for computer science students, with the goal of identifying current skills, recognising gaps, and outlining actions to enhance employability. From this, I recognise my communication and interpersonal skills lack development, requiring me to rely on my problem solving, given my computer science background. For this reason, I am actively seeking out employment that will fall outside of my comfort zone to bridge this skill gap. This approach will force me to be more adaptable and versatile, developing skills I lack. Additionally, I plan to utilise the STAR technique to articulate my skills more effectively in both technical and non-technical situations by reflecting on past experiences, such as assignment feedback; Hack Camp will be perfect for this. I also acknowledge my existing skills, such as problem-solving and technical analysis, can always improve. I have just subscribed to TryHackMe, to address skill gaps in my learning.
### Lecture 4 - Personal Branding
The lecture on personal branding was both insightful and challenging. It made me think about how my actions and values shape the way others perceive me, especially in a professional context. The idea of my personal brand being something others can recognise and remember stuck with me. I appreciated the emphasis on authenticity. It made sense that my brand should reflect who I truly am, not some polished image I try to project. The suggestion to Google myself and see what others see was eye-opening—I hadnt thought about how my online presence might influence first impressions. However, I felt a bit overwhelmed by the idea of being "remarkable." The lecture mentioned that 70% of employers use social media to screen candidates, which is a stark reminder of how much my online presence matters. Im not sure how to start building that consistent, professional image across platforms like LinkedIn and social media. The STAR technique for articulating skills was also valuable. I can see how using this method in interviews would help me demonstrate my abilities more effectively. Its a practical tool that I plan to incorporate into my next application. Overall, while the concepts are daunting, they inspire me to take control of my professional identity. I need to be more intentional about how I present myself online and in person. Its a lot to juggle, but Im ready to take the first steps towards crafting a personal brand that truly reflects who I am.
The lecture focused on personal branding and its importance in career development, along with creating a compelling personal brand with the goal of enhancing self-awareness, identifying strengths and values, and learning how to effectively present it in a professional environment.
The concept of personal branding was intriguing, since I have only ever written basic CVs and a LinkedIn. Personal branding is more than listing skills on a CV; it involves presenting myself in a way that stands out and creates a lasting impression.
I was particularly inspired by the idea that my personal brand is how others perceive me, not just how I see myself. This realization is crucial for my sales role, where building rapport and trust with customers is key. I realized that consistently projecting a positive image online and in person will help me stand out in a competitive market.
One area I need to work on is aligning my personal values with my professional brand. For example, I value integrity and empathy in sales, but I need to ensure these values are evident in every interaction. Reflecting on the STAR technique (Situation, Task, Action, Result) helped me see how my actions can demonstrate these values effectively.
Additionally, I need to leverage my technical skills from computer science to position myself as a well-rounded professional. By showcasing both my technical expertise and interpersonal skills, I can appeal to a broader range of opportunities in the job market.
The concept of archetypes was insightful. I identified with the Hero archetype, which aligns with my goal of making a meaningful impact in both my academic and professional journeys. This has motivated me to start crafting a personal brand statement that reflects my values, strengths, and aspirations.
Overall, this session has equipped me with practical tools to develop a personal brand that is authentic and impactful. I plan to use platforms like LinkedIn to consistently share content, engage with industry professionals, and showcase my unique value proposition.
### Lecture 5 - CV's, Placements & Applications
As a computer science student, I recently attended a lecture focused on enhancing my CV, effective placement strategies, and the job application process. The session provided valuable insights into how to present my skills attractively to employers and secure meaningful placements.
The lecture emphasized the STAR method for structuring a CV, advising against generic applications and encouraging tailored content aligned with specific job descriptions. I appreciated the practical examples of good CV practices, such as highlighting relevant academic modules and experiences.
Regarding placements, the speaker highlighted resources like Handshake for job listings and suggested starting early to grasp opportunities. This resonated with my proactive approach, as I have been updating my CV and preparing for interviews by reflecting on past experiences in student societies and part-time work.
I found the lecture's focus on continuous learning and adaptability particularly relevant. It encouraged me to seek out tech companies recruiting in our area and highlighted the importance of research in tailoring applications. This has inspired me to be more proactive in my job hunt, ensuring each application is customised and keyword-rich.
Overall, the lecture provided actionable steps that have positively influenced my job hunting strategy. I am now more equipped to present myself effectively and navigate the application process with confidence, aligning my skills with industry needs for a successful future career.
### Lecture 6 - Peak Performance
The session focused on enhancing personal peak performance through goal-setting, possibility thinking, and developing a growth mindset. It aimed to empower attendees with tools for overcoming self-limiting behaviours and fostering lifelong learning.
The most interesting content was the concept of "possibility thinking," which encourages envisioning a world as open and positive rather than limited. This approach can be particularly valuable in a computer science context, where innovation and adaptation are key. Learning how to set clear goals and create affirmations to reinforce progress was also transformative.
Reflecting on my own journey as a computer science student, this session has made me more aware of the importance of embracing new possibilities and challenging my own limits. I plan to apply the "4As" framework (Acknowledge, Analyse, Assimilate, Apply) to better engage with academic materials and identify areas for improvement. This reflection highlights my commitment to continuous growth and resilience in pursuit of my career goals.
### Lecture 7 - Psychometric Testing
### Lecture 8 - Self Management Skills
### Lecture 9 - Working in Industry
### Lecture 10 - Professional Presence - LinkedIn
### Lecture 11 - International Opportunities
### Lecture 12 - Emotional Intelligence
### Lecture 13 - Art of Freelancing
### Lecture 14 - Professionalism and Confidence
### Lecture 15 - Assessment Insights (hmm..)
### Lecture 16 - Placement Insights and Career Journey
### Lecture 17 - Fear and Loathing in the Tech Community
### Lecture 18 - Effective Networking
### Lecture 19 - 11 P's to Success in Industry

View File

@@ -0,0 +1,51 @@
### **Plan for Final Self-Assessment Report and Weekly Reflective Diary**
#### **1. Final Self-Assessment Report**
- **Step 1:** Review the soft skills mentioned in your module (e.g., communication, teamwork, adaptability, critical thinking, problem-solving).
- **Step 2:** Identify which skills you feel comfortable claiming you possess and which ones you need to develop further.
- **Step 3:** For each skill:
- Assess your current level (high, medium, low).
- Provide a personal example using the STAR method (Situation, Task, Action, Result).
- Plan specific steps to improve (SMART goals).
- **Step 4:** Organize your report using the structure provided:
- Introduction
- List of skills (5-8)
- For each skill: assessment, reflection, example, and improvement plan.
- Concluding remarks.
### **Final Self-Assessment Report Structure**
1. **Introduction (Approx. 100 words):**
- Briefly introduce the purpose of the report.
- Mention the soft skills you will discuss (e.g., communication, teamwork, adaptability).
- State your overall approach to self-assessment.
2. **List of Skills (Approx. 200 words):**
- Choose 5-8 soft skills relevant to your context (e.g., communication, teamwork, adaptability, time management, emotional intelligence).
- For each skill:
- **Assessment:** Provide your current level (high, medium, low) with a brief explanation.
- **Reflection:** Discuss your thoughts on this skill and how it applies to your life.
- **Example:** Use the STAR method to describe a personal experience where this skill was demonstrated.
- **Improvement Plan:** Outline specific, SMART goals to enhance this skill.
3. **Concluding Remarks (Approx. 100 words):**
- Summarize your strengths and areas for development.
- Optionally, mention any additional skills you developed beyond the initial list.
---
#### **2. Weekly Reflective Diary**
- **Step 1:** Go through each week of your academic journey.
- **Step 2:** For each week:
- Describe the session or activity you attended.
- Reflect on what it meant for you (e.g., how it impacted your soft skills).
- Highlight the most useful part and what you learned.
- **Step 3:** Use reflective phrases provided in your lectures to structure your thoughts.
---
### **Additional Tips**
- **Revisit Resources:** Use the soft skills audit, personality test, and previous self-reflection reports to gather evidence.
- **Be Honest:** Be truthful about your strengths and areas for improvement.
- **Be Specific:** Use concrete examples and SMART goals to make your plans actionable.

View File

@@ -8,23 +8,23 @@
### **2. Current Soft Skills**
- **2.1 Problem-Solving**
- Define problem-solving as the ability to identify and resolve issues effectively.
- **Evidence**: Discuss how building and deploying virtual machines and Docker applications often required troubleshooting issues such as configuration errors or failed deployments. Highlight specific examples of challenges you resolved.
- **2.2 Communication**
- Define communication as the ability to convey information clearly and effectively.
- **Evidence**: Share examples from your phone shop role, such as explaining technical details to non-technical customers, resolving complaints, or ensuring customer understanding of credit and data protection policies.
- **2.3 Time Management**
- Define time management as the ability to prioritize tasks and use time effectively.
- **Evidence**: Highlight instances where you balanced multiple responsibilities, such as meeting deployment deadlines for technical projects while managing your commitments at the phone shop.
- **2.4 Adaptability**
- Define adaptability as the ability to adjust to new challenges or environments.
- **Evidence**: Provide examples of adapting to new tools or technologies in your technical work (e.g., learning Docker or new hosting systems) or adjusting to varied customer needs and situations in your shop role.
- **2.5 Attention to Detail**
- Define attention to detail as the ability to focus on accuracy and precision.
- **Evidence**: Mention your success in configuring virtual machines and Docker containers without critical errors, as well as ensuring compliance with credit and data protection regulations in your phone shop role.
@@ -59,4 +59,4 @@
---
This structure seamlessly integrates your strengths while providing space to address growth areas and future plans.
This structure seamlessly integrates your strengths while providing space to address growth areas and future plans.

Binary file not shown.

Submodule Client Server Systems/Ecobuddy updated: 8de2b7f29e...709596eea2

View File

@@ -5,6 +5,7 @@ This study guide provides an in-depth overview of the Abstract Data Type (ADT) L
## 1. Overview of Linear Lists
A linear list is a sequential collection of elements where each element can be accessed via an index. For instance, an instance of a linear list is represented as (e0, e1, e2, …, en-1), where:
- $e_i$ denotes the i-th element.
- $n$ is the finite size of the list, with n >= 0.
- $e_0$ is the first element and en-1 is the last.
@@ -54,6 +55,7 @@ Element[0], Element[1], Element[2], ...
### 5.1 Array-Based Implementation
The array-based implementation is straightforward:
- **Class Declaration**: Define a class for the ArrayLinearList.
- **Data Members**: Utilize a protected array (Object[]) for storing elements and a variable to track size.
- **Constructor Example**: Create constructors to initiate the list with a default or user-defined size.
@@ -68,6 +70,7 @@ A linked list version of the linear list provides dynamic memory allocation, whe
## 6. Method Implementations in ADT Linear List
Each method associated with the ADT Linear List is essential for its functionality:
- **isEmpty()**: Returns true if the size is 0.
- **size()**: Simply returns the count of elements.
- **get(int index)**: Requires validating the index with *checkIndex()* before accessing the array.

View File

@@ -11,13 +11,12 @@ A **data structure** is defined as an arrangement or organization of data in a c
An **abstract data type (ADT)** is a model that defines the high-level operations and characteristics of a data structure without delving into its implementation details. Before actually implementing a data structure, it is imperative to establish what operations the ADT should support. For instance, when creating a linked list ADT, one might specify operations such as:
- Inserting an item into the linked list.
- Deleting an item from the linked list.
- Searching for an item in the linked list.
- Checking if the linked list is empty.
This abstraction helps programmers focus on what functionalities the data structure must provide, rather than how those functionalities will be executed.
@@ -26,9 +25,8 @@ This abstraction helps programmers focus on what functionalities the data struct
Two significant programming principles are reviewed: **abstraction** and **modularization**. Abstraction allows programmers to handle complex systems by focusing on high-level functionalities rather than implementation specifics, while modularization aids in breaking down a problem into manageable components.
1. **Abstraction:** This concept helps in reducing complexity by allowing programmers to concentrate on essential aspects and ignore unnecessary details.
2. **Modularization:** By dividing problems into smaller sub-problems, programmers can tackle complex issues more efficiently.
**Encapsulation** works closely with these concepts by bundling data and methods that operate on that data into a single entity, such as a class in Java, thus hiding the internal state and requiring interaction only through specified methods.
@@ -37,21 +35,20 @@ Two significant programming principles are reviewed: **abstraction** and **modul
Several fundamental data structures form the backbone of programming:
- **Primitive Data Types:** These include Integers, Floats, Characters, and Booleans, which represent basic data values.
- **Composite Data Types:** These include essential data structures such as:
- **Arrays:** Collections of elements identified by indices, commonly used in mathematical contexts.
- **Linked Lists:** Data elements structured as nodes, each containing information and a link to the next node.
- **Stacks:** Last-in-First-out (LIFO) structures that allow insertion and deletion at one end, termed the top.
- **Queues:** First-in-First-out (FIFO) structures where insertion occurs at the rear and deletion at the front.
- **Trees:** Non-linear structures representing hierarchical relationships, ideal for organizing data hierarchically.
- **Graphs:** These consist of nodes and edges, representing pairwise relationships among elements.
## Concrete Implementations of ADTs
@@ -61,4 +58,4 @@ Within programming languages, data structures can act as concrete implementation
In software development, the foundation of a solution begins with the specification of a problem, followed by the formulation of an **algorithm**. An algorithm is a defined sequence of operations that transforms inputs into outputs, effectively addressing the problem. As programmers develop algorithms, they gain insights into which data structures may best suit their needs, leading to efficient solutions.
Ultimately, the understanding and application of data structures and ADTs are paramount in achieving effective software design and development, making them a cornerstone of efficient programming practices.
Ultimately, the understanding and application of data structures and ADTs are paramount in achieving effective software design and development, making them a cornerstone of efficient programming practices.

View File

@@ -1,27 +1,23 @@
## Advantages
- This has the advantage of making certain actions easier to perform but at the cost of increased maintenance of the code overall.
- Allows traversal of nodes in both direction which is not possible in singly linked list.
- Can allocate or de-allocate memory easily when required during its execution.
- It is one of most efficient data structure to implement when traversing in both direction is required.
## Disadvantages
## Disadvantages
- Using extra memory when compared to array and singly linked list.
- Slow in search as its elements are stored randomly in memory, hence elements are accessed sequentially (no direct access is allowed).
## ADT Liner list could be implemented by two ways:
## ADT Liner List Could Be Implemented by Two Ways:
- Array
- Used when you search is the highest priority
- Linked list
- Singly linked list
- Used when you addition/deletion is the highest priority
- Doubly linked list
- Used when you addition/deletion is the highest priority
- Navigate next and pervious
- Navigate next and previous

View File

@@ -28,37 +28,34 @@ For example, a constructor header like `public PrintWriter(String fileName) thro
At the core of Java's exception handling is the **Throwable** class, which serves as the superclass for all exceptions and errors. It has two key subclasses:
- **Error**: Indicates serious problems that a user application should not catch.
- **Exception**: Represents conditions that a user application might want to catch.
Within the Exception hierarchy, we find numerous subclasses such as **IOException** and **RuntimeException**, which themselves have numerous subclasses. For example:
- **IOException** can lead to specific exceptions like:
- **FileNotFoundException**
- **EOFException**
- **RuntimeException** encompasses:
- **ArithmeticException**
- **IndexOutOfBoundsException**
- **NullPointerException**
- **IllegalArgumentException**
## Dealing with Exceptions
Handling exceptions can be approached in two primary ways:
- **Catching the Exception**: This involves writing code to handle the exception immediately where it occurs. To achieve this, any potentially exception-generating code must reside within a **try** block, followed by one or more **catch** blocks that process the exception.
- **Propagating the Exception**: Alternatively, the method can propagate the exception, allowing higher levels of the program to handle it. This is done by throwing the exception again after catching it or not catching it at all.
### Catch Blocks Example
@@ -73,7 +70,7 @@ A fundamental aspect of handling exceptions is the use of a **try** and **catch*
> }
> ```
Here, _XXXException_ can be various types of exceptions, such as **IOException** or **RuntimeException**. When multiple types of exceptions can be thrown, several catch blocks can be utilized, ordered from the most specific to the most general. For instance:
Here, *XXXException* can be various types of exceptions, such as **IOException** or **RuntimeException**. When multiple types of exceptions can be thrown, several catch blocks can be utilized, ordered from the most specific to the most general. For instance:
> ```
> try {
@@ -127,4 +124,4 @@ In a sample application, if the main() method adds **throws IOException**, the m
## Final Thoughts on Exception Handling
Java's exception handling framework is robust and designed to enable developers to write code that can gracefully manage unexpected problems. This system incorporates custom exceptions using the **throw** keyword, enjoyable error messages, and fine-tuned control over program flow. The use of exception handling not only aids in maintaining the reliability of applications but also provides clearer diagnostic messages for debugging. Overall, proper understanding and implementation of Java exceptions are essential for writing resilient Java applications.
Java's exception handling framework is robust and designed to enable developers to write code that can gracefully manage unexpected problems. This system incorporates custom exceptions using the **throw** keyword, enjoyable error messages, and fine-tuned control over program flow. The use of exception handling not only aids in maintaining the reliability of applications but also provides clearer diagnostic messages for debugging. Overall, proper understanding and implementation of Java exceptions are essential for writing resilient Java applications.

View File

@@ -7,9 +7,8 @@ This study material provides a concise overview of the Abstract Data Type (ADT)
The Linear List can be implemented using different structures, including linked lists. The main focus here is on:
- Linear List based on LinkedList
- Doubly-linked list
Each of these implementations has its unique characteristics, advantages, and considerations.
@@ -18,13 +17,12 @@ Each of these implementations has its unique characteristics, advantages, and co
Understanding the size of primitive types is fundamental in memory allocation:
- **boolean & byte** - 1 byte
- **char & short** - 2 bytes
- **int & float** - 4 bytes
- **long & double** - 8 bytes
It's important to note that, in modern 64-bit Java Virtual Machines (JVM), the minimum size of an object is 16 bytes due to the header size and padding requirements.
@@ -33,9 +31,8 @@ It's important to note that, in modern 64-bit Java Virtual Machines (JVM), the m
When comparing Array Lists and Linked Lists:
- **Addition and Removal**: Linked Lists excel in scenarios where frequent addition and removal of elements are required due to their dynamic size and absence of resizing overhead.
- **Memory Overhead**: Linked Lists consume more memory because each node contains a reference to both the next and, in doubly-linked lists, the previous node, which increases complexity and size.
## Memory Allocation Concepts
@@ -52,48 +49,43 @@ A linked list is a collection of nodes where each node contains data and a refer
Some common operations performed on linked lists include:
- **Insertion**: Nodes may be inserted at the beginning, middle, or end of the list, requiring adjustments of pointers accordingly.
- **Removal**: Similar to insertion, removal requires accessing the right node and adjusting pointers to maintain list integrity.
### Algorithm Visualizations
Visual representations can help understand operations such as inserting or deleting nodes. For example, to insert a node in a linked list, one must:
1. Create the new node.
2. Adjust the pointers of the surrounding nodes to include the new node.
## Doubly-Linked Lists
Doubly-linked lists add an extra pointer, allowing traversal in both forward and backward directions, enhancing flexibility:
- **Advantages**: They can traverse in both directions and manage dynamic memory more efficiently.
- **Disadvantages**: They require more memory for pointers and tend to have slower access times due to their random memory allocation.
### Inserting and Deleting in Doubly-Linked Lists
The process of inserting or deleting nodes involves managing the **prev** and **next** pointers to maintain the structure of the list. As illustrated:
1. For insertion, properly link the new node with its neighbors.
2. For deletion, ensure that surrounding nodes bypass the removed node, effectively maintaining list integrity.
## Key Takeaways
In conclusion, choosing between an array and a linked list largely depends on the intended operations:
- **Arrays** are optimal for scenarios where quick search operations are prioritized.
- **Linked Lists** are preferred for scenarios where insertion and deletion operations are frequent, with variations including:
- **Singly Linked List**: Best suited for simple sequential access and minimal memory overhead.
- **Doubly Linked List**: Ideal when navigating both forwards and backwards is necessary.
Understanding these structures and their operations is essential for effective programming and data management.
- **Linked Lists** are preferred for scenarios where insertion and deletion operations are frequent, with variations including:
- **Singly Linked List**: Best suited for simple sequential access and minimal memory overhead.
- **Doubly Linked List**: Ideal when navigating both forwards and backwards is necessary.
Understanding these structures and their operations is essential for effective programming and data management.

View File

@@ -1,4 +1,5 @@
## What is an interface?
## What is an Interface?
- An interface is a device or a system that unrelated entities use to interact.
- A remote control is an interface between you and a television set.
@@ -6,10 +7,7 @@ basically the interface has and abstract method which classes have to implement
Concert realisation of the otherwise abstract method.
## What is a linked list?
## What is a Linked List?
- On the linked list every node is an object.
- Has more memory overhead than an ArrayList.
@@ -17,6 +15,6 @@ Concert realisation of the otherwise abstract method.
- It mainly allows efficient *insertion* and *deletion* operations compared to arrays
- Its dynamic, the size of it changes with every change.
# Protected
prevents the method to be used by anyone but its sub classes.
# Protected
prevents the method to be used by anyone but its sub classes.

View File

@@ -7,41 +7,38 @@ A queue is an important abstract data type (ADT) characterised by its FIFO (Firs
## Key Concepts of Queues
- **Structure:** A queue consists of two primary ends:
- _Front:_ The position from which elements are removed.
- _Rear:_ The position where elements are added.
- *Front:* The position from which elements are removed.
- *Rear:* The position where elements are added.
- **Core Operations:** The basic operations associated with a queue are:
- **isEmpty():** Checks if the queue is empty.
- **peek():** Returns the front element without removing it.
- **put(x):** Adds an element x at the rear of the queue.
- **remove():** Removes and returns the front element.
## Queue Applications
Queues have various applications due to their structure, such as:
- CPU and disk scheduling, where resources are shared among multiple consumers.
- Buffering in asynchronous data transfers like I/O operations, where data may not be received at the same rate as it is sent.
- Handling jobs in a network printer which generally follows a FIFO order.
## Queue Representation
Queues can be implemented in two ways:
- **Linear Array Queue:** Uses a one-dimensional array along with pointers for front and rear.
- **Circular Array Queue:** Employs a circular structure to efficiently utilize array space, preventing the needs of shifting elements when the array is full.
## Linear Queue Representation
@@ -56,20 +53,18 @@ Queue: A B C D (front = 1, rear = 4)
A circular queue, uses the following logic:
- Front points 'anti-clockwise' from the first element while rear points to the last inserted element.
- Utilizes the modulo operator to wrap around the indices as elements are added or removed.
## Implementation of a Circular Queue
The implementation comprises several stages:
1. **Initialization:** Set front and rear to 0.
2. **Insertion:** Update the rear index with a modulo operation. For example, rear=(rear+1)\%queue.length.
3. **Removal:** Increment the front index to remove an element.
## Challenges with Circular Queues
@@ -77,26 +72,25 @@ One of the critical issues with circular queues is distinguishing between a full
## Queue Implementation Using Array
The _ArrayQueue_ class illustrates array-based implementation:
The *ArrayQueue* class illustrates array-based implementation:
``` java
public class ArrayQueue implements Queue { ... }
```
This class defines data members like _front_ and _rear_, along with methods for manipulating the queue.
This class defines data members like *front* and *rear*, along with methods for manipulating the queue.
## Queue Methods Overview
Here are key methods defined in the Queue interface:
1. **isEmpty():** Returns true if the queue is empty.
2. **peek():** Returns the front element or null if the queue is empty.
3. **put(Object theObject):** Adds an element to the queue and may increase array length if the queue is full.
4. **remove():** Removes the front element and updates the front pointer to the next element.
## Queue Implementation Using Linked List
@@ -111,10 +105,9 @@ This structure provides constant time complexity for insertions and deletions, o
## Summarizing Queue Operations
- **Adding Elements:** In a linked implementation, a new node is created and linked appropriately.
- **Removing Elements:** The front element is removed and the front pointer is updated.
## Conclusion
Queues are fundamental data structures in computer science with a range of applications spanning from scheduling tasks to implementing buffers. Their efficient management of elements through well-defined operations supports numerous algorithms and data handling strategies in programming.
Queues are fundamental data structures in computer science with a range of applications spanning from scheduling tasks to implementing buffers. Their efficient management of elements through well-defined operations supports numerous algorithms and data handling strategies in programming.

View File

@@ -7,4 +7,4 @@
| The SLL occupies less memory than DLL as it has only 2 fields. | The DLL occupies more memory than SLL as it has 3 fields. |
| Complexity of deletion with a given node is O(n), because the previous node needs to be known, and traversal takes O(n) | Complexity of deletion with a given node is O(1) because the previous node can be accessed easily |
| A singly linked list consumes less memory as compared to the doubly linked list. | The doubly linked list consumes more memory as compared to the singly linked list. |
| Singly linked list is relatively less used in practice due to limited number of operations | Doubly linked list is implemented more in libraries due to wider number of operations. For example [Java LinkedList](https://www.geeksforgeeks.org/linked-list-in-java/) implements Doubly Linked List. |
| Singly linked list is relatively less used in practice due to limited number of operations | Doubly linked list is implemented more in libraries due to wider number of operations. For example [Java LinkedList](https://www.geeksforgeeks.org/linked-list-in-java/) implements Doubly Linked List. |

View File

@@ -1,35 +1,30 @@
# Overview
- A stack is ta LIFO list. Meaning "last in first out"
- Access is allowed only from one end of the stack
- adding an item is called pulsing the stack
- retrieving an item is called popping the stack
- Access is allowed only from one end of the stack
- adding an item is called pulsing the stack
- retrieving an item is called popping the stack
# Typical uses
# Typical Uses
- Parentheses matching; ()), or (())
- Parentheses matching; ()), or (())
- compiler's syntax check for matching braces is implemented by using stack
- The simplest application of a stack is to reverse a word.
- You push a given word to stack - letter by letter - and then pop letters from the stack.
- Another application is an "undo" mechanism in text editors;
-this operation is accomplished by keeping all text changes in a stack
- The simplest application of a stack is to reverse a word.
• You push a given word to stack - letter by letter - and then pop letters from the stack.
# Parenthesis Count
- Another application is an "undo" mechanism in text editors;
•this operation is accomplished by keeping all text changes in a stack
- Methodology (logical steps to solve the problem):
- scan expression from left to right;
- when a left parenthesis is encountered, add its position to the stack;
- when a right parenthesis is encountered, remove matching position from stack (more example in a moment).
# Parenthesis count
# Try-catch-throw
- Methodology (logical steps to solve the problem):
- scan expression from left to right;
- when a left parenthesis is encountered, add its position to the stack;
- when a right parenthesis is encountered, remove matching position from stack (more example in a moment).
# try-catch-throw
- When you enter a try block, push the address of this block onto a stack.
- When you enter a try block, push the address of this block onto a stack.
\
- When an exception is thrown, pop the try block that is at the top of the stack; if the stack is empty, terminate the program.
- If the popped try block has no matching catch block, go back to the previous step.
- When an exception is thrown, pop the try block that is at the top of the stack; if the stack is empty, terminate the program.
- If the popped try block has no matching catch block, go back to the previous step.
- If the popped try block has a matching catch block, execute the matching catch block.

View File

@@ -9,29 +9,17 @@ Linear lists, which include arrays and linked lists, are ideal for serially orde
### Examples of Hierarchical Data in Trees
- Corporate Structure:
- In a company, positions such as president, vice presidents, managers, etc., can be represented in a tree format.
- Object-Oriented Programming:
- In Java, classes form a hierarchy where the Object class is at the top, followed by subclasses.
## Tree Terminologies
Understanding tree terminologies is crucial for grasping more complex operations and implementations.
- **Depth:** The number of edges from the root node to a specific node. For example, if node G is three levels down from the root, its depth is 3.
- **Height:** The height of a tree is defined as the number of levels it possesses. A tree's maximum depth helps determine its overall height.
- **Degree of a Node:** This refers to the number of child nodes a specific node has. A tree where each node has a maximum of two children is termed a **binary tree**.
### Binary Trees
@@ -42,13 +30,8 @@ A binary tree is defined such that each node has at most two children, known tra
When analyzing binary trees, certain properties can be established:
- A binary tree of height h must have at least h nodes.
- In a full binary tree, each node has either two children or none. It contains the maximum number of nodes defined as 2^h - 1.
- The number of nodes and tree height relationship is succinctly expressed with the inequalities: h \leq n \leq 2^h -1.
## Binary Operations and Traversals
@@ -59,47 +42,31 @@ Performing operations on binary trees is essential to manage and manipulate data
Traversal techniques allow for processing each node in a specified order:
- **Pre-order Traversal:** Process the root, then traverse the left subtree, followed by the right subtree.
- **In-order Traversal:** Visit the left subtree first, then process the root, followed by the right subtree.
- **Post-order Traversal:** Traverse the left subtree, right subtree, and then process the root.
- **Level-order Traversal:** Process nodes level by level from the root down to the leaves.
### Arithmetic Expressions as Trees
Binary trees are particularly useful for representing arithmetic expressions. An _expression tree_ is structured such that:
Binary trees are particularly useful for representing arithmetic expressions. An *expression tree* is structured such that:
- Leaves represent operands.
- Non-leaf nodes denote operators.
- Subtrees represent sub-expressions.
## Conversion Between Expression Formats
Moving between infix, prefix, and postfix expressions requires constructing expression trees first.
1. Infix expression (a + b) can be converted to a postfix expression (a b +) by building the corresponding expression tree and performing a post-order traversal.
## Constructing Binary Trees from Traversals
Creating a binary tree from given traversals (like in-order and pre-order) involves recognizing patterns in the data:
- From in-order and pre-order traversals, one identifies the root and splits left and right subtrees accordingly.
- The process can illustrate various scenarios and result in multiple valid trees for the same traversal combinations.
## Conclusion
Tree data structures are indispensable in computer science, providing efficient methods for data organization, retrieval, and management. Understanding their properties and operations enables clearer problem-solving strategies and effective programming techniques.
Tree data structures are indispensable in computer science, providing efficient methods for data organization, retrieval, and management. Understanding their properties and operations enables clearer problem-solving strategies and effective programming techniques.

View File

@@ -1,50 +1,78 @@
# Interfaces, Linked Lists, Array Lists
## Definitions
### Interface
A contract that defines methods, field variables, return types, a class must implement. An example of this is the `List` interface in Java.
### Linked List
A data structure where nodes are linked using pointers. Each node contains data - storing a value, and pointer - referencing the next node (and previous in doubly linked).
#### Types
- Singly Linked (Unidirectional)
- Doubly Linked (Bidirectional)
- Circular Linked (Last node points to first node)
### Array List
A resizable array-based data structure where elements are stored in contiguous memory locations. Arrays allow for random access through an index corresponding to a location in the array. When capacity is exceeded, the list can resize dynamically.
## Difference between Linked and Array Lists
- Memory Allocation
- LL -> Dynamic; Array -> Contiguous
- Performance
- LL -> Good for Insert/Delete; Array -> Good for searching
## Use Case
### Linked List
#### Stacks / Queues
Linked lists can efficiently add or remove from either end.
- Stack: Singly Linked List, insert/remove at head. O(1)
- Queue: Doubly Linked List, efficient tail and head operations (enqueue dequeue)
#### Task Scheduling
- Dynamic data, removing / adding tasks easier with linked list
#### Undo Function
- Doubly Linked List, track user actions. move back or forward allows for easy undo / redo
### Array List
#### Database Caching
- Frequent random access, ideal for storing cached records.
#### Dropdown Menus
- Store and dynamically resize when elements need to be added to UI drop-downs that change based on input.
#### Inventory Systems
- Elements added or accessed without many deletions, Array List would allow for predictable resizing.
## Implementation
### Interface
```java
interface Interface {
void method();
int method2(int param)
}
```
### Linked List
```java
class Node {
int data;
@@ -80,7 +108,9 @@ class LinkedList {
}
}
```
### Array List
```java
import java.util.ArrayList;
class ArrayList {
@@ -168,11 +198,13 @@ class Stack {
```
## Parenthesis Matching
- Push opening brackets, closing brackets pop correspondingly, if no match, false.
## Dijkstra's Two-Stack Algorithm
- Eval parenthesized arithmetic expressions
- One stack operands
- One stack operators
- Processes expression by push/pop elements on stacks, eval subexpression when closing parenthesis encountered.
- Assumed expression is fully parenthesised
- Assumed expression is fully parenthesised

View File

@@ -1,4 +1,4 @@
# Write a Java method pop() for a stack implemented using an array.
# Write a Java Method pop() for a Stack Implemented Using an Array.
```java
public class Stack {

View File

@@ -4,6 +4,7 @@ To insert a node into a **binary search tree (BST)** while keeping the tree **ba
2. After insertion, **rebalance the tree** (if necessary) to ensure that it remains balanced. A tree is considered balanced if the height difference between the left and right subtrees of any node is at most 1 (this is the **balanced binary tree** or **AVL tree** property).
### **Given Binary Search Tree**:
```
10
/ \
@@ -21,6 +22,7 @@ We start by inserting **4** into the BST:
- 4 is greater than 2, so 4 will be placed as the **right child** of 2.
After insertion, the tree looks like this:
```
10
/ \
@@ -44,6 +46,7 @@ Since the tree is balanced at all levels, **no further rebalancing is necessary*
### **Final Balanced Tree**:
The final tree after inserting 4 is:
```
10
/ \
@@ -56,4 +59,4 @@ The final tree after inserting 4 is:
### **Conclusion**:
After inserting 4, the tree remains balanced and no rotations are needed.
After inserting 4, the tree remains balanced and no rotations are needed.

View File

@@ -1,6 +1,7 @@
# Describe a scenario where a stack data structure would be more suitable than a Queue
# Describe a Scenario where a Stack Data Structure Would Be More Suitable than a Queue
A **stack data structure** is more suitable than a queue in scenarios where you need to process items in a **Last-In, First-Out (LIFO)** order
### Scenario: **Undo Operation in Text Editors**
- **Description**: In text editors, when a user types, deletes, or performs other actions, these operations are stored so they can be undone in reverse order of execution.
@@ -36,5 +37,5 @@ A **stack data structure** is more suitable than a queue in scenarios where you
- A **queue** is more suitable when processing items in a **First-In, First-Out (FIFO)** order, such as serving customer requests or scheduling tasks.
- A stack is better when you need **reversal** or to **process the most recent element first**, such as undo operations, recursion, or browser backtracking.
Describe a scenario where a stack data structure would be more suitable than a
Queue
Describe a scenario where a stack data structure would be more suitable than a
Queue

View File

@@ -1,4 +1,4 @@
# What is a binary search tree, and how does it differ from a regular binary tree?
# What is a Binary search Tree, and how Does it Differ from a Regular Binary Tree?
### **Binary Search Tree (BST):**
@@ -38,6 +38,7 @@ A **Binary Tree** is a tree data structure where each node has at most two child
#### Binary Tree:
A binary tree with no ordering constraints:
```
10
/ \
@@ -45,11 +46,13 @@ A binary tree with no ordering constraints:
/
40
```
- Node values are not in any specific order.
#### Binary Search Tree:
A binary search tree:
```
10
/ \
@@ -64,13 +67,13 @@ A binary search tree:
---
### **Advantages of BST Over a General Binary Tree:**
### **Advantages Of BST Over a General Binary Tree:**
1. **Efficient Searching**: Searching in a BST takes $O(h)$, where $h$ is the height of the tree. In a balanced BST, $h=O(logn)$.
2. **Ordered Traversal**: In-order traversal of a BST produces the nodes in sorted order.
3. **Efficient Range Queries**: BSTs can efficiently find all elements within a specific range.
### **Disadvantages of BST:**
### **Disadvantages Of BST:**
1. If unbalanced (e.g., when nodes are inserted in sorted order), the BST can degrade to a linked list, resulting in $O(n)$ time for operations.
2. Maintaining balance (e.g., in AVL or Red-Black Trees) adds complexity.
2. Maintaining balance (e.g., in AVL or Red-Black Trees) adds complexity.

View File

@@ -1,8 +1,8 @@
# What is an interface in object-oriented programming and how does it differ from a class?
# What is an Interface in Object-oriented Programming and how Does it Differ from a Class?
### **What is an Interface in Object-Oriented Programming?**
### **What Is an Interface in Object-Oriented Programming?**
An **interface** is a contract in object-oriented programming (OOP) that defines a set of methods (and sometimes properties) that a class must implement. It specifies _what_ a class should do, but not _how_ it should do it.
An **interface** is a contract in object-oriented programming (OOP) that defines a set of methods (and sometimes properties) that a class must implement. It specifies *what* a class should do, but not *how* it should do it.
Key characteristics of an interface:
@@ -12,6 +12,7 @@ Key characteristics of an interface:
4. **No State**: Interfaces do not contain instance variables or state but may include constants.
#### Example in Java:
```java
// Define an interface
public interface Animal {
@@ -33,7 +34,7 @@ public class Dog implements Animal {
}
```
### **What is a Class?**
### **What Is a Class?**
A **class** is a blueprint for creating objects in OOP. It defines the structure (fields or attributes) and behavior (methods) of objects. Unlike interfaces, classes can have implementations, state, and behavior.
@@ -45,6 +46,7 @@ Key characteristics of a class:
4. **Constructors**: Classes can have constructors to initialize objects.
#### Example in Java:
```java
// Define a class
public class Dog {
@@ -73,13 +75,14 @@ public class Dog {
|**Constructors**|Cannot have constructors.|Can have constructors to initialize objects.|
|**Abstract**|Interfaces are entirely abstract (unless extended in modern versions).|Can be abstract or concrete.|
|**Default Methods**|Starting from Java 8, interfaces can have default methods (methods with a body).|Classes always support method implementation.|
### **When to Use an Interface?**
### **When To Use an Interface?**
- **Polymorphism**: When you want different classes to provide their specific implementation of the same behavior.
- **Decoupling**: To decouple code by relying on abstractions rather than concrete classes.
- **Multiple Inheritance**: When you need a class to inherit behavior from multiple sources.
### **When to Use a Class?**
### **When To Use a Class?**
- When you need to define an object with both state and behavior.
- When you need concrete implementations of methods.

View File

@@ -1,4 +1,4 @@
# Convert the infix expression A * (B + C) / D to a postfix expression
# Convert the Infix Expression A * (B + C) / D to a Postfix Expression
To convert the infix expression `A * (B + C) / D` into postfix notation, we use the following rules:
@@ -16,19 +16,20 @@ To convert the infix expression `A * (B + C) / D` into postfix notation, we use
#### Infix Expression: `A * (B + C) / D`
1. Start with the subexpression inside the parentheses `(B + C)`:
- Convert `B + C` to postfix: `BC+`.
2. Substitute the postfix for `(B + C)` back into the original expression:
- The expression becomes `A * BC+ / D`.
3. Process the multiplication (`*`) and division (`/`):
- `A * BC+` becomes `ABC+*`.
- `ABC+* / D` becomes `ABC+*D/`.
---
### **Final Postfix Expression**:
```
ABC+*D/
```

View File

@@ -1,4 +1,4 @@
# Evaluate the postfix expression `6 2 3 + -.`
# Evaluate the Postfix Expression `6 2 3 + -.`
### **Postfix Evaluation Rules**
@@ -13,25 +13,25 @@
**Expression**: `6 2 3 + -`
1. **Read `6`**:
- Push `6` onto the stack.
- **Stack**: `[6]`
2. **Read `2`**:
- Push `2` onto the stack.
- **Stack**: `[6, 2]`
3. **Read `3`**:
- Push `3` onto the stack.
- **Stack**: `[6, 2, 3]`
4. **Read `+`**:
- Pop the top two operands (`3` and `2`).
- Perform `2 + 3 = 5`.
- Push the result (`5`) onto the stack.
- **Stack**: `[6, 5]`
5. **Read `-`**:
- Pop the top two operands (`5` and `6`).
- Perform `6 - 5 = 1`.
- Push the result (`1`) onto the stack.
@@ -42,4 +42,3 @@
### **Final Result**:
The result of the postfix expression `6 2 3 + -` is **`1`**.

View File

@@ -1,6 +1,6 @@
# Compare and contrast a queue with a stack.
# Compare and Contrast a Queue with a Stack.
### **Comparison of Queue and Stack**
### **Comparison Of Queue and Stack**
|**Aspect**|**Stack**|**Queue**|
|---|---|---|
@@ -47,4 +47,4 @@
### **Summary**:
- A **stack** is suitable for tasks where the most recent action needs to be undone or processed first (**LIFO**).
- A **queue** is ideal for tasks where the first action needs to be processed first (**FIFO**).
- A **queue** is ideal for tasks where the first action needs to be processed first (**FIFO**).

View File

@@ -1,4 +1,4 @@
# Consider a min heap with these elements: [4, 5, 6, 7, 8, 9, 10]. Insert 3 into this min heap.
# Consider a Min Heap with These Elements: [4, 5, 6, 7, 8, 9, 10]. Insert 3 into This Min Heap.
In a **min heap**, the root node contains the smallest element, and every parent node is less than its children. When we insert a new element into a min heap, we follow these steps:
@@ -8,10 +8,13 @@ In a **min heap**, the root node contains the smallest element, and every parent
### Given Min Heap:
The given min heap is represented as an array:
```csharp
[4, 5, 6, 7, 8, 9, 10]
```
This corresponds to the following binary tree:
```
4
/ \
@@ -19,13 +22,17 @@ This corresponds to the following binary tree:
/ \ / \
7 8 9 10
```
### **Step 1: Insert 3 into the Heap**
First, insert 3 at the end of the heap:
```csharp
[4, 5, 6, 7, 8, 9, 10, 3]
```
This corresponds to the following binary tree:
```
4
/ \
@@ -35,6 +42,7 @@ This corresponds to the following binary tree:
/
3
```
### **Step 2: Bubble Up**
Now, we need to **bubble up** the element `3` to restore the heap property. We compare `3` with its parent and swap if necessary:
@@ -42,6 +50,7 @@ Now, we need to **bubble up** the element `3` to restore the heap property. We c
- The parent of `3` is `7` (index 3). Since `3 < 7`, we swap them.
After the swap, the heap becomes:
```
4
/ \
@@ -57,6 +66,7 @@ Now, we continue the bubbling up process:
- The parent of `3` is `5` (index 1). Since `3 < 5`, we swap them.
After the swap, the heap becomes:
```
4
/ \
@@ -86,6 +96,7 @@ After the swap, the heap becomes:
### **Final Array Representation**:
The final min heap as an array is:
```csharp
[3, 4, 6, 5, 8, 9, 10, 7]
```

View File

@@ -1,4 +1,5 @@
# Create an adjacency matrix for the following weighted undirected graph.
# Create an Adjacency Matrix for the following Weighted Undirected Graph.
```
A-3-B
| |
@@ -17,10 +18,10 @@ To create an **adjacency matrix** for the given **weighted undirected graph**, w
### **Graph Details**:
- **A -3- B**: There is an edge between A and B with weight 3.
- **A -2- C**: There is an edge between A and C with weight 2.
- **B -1- D**: There is an edge between B and D with weight 1.
- **C -4- D**: There is an edge between C and D with weight 4.
- **A -3B**: There is an edge between A and B with weight 3.
- **A -2C**: There is an edge between A and C with weight 2.
- **B -1D**: There is an edge between B and D with weight 1.
- **C -4D**: There is an edge between C and D with weight 4.
---
@@ -49,4 +50,4 @@ Let's map the nodes to indices:
- `B-D` has a weight of 1, so `matrix[1][3] = 1` and `matrix[3][1] = 1`.
- `C-D` has a weight of 4, so `matrix[2][3] = 4` and `matrix[3][2] = 4`.
This adjacency matrix accurately represents the weighted undirected graph.
This adjacency matrix accurately represents the weighted undirected graph.

View File

@@ -7,4 +7,3 @@ flowchart BT
iae[IllegalArgumentException] --> re
npe[NullPointerException] --> re
```

View File

@@ -4,4 +4,4 @@ Next job to be selected is one with highest prio
Add / Insert new item
Remove / Delete highest or lowest prio
Get / find highest or lowest prio
Get / find highest or lowest prio

View File

@@ -0,0 +1 @@

View File

@@ -3,6 +3,6 @@ ARP
Windows XP
ann-laptop
Microsoft Outlook
User:
User:
Asking to bring fake passport
Asking to bring fake passport

View File

@@ -21,10 +21,9 @@
- Either need multiple network numbers, or use subnets to pretend you have multiple network numbers
- One LAN per building, big network likely to be split into smaller networks. (Subnets)
255.0.0.0
/8
16.0.0.0
255.255.0.0
/16
255.255.255.0
255.255.255.0

View File

@@ -5,12 +5,13 @@
| Network | Internet | IP, ICMP |
| Data Link<br>Physical | Network Access | PPP<br>IP-over-ADSL<br>IP-over-Ethernet |
# Internet Protocol version 4
# Internet Protocol Version 4
- Connectionless packet oriented service
- Unreliable service, no guarantee of delivery
- Best effort, no error recovery
All packets routed independently
- Routers examine destination IP address and choose best route to forward packet
- Big packets fragmented, fragments routed separately
- Big packets fragmented, fragments routed separately

View File

@@ -1,4 +1,3 @@
| ubnet | Hosts | Addresses | Bits Required | Netmask | CIDR Netmask |
| ----- | ----- | --------- | ------------- | --------------- | ------------ |
| A | 23 | 25 | 5 | 255.255.255.224 | /27 |
@@ -6,6 +5,7 @@
| C | 18 | 20 | 5 | 255.255.255.224 | /27 |
| D | 31 | 33 | 6 | 255.255.255.192 | /26 |
| E | 73 | 75 | 7 | 225.255.255.128 | /25 |
Subnet E: 66.77.88.0/25
Range: 66.77.88.1 - 66.77.88.126
Broadcast: 66.77.88.127
@@ -123,4 +123,4 @@ Internet Connected Router = Y
| B | 66.77.89.0/29 | 66.77.89.1 |
| C | 66.77.88.224/27 | 66.77.88.225 |
| D | 66.77.88.128/26 | 66.77.88.128 |
| E | 66.77.88.0/25 | 66.77.88.1 |
| E | 66.77.88.0/25 | 66.77.88.1 |

View File

@@ -0,0 +1 @@

View File

@@ -3,4 +3,3 @@
- Created pattern of 2900 bytes, created slmail.py
- ![](Pasted%20image%2020250131145917.png)
-

View File

@@ -0,0 +1,9 @@
- In OWASP Broken Web Applications Project, use either the
- OWASP Mutillidae II
- or DVWA
- Demonstrate you can obtain a shell with the following
- An LFI vulnerability in the web application with file upload;
- An LFI vulnerability in the web application with contaminated logs; and
- An RFI vulnerability in the web application.
- Demonstrate attacks using SQL injection and Cross Site Scripting
- Provide documentation and proof of useful attacks in your report

View File

@@ -1,11 +1,9 @@
- “Scope” - describe what you intend to do and what you are aiming to find
- “Permission to test” - outline why you believe this is a legal and ethical thing for you to
do in this assignment (or describe if you have to do it in a particular way in order to make
sure you stay legal and ethical even if this will limit the amount of information that you
- “Scope” - describe what you intend to do and what you are aiming to find
- “Permission to test” - outline why you believe this is a legal and ethical thing for you to
do in this assignment (or describe if you have to do it in a particular way in order to make
sure you stay legal and ethical even if this will limit the amount of information that you
are able to find
| Action No | Scope: Summary of Intention | Permission to Test: Outline of Legal and Ethical Justification | Allow/Reject |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| 1 | I would use WHOIS / Recon-NG to find website registrar identities and the ASN of the company. This would provide me with a list of identities, and their emails, that may have access to infrastructure, or elevated permissions. | I believe this is legal as WHOIS is a public database of registrar information. No information found through WHOIS is sensitive, and has been published by the company, rather than found - no ethical issues with WHOIS | |

View File

@@ -43,4 +43,4 @@ Key component of ethical hacking and pentesting.
- ls - list items in directory
- enumdesktops - list all accessible desktops
- screenshot - grab screenshot of meterpreter desktop
- idletime - checks how long target has been idle
- idletime - checks how long target has been idle

View File

@@ -35,30 +35,34 @@ If source code not available:
- ESP - Stack pointer (last item on the stack)
- EBP - Stack frame base pointer and reference to arguments and local variables
- EIP - Pointer to the next instruction to execute (“instruction pointer”)
### Segment Registers
- CS : Holds the address to the Code segment of the program
- DS : Holds the address to the Data segment of the program
- SS : Holds the address to the Stack segment of the program
- CS : Holds the address to the Code segment of the program
- DS : Holds the address to the Data segment of the program
- SS : Holds the address to the Stack segment of the program
- ES,FS,GS : Hold the address to the extra segments
### Flags
- Zero Flag (ZF) - Set if the result of some instruction is zero; cleared otherwise.
- Sign Flag (SF) - Set equal to the most-significant bit of the result, which is the sign bit of a signed integer. (0 indicates a positive value and 1 indicates a negative value)
- Carry Flag (CF): Set if an arithmetic operation generate a carry or a borrow out of the most significant bit of the result, cleared otherwise
- Parity Flag (PF): Set if the least-significant byte of the result contains an even number of 1 bit, cleared otherwise.
- Overflow Flag (OF): Set if the integer result is too large a positive number or too small a negative number, excluding the sign bit, to fit in the destination operand, cleared otherwise. This flag indicates an overflow condition for signed-integer that is twos complement arithmetic.
- Zero Flag (ZF) - Set if the result of some instruction is zero; cleared otherwise.
- Sign Flag (SF) - Set equal to the most-significant bit of the result, which is the sign bit of a signed integer. (0 indicates a positive value and 1 indicates a negative value)
- Carry Flag (CF): Set if an arithmetic operation generate a carry or a borrow out of the most significant bit of the result, cleared otherwise
- Parity Flag (PF): Set if the least-significant byte of the result contains an even number of 1 bit, cleared otherwise.
- Overflow Flag (OF): Set if the integer result is too large a positive number or too small a negative number, excluding the sign bit, to fit in the destination operand, cleared otherwise. This flag indicates an overflow condition for signed-integer that is twos complement arithmetic.
- ![](Pasted%20image%2020250116093127.png)
### Push / Pop
PUSH src
- src operand can be a register or immediate
- In a DWORD scenario, the PUSH instruction automatically decrements the stack pointer by 4, i.e., sp <- sp-4
PUSH src
- src operand can be a register or immediate
- In a DWORD scenario, the PUSH instruction automatically decrements the stack pointer by 4, i.e., sp <- sp-4
POP src
- Src operand can be a register
- Src operand can be a register
- In a DWORD scenario, the POP instruction automatically takes a DWORD off the stack, puts in a register and increments the stack pointer by 4, i.e., sp <- sp+4
#### Examples of PUSH / POP
![](Pasted%20image%2020250116093226.png)
![](Pasted%20image%2020250116093312.png)

View File

@@ -1,53 +1,53 @@
1. **Introduction**
- Definition and reminder of key concepts from the previous week:
- Buffer Overflow: A process using more memory than it has been allocated.
- The Stack: Last-In-First-Out (LIFO) data structure where CPU registers can be stored and retrieved.
- ESP (Extended Stack Pointer): Points to the top of the stack at a lower memory location.
- EIP (Extended Instruction Pointer): Stores the address of the next instruction to be executed.
2. **Fuzzing**
- Fuzzing involves sending malformed data into an application input and watching for unexpected crashes.
- It helps discover vulnerabilities by sending varying lengths of data to identify buffer overflow conditions.
- Fuzzing tools and resources: FuzzDB (https://github.com/fuzzdb-project/fuzzdb).
- Fuzzing tools and resources: FuzzDB (<https://github.com/fuzzdb-project/fuzzdb>).
3. **Fuzzing Example: SLMail 5.5.0 Mail Server**
- Installed the vulnerable SLMail application.
- Used a Python fuzzer script (`fuzzer.py`) from Kali Linux to send varying-length passwords to the POP3 server.
- Employed Immunity Debugger to monitor the SLMail process and observe the stack overwrites.
4. **Controlling EIP (Extended Instruction Pointer)**
- Sent a unique, non-repeating string of 2900 bytes to identify the specific characters that overwrite the EIP register.
- Used Metasploits `pattern_create.rb` and `pattern_offset.rb` scripts to find the exact position of the overwritten EIP.
- Modified the buffer in the Python exploit script to control the EIP register: `buffer = "A" * 2606 + "B" * 4 + "C" * 90`.
5. **Find Space in Memory for Shellcode**
- Dumped the memory at the time of the crash to identify a suitable location for placing shellcode.
- Used Metasploits `msfvenom` tool to generate a payload for a reverse shell, ensuring it excluded bad characters identified earlier.
- Increased the length of the buffer to accommodate the generated shellcode.
6. **The Problem of Bad Characters**
- Identified bad characters (e.g., null byte `0x00`, newline `\n` `0x0A`, carriage return `\r` `0x0D`) that could truncate the shellcode or cause other issues.
- Sent all possible characters (0x00 to 0xff) as part of the buffer and observed how they were dealt with by the application after the crash.
7. **Generating the Shellcode Payload**
- Used Metasploits `msfvenom` tool to generate a shellcode payload with excluded bad characters.
- Included the generated shellcode payload into the Python exploit script.
8. **Redirecting the Execution Flow**
- Searched for a “JMP ESP” instruction or the two-instruction sequence “PUSH ESP; RET” within SLMails modules using Immunity Debugger and Mona.py script.
- Found a suitable JMP ESP instruction at address `5F4A358F` in the SLMFC.DLL module.
- Replaced the overwritten EIP ("B"s) with the discovered JMP ESP address in the exploit script.
9. **NOP Sled**
- Added a sequence of No Operation (NOP) instructions (`0x90`) at the beginning of the shellcode to create a “NOP sled.”
- This allowed for some flexibility in transferring execution to the shellcode without precisely controlling branching.
10. **Getting a Shell**
- Set up a netcat (nc) listener on the attacker machine to receive incoming connections from the exploited target.
- Ran the exploit script against the SLMail application, and upon successful exploitation, obtained a shell on the target machine.
11. **Assignment Task 1**
- Students were tasked to develop a working exploit for the `VulnNewApp.exe` application using the provided proof-of-concept script (`vulnapp_POC_script.txt`) and document their process in a report, including screenshots of each step.
Throughout the lecture slides, the document emphasizes hands-on learning and practical exercises using tools like Kali Linux, Immunity Debugger, Metasploit Framework, and Python scripting. It covers essential concepts in exploit development, buffer overflows, and fuzzing to help students understand and apply these techniques in network penetration testing.
Throughout the lecture slides, the document emphasizes hands-on learning and practical exercises using tools like Kali Linux, Immunity Debugger, Metasploit Framework, and Python scripting. It covers essential concepts in exploit development, buffer overflows, and fuzzing to help students understand and apply these techniques in network penetration testing.

View File

@@ -9,7 +9,7 @@
- Start SLmail on Windows 7 VM.
- Run Immunity Debugger as an administrator. To make the font more legible, right-click on the black area > appearance > font > OEM.
4. **Attach SLmail to ID:**
- In Immunity Debugger, go to `File > Attach...`, select the SLmail process, and click 'Open'.
- In Immunity Debugger, go to `File > Attach`, select the SLmail process, and click 'Open'.
- Set the debugger to "Running" state by clicking on the "Running" button in the toolbar.
5. **Run the fuzzer:**
- Open a terminal on Parrot OS and navigate to the scripts directory.
@@ -41,10 +41,10 @@
- Use `!mona find -s "\xff\xe4" -m slmfc.dll` to search for the FF E4 opcode in slmfc.dll and choose an address (e.g., `0x5f4a358f`) as the new EIP.
14. **Prepare exploit script:**
- Replace `Bs` in the exploit script (e.g., `exploit.rb`) with the address chosen earlier.
- Add a NOP sled (e.g., `\x90` _16_) before the JMP ESP address to account for any slight miscalculations or fluctuations in memory layout.
- Add a NOP sled (e.g., `\x90` *16*) before the JMP ESP address to account for any slight miscalculations or fluctuations in memory layout.
- The exploit script should look something like this: `"\x90" * 16 + "\xff\x\xe4" + "\xbe\xxx\xxxx\xxx\xxx"`. Replace `Bs` with the chosen address.
15. **Start netcat listener:**
- On Parrot OS, run `nc -lvp 443` to start a netcat listener on port 443.
16. **Run exploit:**
- Execute the prepared exploit script with `ruby exploit.rb <Windows 7 VM IP address> 49500`.
- Once the exploit triggers, you should get a shell on the Windows 7 VM.
- Once the exploit triggers, you should get a shell on the Windows 7 VM.

View File

@@ -6,14 +6,15 @@ Stack = LIFO structure where CPU registers are stored at and retrieved from
Can inject malicious code using buffer overflow
# Fuzzing
- Sending malformed data into application input and watching for unexpected crashes. Unexpected crash indicated application might not filter certain input correctly.
- To develop an exploit for application X on OS Y,
- Sending malformed data into application input and watching for unexpected crashes. Unexpected crash indicated application might not filter certain input correctly.
- To develop an exploit for application X on OS Y,
- X, Y and debugger needed on same VM
- Another VM to fuzz the target VM
- Cant do remotely on running server (though if developed correctly, exploit should work on any instance of application X running on OS Y)
## SLMail
Using a python script, we can repeatedly connect to the POP3 server, attempting to send varying length growing buffer to the password field each time
Unauthenticated user can attempt to login providing a long password.
@@ -23,20 +24,18 @@ The EIP register has been overwritten with opur input buffer of A's (\\x41)
As EIP register controls execution flow of application, if we make our exploit buffer carefully, could divert execution of the program to a place in memory where reverse shell code can be introduced in memory.
## Controlling EIP
- Getting control of the EIP register is an important part of exploit development
- Need to find out which A characters ended up in the EIP and identify the location of 4 unique bytes that overwrite the EIP Register.
- Can send 2900 bytes of unique non-repeating characters.
- User pattern_create.rb script in Kali to generate such a string:
- `/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 2900`
- Using this unique stream of characters, instead of our 2900 A's into our python script, check EIP overwrite in debugger.
- Note ESP and EIP register values in next crash
- EIP has been replaced by the 39694438 hex characters, equivalent to 8Dj9
- We need to find exact position of these characters.
- Can now use the pattern_offset.rb script along with the create script to discover the offset of these specific 4 bytes in our unique byte string.
- `/usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 2900 -q 39694438`
- Sending this new buffer to SLMail POP3 server produces a crash in the debugger.
- Check ESP and EIP registers
- This time ESP has different value to first crash
@@ -44,7 +43,8 @@ As EIP register controls execution flow of application, if we make our exploit b
- How to direct execution flow?
- Would like to include our own shell code inside buffer and redirect program flow to execute our shell code.
### Find Space in memory for Shell Code
### Find Space in Memory for Shell Code
- By dumping memory at time of crash, ESP register points directly to beginning of our buffer of C's. Seems like a convenient location to place shellcode as easily accessible through EIP register.
- Metasploit framework can automatically generate shellcode payloads, standard Reverse Shell payload requires around 350-400 bytes of space.
- Need to increase length of buffer to make room for reverse shell.
@@ -57,11 +57,10 @@ As EIP register controls execution flow of application, if we make our exploit b
- Depending on application, vuln type, and protocols, there may be certain characters that are considered bad and should not be used in our buffer, return address or shell code.
- Common example is null (0x00). Characters truncate shellcode in memory
- Easy way to check this is sending all possible characters, from 0x00 to 0xff as a part of our buffer and see how these characters are dealt with by the application after the crash occurs.
- A file containing all the possible hex characters can be found on Blackboard.
- When including these in python exploit code, we will see the characters that get truncated in Immunity Debugger
- One observation is that resulting memory dump for the ESP register shows that the character 0x0A seems to have truncated the rest of the buffer than comes after it.
### Generating Shellcode Payload
- Metasplot Framework provides us with tools and utilities that make generating complex payloads a simple task.
- Metasplot Framework provides us with tools and utilities that make generating complex payloads a simple task.

View File

@@ -81,16 +81,19 @@ Malicious script sent to user
- Recommendations for session IDs (OWASP)
### Method
Log in to application
Provide service, user stays logged in
Email info about session ID
Other user can access website as first user
### Fixes
- Authentication linked to time
- OWASP recommendations followed
- Link session ID to IP address, TLS session, etc.
Reconnaissance Assignment
## [OWASP Top-10](https://owasp.org/Top10/) Web Application Risks (as of 2017):
- Injection, Broken Authentication, Sensitive Data Exposure, XML External Entity (XXE), Security Misconfiguration, Cross-Site Scripting (XSS), Insecure Deserialization, Using Components with Known Vulnerabilities, Insufficient Logging & Monitoring
@@ -109,4 +112,4 @@ Tampering - Can an attacker modify data as an application runs?
Repudiation - If an attacker denies interaction, can we prove it?
Information Disclosure - Can an attacker gain PII?
Denial of Service - Can an attacker crash or reduce availability?
Elevation of Privilege - Can an attacker assume the identity of a privileged user?
Elevation of Privilege - Can an attacker assume the identity of a privileged user?

View File

@@ -0,0 +1 @@
![](Pasted%20image%2020250207142220.png)

View File

@@ -0,0 +1,90 @@
**Slide 1: Penetration Testing Process**
- **Phases of Penetration Testing**:
- Pre-engagement (1)
- Agreement on rules of engagement, scope, and objectives.
- Intelligence gathering (2)
- Passive reconnaissance: Information collected without interacting with the target.
- Tools: Search engines, social media, DNSdumpster, etc.
- Active reconnaissance: Information collected by interacting with the target.
- Tools: Nmap, Zenmap, Wireshark, etc.
- Threat modeling (3)
- Identifying potential threats and vulnerabilities in the target system.
- Vulnerability scanning (4)
- Automated testing to identify vulnerabilities in the target system.
- Tools: Nessus, OpenVAS, etc.
- Exploitation (5)
- Using exploits to gain unauthorized access to the target system.
- Tools: Metasploit, Burp Suite, etc.
- Post-exploitation (6)
- Maintaining access to the target system and gathering sensitive information.
- Tools: Mimikatz, BloodHound, etc.
**Slide 2: Public Exploits**
- **Finding reliable exploits**:
- SecLists (<https://seclists.org/>)
- Exploit-DB (<https://www.exploit-db.com/>)
- **Offline exploit DB in Kali**:
- `searchsploit` command
```
searchsploit <keyword>
```
**Slide 3: Compiling Exploits**
- **Cross-compiling for Windows**:
- Use `gcc` with specific flags to compile for Windows.
```
gcc -o exploit.exe exploit.c -m64 -lwininet
```
- **Lab Activity**: Fix and compile `646.c` to exploit SLMail on Windows 7 lab machine.
**Slide 4: Penetration Testing Execution Standard (PTES)**
- **Phases of PTES**:
- Pre-engagement
- Intelligence gathering
- Threat modeling
- Vulnerability scanning
- Exploitation
- Post-exploitation
- Reporting
**Slide 5: Post-Exploitation**
- **Goals of post-exploitation**:
- Determine the value of the compromised machine.
- Maintain control for later use.
- Identify and document sensitive data.
- Set up access methods for later use.
**Slide 6: Infrastructure Analysis**
| Category | Information to gather |
| --- | --- |
| Network information | Configuration, interfaces, routing, DNS servers, ARP entries, proxy servers, listening services, neighbour discovery protocols, wireless keys |
| Pillaging | Startup items, login items, security services, file and print shares, databases, source code management systems, virtualisation, messaging systems, backup systems |
| Documents | Spreadsheets, word documents, databases, password files |
| History | Command history, USB activity, web history, patching history; log files, bookmarks |
| Monitoring | Key logging, screen capture, webcam access, network traffic capture |
**Slide 7: Escalation and Persistence**
- **Privilege escalation techniques**:
- Exploit higher privileged process.
- Inject into higher privileged DLL.
- Overwrite higher privileged executable file.
- Trojan, rootkits, backdoor account/service.
- **Persistence techniques**:
- Reverse shell to single IP.
- Backdoor service that survives reboot.
**Slide 8: Moving Things Around**
- **Uploading/downloading files**:
- Use FTP with Kali acting as an FTP server.
- **Privilege escalation example**:
- `useradd.c` exploit for Windows 7 lab machine.
**Exercise**: Complete the lab activity on privilege escalation using `useradd.c` and verify high privilege access.

Some files were not shown because too many files have changed in this diff Show More