Core Algorithms in Computer Graphics: Clipping, Drawing & Displays

Cohen-Sutherland Line Clipping Algorithm

What is the Cohen-Sutherland Algorithm?

The Cohen–Sutherland algorithm is a line clipping method used to clip a line segment against a rectangular clipping window. It divides the area around the window into regions and assigns a 4-bit region code (Outcode) to each endpoint of the line.

Algorithm Steps

  1. Assign 4-bit codes to each endpoint. Each bit represents a position relative to the window:

    • Bit 1: Top
    • Bit 2: Bottom
    • Bit 3: Right
    • Bit 4: Left

    For example:

    • 0000
Read More

C# Programming Fundamentals: Arrays, Loops, and Decisions

Life Expectancy Analysis with Parallel Arrays

This exercise demonstrates the use of parallel arrays to store and process life expectancy data by gender.

Instructions

  1. Create four parallel arrays containing the life expectancy data as shown in Table 1.
  2. Iterate through the parallel arrays to count and display a list of country names where the life expectancy for both genders exceeds 80 years.
  3. Prompt the user to input a country code.
  4. Use a loop to display the country name and life expectancies for males,
Read More

Essential OS and Computer Networking Lab Exam Q&A

Operating System (OS) Lab Questions

Basic OS Concepts

  1. What is an Operating System (OS)?

    → It is system software that acts as an interface between the user and the hardware.

  2. What are the main functions of an OS?

    Process management, memory management, file management, I/O management, and security.

  3. What is a process?

    → A program in execution.

  4. Difference between process and program?

    → A program is passive (stored on disk); a process is active (in execution).

  5. What is a thread?

    → A lightweight process;

Read More

Essential Python and Command Line Programming Concepts

Essential Command Line Tools

Terminal Commands

  • mkdir: Creates a new directory.
  • pwd or cd (or chdir): Shows the current working directory.
  • Changing Directory Example: To change the current directory to the ‘SI206’ folder (if you are currently in its parent folder, ‘Fall22’), use cd SI206.

Git Commands (Version Control)

  • git clone url: Copies a repository to your local computer.
  • git status: Shows what has changed and what is staged for commit.
  • git add file: Adds a specific file to the staging area for the
Read More

Database Storage Structures and Index Management Techniques

Database Storage Structures

There are several methods for storing user data in a database, each optimized for different performance and scalability requirements.

Regular Tables

A regular table (generally referred to as a “table”) is the most commonly used form of storing user data.

  • The database administrator has very limited control over the distribution of rows in an un-clustered table.
  • Rows can be stored in any order depending on the activity on the table.

Partitioned Tables

A partitioned table enables

Read More

Data Structuring, Acquisition, Cleaning, and ETL Cheatsheet

Module 1 Cheatsheet — Foundations, Acquisition, DOM/XPath, Structuring


1) What “Big Data” means:


No single size cutoff. Think:
Volume (lots of rows/large objects), Variety (heterogeneous), Velocity (fast-changing), Veracity (quality).Implication: choose tools/storage/pipelines that match data scale and shape.

2) Three canonical encodings:


Tables / Relations / DataFrames

Heterogeneous columns; ideal for SQL/Pandas joins, filters, aggregations.

Arrays / Matrices / Tensors

Uniform numeric cells;

Read More