Notes, summaries, assignments, exams, and problems for Computer science

Understanding Computer Memory: Types, Features, and RAM

Computer science2.48 KB

Understanding Computer Memory

Memory Types

Main Memory

Main memory is integrated into the system's firmware and directly governed by the CPU. It stores the boot process, data from the stack, memory-resident programs, and the user program currently executing.

Types of Main Memory:
  • Ferrite memories (obsolete)
  • Integrated memory:
    • RAM (Random Access Memory)
    • ROM (Read-Only Memory)
    • PROM (Programmable ROM)
    • EPROM (Erasable Programmable ROM)
    • OTP Memory (One-Time Programmable ROM)
    • EAROM (Electrically Alterable ROM)

Cache Memory

Cache memory is located within the CPU and communicates directly with it. It stores frequently used data to reduce access time from main memory.

Mass Memory

Mass memory refers to storage devices with higher capacity, typically peripherals.

Types
...
Continue reading "Understanding Computer Memory: Types, Features, and RAM" »

Sorting Algorithms and Hash Tables: Explained and Compared

Computer science3.31 KB

Sorting Algorithms and Their Bounds

Results like the Ω(nlgn) lower bound on all sorting via binary comparisons are difficult to establish. On the other hand, results like the O(n2) upper bound on INSERTION-SORT are easier to achieve. Explain adequately the difference in the “ease” of arriving at these results.

One result applies to all sorting algorithms that are based on binary comparisons (and so is harder to establish) while the other result is simply for one specific sorting algorithm in the same category. A more complete answer would involve an argument that rightly recognizes that the lower bound result is one that also applies to algorithms that exist and also those yet to be devised (yes, even those that may be written a hundred...

Continue reading "Sorting Algorithms and Hash Tables: Explained and Compared" »

CPU Terminals, Buses, and Instruction Execution Cycle

Computer science3.92 KB

CPU Terminals and Bus Interconnection

The terminals (pins) of a Central Processing Unit (CPU) are typically divided into three main types: Address, Data, and Control.

These terminals are connected to similar terminals on memory chips and Input/Output (I/O) devices. This interconnection is collectively known as the bus system.

Communication between the CPU, memory, and I/O devices is effective through both transmitting and receiving signals at these terminals.

Key Bus Parameters

The functionality of the bus system is defined by three basic parameters:

  • Address Lines: A chip that has m address lines can address up to 2m memory locations.
  • Data Lines: A chip that has n data lines can write or read a word of n bits in a single operation.
  • Control Lines: These
...
Continue reading "CPU Terminals, Buses, and Instruction Execution Cycle" »

Assembly Instruction Set Categories and Functions

Computer science5.73 KB

🧾 Data Transfer Instructions

These instructions are used to move data between registers, memory, and I/O ports.

InstructionUse
MOVTransfer data between registers or memory locations
PUSH / POPPerform stack operations (store/retrieve data)
XCHGExchange contents of two operands
IN / OUTInput from or output to a port
LEALoad Effective Address
LDS / LESLoad Pointer and Segment Register
XLATTranslate byte using a lookup table

➕ Arithmetic Instructions

These instructions perform basic mathematical operations.

InstructionUse
ADD / SUBAddition / Subtraction
ADC / SBBAdd/Subtract with Carry/Borrow
INC / DECIncrement / Decrement a value
MUL / IMULUnsigned / Signed Multiplication
DIV / IDIVUnsigned / Signed Division
NEGTwo's Complement (Negation)
CMPCompare operands
...
Continue reading "Assembly Instruction Set Categories and Functions" »

C Implementation of Queues, Linked Lists, and Search Algorithms

Computer science17.79 KB

Circular Queue Implementation Using Linked Lists

This C program demonstrates the implementation of a circular queue using a linked list structure. The queue handles integer data.

Data Structure Definition

#include <stdio.h>
#include <stdlib.h>

typedef struct QueueType {
    int Data;
    struct QueueType *Next;
} QUEUE;

QUEUE *Front = NULL; // Pointer to the front of the queue
QUEUE *Rear = NULL;  // Pointer to the rear of the queue

// Function prototypes
void Enqueue(int Num);
int Dequeue();
void DisplayQueue();
int Menu();

Enqueue Operation

The Enqueue function inserts a number into the circular queue. It handles memory allocation and maintains the circular link by ensuring Rear->Next always points to Front.

void Enqueue(int Num)
...
Continue reading "C Implementation of Queues, Linked Lists, and Search Algorithms" »

Setting Up a Backend Project with Node.js

Computer science5.14 KB

To start a backend project.

- npm init

Then make a file with whatever entry point you named it as, for example, server.js

Once package.json is created:

  • npm i <package>
  • connect-mongo (store sessions in DB)
  • dotenv (for config files, environment variables)
  • express
  • mongoose
  • express-sessions (sessions and cookies)
  • method-override (to use PUT, UPDATE, DELETE requests)
  • moments (date formatting)
  • morgan (logging)
  • passport (authentication)

npm i -D <package>

  • nodemon (Update every file change instantly without having to restart the server)
  • cross-env (To update environment variables in script definition itself)

After installing the dependencies, edit the scripts in package.json

"start": "cross-env NODE_ENV=production node server.js",
"dev": "cross-env NODE_ENV=
...
Continue reading "Setting Up a Backend Project with Node.js" »

High-Level Data Link Control (HDLC) Protocol Fundamentals

Computer science4.53 KB

High-Level Data Link Control (HDLC) Protocol

HDLC is a crucial data link control protocol, specified by ISO 3009 and ISO 4335. It serves as the foundation for many other data link control protocols.

HDLC Station Types

  • Primary Station: Controls the operation of the link. Frames issued by the primary are called commands. The primary maintains a separate logical link with each secondary station on the line.
  • Secondary Station: Operates under the control of the primary station. Frames issued by a secondary are called responses.
  • Combined Station: Combines the features of both primary and secondary stations. A combined station may issue both commands and responses.

HDLC Link Configurations

  • Unbalanced Configuration: Involves one primary station and multiple
...
Continue reading "High-Level Data Link Control (HDLC) Protocol Fundamentals" »

V-Model and Black Box Testing in Software Engineering

Computer science9.26 KB

The V-Model (also known as the Verification and Validation Model) is a highly structured Software Development Life Cycle (SDLC) framework. It is an extension of the traditional Waterfall model, where instead of moving down in a linear fashion, the process steps bend upward after the coding phase to form a V shape. The core philosophy of the V-Model is that testing activities are planned and paired directly with their corresponding development phases right from the beginning.

The Two Arms of the V-Model

The V-Model is divided into two main tracks, separated by the execution of the actual code:

1. The Left Arm: Verification Phase

Verification happens before code execution. It involves static testing techniques like reviews, walkthroughs, and inspections...

Continue reading "V-Model and Black Box Testing in Software Engineering" »

Java AWT Architecture: Components, Events & Listeners

Computer science11.3 KB

Java AWT Architecture: Components and Events

The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user interface (UI) toolkit.

AWT Class Hierarchy

🖼️ The core of the AWT is structured around a few key classes, all of which inherit from the Object class.

1. Component Class

The Component class is the root of all AWT UI elements. A Component is an object with a graphical representation that can be displayed on the screen and can interact with the user. Examples of components include buttons, text fields, and scrollbars.

  • Key capabilities:
    • Defining visual appearance and behavior
    • Handling events (user input)
    • Drawing and painting

2. Container Class

A Container is a special type of component that can hold and organize...

Continue reading "Java AWT Architecture: Components, Events & Listeners" »

Proprietary File Analysis: Keystream Recovery and Resource Extraction

Computer science5.58 KB

C Implementation for Proprietary File Decryption (The Glide Utility)

This C source code outlines a utility, likely named glide, designed to analyze and decrypt data stored in a proprietary file format (possibly a PWL file). The process involves reading the file, recovering parts of the encryption keystream based on known offsets and user input, and then decrypting embedded resources.

Core Data Structures and Global Declarations

The program utilizes several global arrays to manage file data, the derived keystream, and resource pointers.

unsigned char Data[100001];
unsigned char keystream[1001];
int Rpoint[300];
  • Data: Stores the entire content of the input file.
  • keystream: Holds the recovered encryption key stream used for XOR decryption.
  • Rpoint: An
...
Continue reading "Proprietary File Analysis: Keystream Recovery and Resource Extraction" »