Notes, summaries, assignments, exams, and exercises for Computer science for Other courses

Core Concepts in Computer Architecture and Assembly

Computer science3.56 KB

CPU Fundamentals and Timing

Clock Cycles and Frequency

A clock that oscillates 1 million times per second (1 MHz) produces a clock cycle of 1 microsecond (1 μs), which equals 10-6 seconds per cycle.

Instruction Execution Pipeline

The steps for executing a machine instruction are:

  1. Fetch the instruction.
  2. Decode the instruction.
  3. Fetch the operand (if any).
  4. Execute the instruction.
  5. Store the result or output.

Cache Memory Operations

Cache memory is a small, fast memory used to temporarily store frequently accessed data or instructions to speed up CPU operations.

  • A cache hit occurs when the CPU finds the required data in cache memory.
  • A cache miss occurs when the data is not found and must be fetched from main memory.

Assembly Language Basics

General-Purpose

...
Continue reading "Core Concepts in Computer Architecture and Assembly" »

Essential Python Recursion and Pandas Data Analysis

Computer science2.86 KB

Recursive Functions in Python

def range_sum(num_list, start, end):
    if start > end:          # Base case
        return 0
    else:                    # Recursive case
        return num_list[start] + range_sum(num_list, start + 1, end)

numbers = [2, 4, 6, 8, 10]
print(range_sum(numbers, 1, 3))  # Expected output: 18

Tower of Hanoi

def hanoi(n, from_peg, to_peg, temp_peg):
    if n > 0:
        # Step 1: Move n-1 discs to temp peg
        hanoi(n - 1, from_peg, temp_peg, to_peg)
        # Step 2: Move the bottom disc
        print(f"Move disc from peg {from_peg} to peg {to_peg}")
        # Step 3: Move n-1 discs from temp peg to target peg
        hanoi(n - 1, temp_peg, to_peg, from_peg)

Greatest Common Divisor

def gcd(x, y):
    if x
...
Continue reading "Essential Python Recursion and Pandas Data Analysis" »

Core Python for Data Analysis and Scientific Computing

Computer science11.79 KB

Key Concepts in Data Science & Scientific Computing

Visualization Techniques

  • Overlapping Histograms: Use semi-transparent alpha parameter for comparison.

Data Structures & Algorithms

  • BFS Implementation: collections.deque is ideal for Breadth-First Search.
  • Grid Representation: Obstacles often represented by a value like 1.

Jupyter Notebook & Markdown

  • Markdown Headings: Use # prefix for headings in Jupyter Markdown cells.

Optimization & Least Squares

  • Normal Equations: Direct matrix inversion for Least Squares: β = (XᵀX)⁻¹Xᵀy.

Numerical Integration & Simulation

  • Orbit Simulation: Runge–Kutta 4th order method is a common integration technique.

Search Algorithms

  • Brute-Force Search: Often implemented using nested loops.

Python Ecosystem

...
Continue reading "Core Python for Data Analysis and Scientific Computing" »

Cheat-Sheet Editor: Professional Document Formatting Tools

Computer science1.78 KB

  • File
  • Home
  • Insert
  • Options
  • Information

Editor Toolbar

Font and Paragraph Controls

Adjust your Font, Size, and Line Spacing. Use formatting options like Bold, Italic, Underline, Subscript, and Superscript. Align text or use lists (ordered and unordered) to organize your content.

Insert Elements

  • Table: Insert a table into the document.
  • Image: Include an image from a local file.
  • Link: Create a link for quick access to web pages.
  • Separator: Insert a horizontal line to divide sections.
  • Quote: Insert a blockquote.

Advanced Features

  • Search: Find documents on Wikiapuntes, xuletas.es, and wikiteka.com.
  • Compress: Reduce text size to occupy minimum space.
  • Preview: View how the cheat sheet looks when printed.
  • Install: Use the editor offline for better performance.

Print and

...
Continue reading "Cheat-Sheet Editor: Professional Document Formatting Tools" »

Digital Electronics Concepts: Flip-Flops, Registers, and Converters

Computer science1.38 MB

1. JK Flip-Flop Operation and Truth Table

Logic Diagram:

wBjcvJtk2sNIQAAAABJRU5ErkJggg==

EAjrov4gZdUr+SxbQQf9fGi1dW7+IBXTQfxEz6pT8lyzwf4VinCuWPVOZAAAAAElFTkSuQmCC

Working Principle

The JK flip-flop is an enhanced version of the gated SR flip-flop. It incorporates clock input circuitry to eliminate the invalid output condition that occurs when both S and R inputs are logic level "1".

Because of the added clock input, the JK flip-flop offers four distinct input combinations:

  • Logic "1" (Set)
  • Logic "0" (Reset)
  • No Change
  • Toggle

The S and R inputs of the preceding SR bistable are replaced by J and K inputs, named after its inventor, Jack Kilby. Thus, J = S and K = R.

The two 2-input AND gates in the gated SR bistable are replaced by two 3-input NAND gates. The third input of each NAND gate connects to the outputs Q and $\bar{Q}$. This cross-coupling allows the...

Continue reading "Digital Electronics Concepts: Flip-Flops, Registers, and Converters" »

Database Management Systems and ERD Fundamentals

Computer science36.02 KB

Introduction to Database Management Systems

A database is a structured collection of data stored on a computer system. It is managed using a Database Management System (DBMS), which provides the necessary tools for data storage, retrieval, and modification.

Core Benefits of Using a DBMS

  • Reduced Data Redundancy: A DBMS helps minimize repeated data through organizational rules such as normalization.
  • Enhanced Data Accuracy: The system uses specific rules, such as referential integrity, to maintain data consistency.
  • Support for Multiple Users: Many people can access and use the database simultaneously without encountering operational problems.

Centralized vs. Distributed Databases

  • Centralized: All data is stored in a single, primary location. This setup
...
Continue reading "Database Management Systems and ERD Fundamentals" »

C++ Code Examples: Arithmetic Mean, Sum, Product, Square

Computer science1.55 KB

Arithmetic Mean

The following C++ code calculates the arithmetic mean of numbers from 1 to n:

int main() {
    int n;
    double suma = 0;
    cout << "Vnesi broj: ";
    cin >> n;
    if (n <= 0) {
        cout << "Brojot na elementi mora da bide pogolem od 0!" << endl;
        return 1;  
    }
    for (int i = 1; i <= n; i++) {
        suma += i;  
    }
    double sredina = suma / n;
    cout << "Aritmetichkata sredina na broevite od 1 do " << n << " e: " << sredina << endl;
    return 0;
}

Sum

The following C++ code calculates the sum of numbers from 1 to n:

int main() {
    int n, sum = 0;
    cout << "Vnesi broj n: ";
    cin >> n;
    for (int i = 1; i <= n; i++)
...
Continue reading "C++ Code Examples: Arithmetic Mean, Sum, Product, Square" »

Formulaire d'Inscription et Collecte de Données

Computer science518 bytes

Formulaire d'Identification et d'Inscription

Veuillez renseigner les informations suivantes pour votre dossier :

  • Nom :
  • Prénom :
  • CIN :
  • Tél :

Validation des Coordonnées Personnelles

Veuillez confirmer les informations ci-dessous :

  • Nom :
  • Prénom :
  • CIN :
  • Tél :

Fundamental Computer Science Concepts & Algorithms

Computer science1.64 MB

Arithmetic Progressions (AP)

Sum of terms = n[(1st term + last term)]/2

Geometric Progressions (GP)

Sum of terms = [1st term(1 - quotientn)/(1 - quotient)] (Swap positions of 1 & quotient if quotient > 1)

Logarithms

  • loga(x/y) = logax - logay
  • logaxn = nlogax
  • logab = (logcb/logca)

Permutations

For a set of n objects: The total number of permutations is n!

For arranging 'r' objects from a set of 'n' objects: The number of permutations is nPr = n! / (n-r)!. (e.g., ways to arrange 3 objects from a set of 5 is 5 * 4 * 3, since there are 5 possibilities for the first object, followed by 4, then 3.)

Combinations

For selecting 'r' objects from a set of 'n' objects: The number of combinations is nCr = n! / (r! * (n-r)!). (Divide by r! since there are r! ways

...
Continue reading "Fundamental Computer Science Concepts & Algorithms" »

Essential Concepts in Linear Algebra and Logic

Computer science3.06 KB

Sure, I'll address each of the directives.

**Q-1**

(1) **Define Symmetric Matrix:**
A symmetric matrix is a square matrix that is equal to its transpose. Mathematically, a matrix \( A \) is symmetric if \( A = A^T \), where \( A^T \) denotes the transpose of \( A \). This implies that \( a_{ij} = a_{ji} \) for all elements in the matrix.

(2) **Define Tautology:**
A tautology is a statement or formula that is always true, regardless of the truth values of its component propositions. In logical terms, a tautology is a proposition that evaluates to true in every possible interpretation.

**Reh (P.T.O)**

(3) **Write down the condition for consistency of a non-homogeneous system of linear equations:**
A non-homogeneous system of linear equations \( AX =...

Continue reading "Essential Concepts in Linear Algebra and Logic" »