Notes, summaries, assignments, exams, and exercises for Computer science for University

Understanding the Relational Database Model and Its Features

Computer science3.1 KB

Relational Model: This approach allows users to obtain information from the database without assistance from information management professionals. The data is stored in a way that makes it easier for users to understand. The data is organized as tables, and the relationships between the rows and tables are visible in the data.

Features of Relational Models
It is important to know that the entries in the table are atomic. All entries in any column are of a single type. The table columns are called attributes. No two rows in the table are identical.

Structure of Relational Databases
The relational database model, at the conceptual level, is represented by a collection of stored relations.

Submodel Data
External schemas of relational sub-models are...

Continue reading "Understanding the Relational Database Model and Its Features" »

Multimedia Architecture and JPEG Compression Methods

Computer science1.46 MB

Global Structure of Multimedia Systems

The Global Structure of Multimedia represents the overall organization of multimedia systems into different domains that work together to capture, process, store, transmit, and present multimedia information.

It provides a framework for understanding how multimedia components interact within a multimedia environment.

8YzfipAAAABklEQVQDAD69+mtfIzhYAAAAAElFTkSuQmCC

Main Domains of Multimedia Structure

  • Device Domain
  • System Domain
  • Application Domain


JPEG Compression Process Steps and Examples

j+Npku3hg9AAAAAElFTkSuQmCCAAChDREAAABDYXB0dXJlZF9BcHBfSW5mb2V5SmpiMjF3SWpvaVkyOXRMbWhoYlhKdlkzTnBkRnd2TGsxaGFXNUJZM1JwZG1sMGVTSjkAAFEMFAAAAFNhbXN1bmdfQ2FwdHVyZV9JbmZvU2NyZWVuc2hvdAAAoQsYAAAAUGhvdG9FZGl0b3JfUmVfRWRpdF9EYXRheyJvcmlnaW5hbFBhdGgiOiJcL2RhdGFcL3NlY1wvcGhvdG9lZGl0b3JcLzBcLzM3NTAyYTUwMTY3ZjhhZDZhMDRkZTY5MWVmZmZkY2IzZTljN2JiYzQyNDY3ZmM3NDc1ZTIwNDM3NmQzNGE0MzhfNjI1MzMucG5nIiwicmVwcmVzZW50YXRpdmVGcmFtZUxvYyI6LTEsInN0YXJ0TW90aW9uVmlkZW8iOi0xLCJlbmRNb3Rpb25WaWRlbyI6LTEsImlzTW90aW9uVmlkZW9NdXRlIjpmYWxzZSwiaXNUcmltTW90a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A==

  1. Step 1: The input image is divided into small blocks having 8×8 dimensions. The dimensions sum up to 64 units. Each unit of the image is called a pixel.
  2. Step 2: JPEG uses the YCbCr model instead of the RGB model. In the second step, RGB is converted into YCbCr (Luminance
...
Continue reading "Multimedia Architecture and JPEG Compression Methods" »

Essential Authentication Methods, Linux Filters, and Network Topologies

Computer science3.73 KB

Authentication Methods

  • Password-Based Authentication
    • User logs in with username + password.
    • Common but vulnerable to brute-force and phishing attacks.
  • Multi-Factor Authentication (MFA)
    • Uses two or more factors:
      • Something you know (password)
      • Something you have (OTP, token)
      • Something you are (biometric)
    • Much more secure.
  • Biometric Authentication
    • Uses fingerprint, face, iris, or voice.
    • Fast and secure; used in phones and high-security systems.
  • Token-Based Authentication
    • Uses a hardware or software token to generate OTP.
    • Examples: Google Authenticator, RSA token.
  • Certificate-Based Authentication
    • Uses digital certificates (public/private key).
    • Used in HTTPS, VPNs, and secure enterprise systems.
  • Single Sign-On (SSO)
    • Login once to access multiple apps (e.g., Gmail and
...
Continue reading "Essential Authentication Methods, Linux Filters, and Network Topologies" »

Linux File System Architecture and Key Components

Computer science3.55 KB

Understanding Linux File Management Subsystem

The Linux File Management Subsystem, an integral part of the Linux kernel and user space, meticulously handles all aspects related to files. This includes their creation, storage, retrieval, permissions, and overall structure. Its primary role is to ensure that data is stored efficiently and securely on disk, remaining readily accessible whenever needed.

Core Components of Linux File Management

File System Interface

  • Provides system calls such as open(), read(), write(), and close(), which user programs utilize to interact with files.
  • Abstracts the underlying complexity of physical storage devices.

Virtual File System (VFS)

  • Acts as a crucial abstraction layer, offering a common interface to various file
...
Continue reading "Linux File System Architecture and Key Components" »

Core Graph Algorithms Pseudocode Reference

Computer science3.58 KB

Core Graph Algorithms Pseudocode

Kruskal's Algorithm for MST

def Kruskal(V, E):

  1. Sort E by increasing weight.
  2. For each vertex v in V: create a tree for each v.

MST = {}

For i from 1 to |E|:

  1. (u, v) ← lightest edge in E.
  2. If u and v are not in the same tree:
  • MST.add((u,v))
  • Merge u and v trees.

Return MST.

Huffman Tree Construction

BuildHuffman(characters[1..n], frequencies[1..n]):

  • Create nodes for each character.
  • For i ← 1 to n: create a min-heap Q with each node frequency as a key.

While(length(Q) > 1):

  1. x = pop minimum value from Q.
  2. y = pop minimum value from Q.
  3. Create new node z.
  4. z.key = x.key + y.key
  5. z.leftChild = x
  6. z.rightChild = y
  7. Insert z into Q.

Return the root value from Q.

Topological Sort

topological_sort(G):

Stack = []

While (unvisited Nodes):

helper_toposort(

...
Continue reading "Core Graph Algorithms Pseudocode Reference" »

NLTK Text Processing Examples: Tokenization to NER

Computer science4.53 KB

NLTK Text Processing Examples

Experiment 4: Basic Text Preprocessing

This section demonstrates fundamental text preprocessing steps using NLTK, including tokenization, stop word removal, filtering for alphabetic tokens, and stemming.

import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from nltk.corpus import words

text = "Random sampling is a method of choosing a sample of observations from a population to make assumptions about the population"

tokens = word_tokenize(text)
stop_words = set(stopwords.words('english'))
stemmer = PorterStemmer()

# 1. Lowercase and filter for alphabetic tokens
alpha_tokens = [token.lower() for token in tokens if token.isalpha()]

# 2. Filter
...
Continue reading "NLTK Text Processing Examples: Tokenization to NER" »

Operating Systems: Processes, Threads, and System Calls

Computer science31.86 KB

Chapter 1: System Fundamentals

w8sCxppQRjzZQAAAABJRU5ErkJggg==

Inter-process Communication (IPC):

  • Network: Communication between processes over a network.
  • Pipe (Special File): Process A writes into a pipe, and Process B reads from it.

Privileged vs. User Mode

The OS runs in privileged mode (also called supervisor or system mode), where specific operations—such as accessing a disk or network card—are permitted. User programs run in user mode and cannot perform these operations directly. When a program requires an OS service, such as accessing a file or creating a process, it is accomplished by a system call.

CPU Instruction Cycle

The CPU executes programs through a continuous loop:

  1. Fetch Instruction
  2. Decode and Execute
  3. Read/Write Data
  4. Loop until powered off

OS Invocation Methods

  • System
...
Continue reading "Operating Systems: Processes, Threads, and System Calls" »

Network Protocol Fundamentals and Performance Analysis

Computer science10.64 KB

Layered Protocols: Advantages and Disadvantages

Layered protocols are a fundamental concept in network design. Understanding their benefits and drawbacks is crucial for efficient system development.

Reasons for Using Layered Protocols

Using layered protocols offers several benefits, including:

  • Breaking up the design problem into smaller, more manageable pieces.
  • Allowing protocols to be changed without affecting higher or lower layers, promoting modularity and flexibility.

Disadvantages of Layered Protocols

Potential drawbacks of using layered protocols include:

  • More overhead: This is due to added information or operations performed in each layer, which can increase processing and transmission costs.
  • Information hiding: Information useful for other layers
...
Continue reading "Network Protocol Fundamentals and Performance Analysis" »

Understanding Paging and Virtual Memory in Computer Architecture

Computer science5.17 KB

5. A machine has a 32-bit address space and an 8-KB page. The page table is entirely in hardware, with one 32-bit word per entry. When a process starts, the page table is copied to the hardware from memory, at one word every 100 nsec. Lf each process runs for 100 msec (including the time to load the page table), what fraction of the CPU time is devoted to loading the page tables?

The page table contains 232 /213 entries, which is 524,288.  Loading the page table takes 52 msec. If a process gets 100 msec, this consists of 52 msec for loading the page table and 48 msec for running. Thus 52% of the time is spent loading page tables.

6. Suppose that a machine has 48-bit virtual addresses and 32-bit physical addresses. If pages are 4 KB, how many...

Continue reading "Understanding Paging and Virtual Memory in Computer Architecture" »

Arduino Programming Reference: Variables, Functions & Syntax

Computer science12.76 KB

Variables

Array

int myInts[6];
int myPins[] = {2, 4, 8, 3, 6};
int mySensVals[6] = {2, 4, -8, 3, 2};
char message[6] = "hello";

Bool

int LEDpin = 5;       // LED on pin 5
int switchPin = 13;   // momentary switch on 13, other side connected to ground
bool running = false;

void setup()
{
  pinMode(LEDpin, OUTPUT);
  pinMode(switchPin, INPUT);
  digitalWrite(switchPin, HIGH);      // turn on pullup resistor
}

void loop()
{
  if (digitalRead(switchPin) == LOW)
  {
    delay(100);                        // delay to debounce switch
    running = !running;                // toggle running variable
    digitalWrite(LEDpin, running);     // indicate via LED
  }
}

Char

char myChar = 'A';
char myChar = 65;      // both are equivalent

Double

Double precision...

Continue reading "Arduino Programming Reference: Variables, Functions & Syntax" »