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

Essential Sorting Algorithms and String Processing

Computer science2.29 KB

Sorting Fundamentals

  • Stable sorting: Relative order is preserved.
  • In-place: Input and output occupy the same memory space.
  • Lower bound: N lg N for any comparison-based algorithm.

Common Sorting Algorithms

  • Insertion Sort
  • Merge Sort
  • Quick Sort: Often cited as the most important algorithm of the 21st century.
    • Recursive approach; processes data after the work is done.
    • Uses a random pivot to partition the list into two unsorted sublists, which are then sorted recursively.
  • Bubble Sort: A simple, greedy approach to sorting.
  • Heap Sort

String Sorting Techniques

Specific properties of strings allow for faster sorting than general-purpose algorithms.

Strings in Java

  • Strings are immutable sequences of 16-bit characters.
  • Operations: Length (1), Indexing (1), Concatenation
...
Continue reading "Essential Sorting Algorithms and String Processing" »

Cybersecurity Fundamentals: Principles and Practices

Computer science7.68 KB

**CIA Triad: Core Security Principles**

The CIA Triad consists of Confidentiality, Integrity, and Availability. These are the fundamental goals of information security.

**Threat Modeling: Proactive Security**

Threat modeling involves system decomposition and emphasizes security by design.

**Kerckhoffs's Principle: System Security**

Kerckhoffs's Principle states that:

  1. Security should not depend on the secrecy of the system's design, but only on the secrecy of the key.
  2. The system should be usable.
  3. Keys must be easy to change.

**One-Time Pad: Unbreakable Encryption**

A One-Time Pad is an algorithm that XORs the message with a randomly generated key of equal length. It is secure if:

  1. The key is truly random.
  2. The key is as long as the message.
  3. Each key is used
...
Continue reading "Cybersecurity Fundamentals: Principles and Practices" »

MIPS Overflow, Floating-Point Arithmetic, and Digital Logic

Computer science6.76 KB

1. Half-Adder Truth Table and Circuit

For a two single-bit input, draw the truth table and corresponding circuit for the half-adder.

Truth Table

Where A and B are the input values, C is the output carry, and Σ is the sum.

ABC (Carry)Σ (Sum)
0000
0101
1001
1110

(The question also requires a circuit diagram, which typically consists of an XOR gate for the Sum and an AND gate for the Carry.)

2. MIPS Overflow Handling Options

MIPS provides the following instruction options to handle overflow:

  • add, addi, sub: These instructions cause an exception on overflow.
  • addu, addui, subu: These instructions do not cause an exception on overflow.

3. MIPS Signed Addition Overflow Check

To avoid exceptions when performing signed addition, one can use addu and check for overflow...

Continue reading "MIPS Overflow, Floating-Point Arithmetic, and Digital Logic" »

Project Hemisphere: AT&T Surveillance and Database Systems

Computer science2.76 KB

Project Hemisphere

Project Hemisphere is a partnership between AT&T and the US Government. The Justice Department has described it as an essential tool.

Hemisphere is a secretive program run by AT&T that searches trillions of call records and analyzes cellular data to determine where a target is located, with whom they speak, and potentially why.

No warrant is required to make use of Hemisphere. AT&T has the ability to extract information because it retains so much of it. The company owns more than three-quarters of U.S. landline switches and the second-largest share of the nation’s wireless infrastructure and cellphone towers.

Database Fundamentals

A database is a collection of related data that can be stored in a central location...

Continue reading "Project Hemisphere: AT&T Surveillance and Database Systems" »

Database Design: Mastering Data Types, Keys, and Queries

Computer science4.07 KB

Database Design Fundamentals

Key Concepts and Definitions

Data Type

The data type determines what field values are allowed and what other properties the field will have.

Saving a Table

You can specify a name for a table after you click the Save button on the Table Design toolbar.

Table Structure

The final step in the creation of a table is to save the table structure to disk.

Primary Key

A primary key uniquely identifies each record in a table.

Identifying Fields

When designing a database, you need to identify the fields that will be required.

Data Redundancy

Storing the same data field in multiple tables is called data redundancy.

Composite Key

A primary key that consists of more than one field is called a composite key.

Avoiding Data Redundancy

When designing...

Continue reading "Database Design: Mastering Data Types, Keys, and Queries" »

ISO OSI and TCP/IP Networking Models Explained

Computer science3.98 KB

The ISO OSI Reference Model

Created in 1984 by ISO, the model consists of seven layers:

  • Layer 1: Physical Layer – Global connections, transmitting raw bits, no buffering.
  • Layer 2: Data Link Layer – Secured channels, reducing connection errors, structuring, and transmission controls.
  • Layer 3: Network Layer – Multiple connectivity, chosen quality, and transmission systems.
  • Layer 4: Transport Layer – Quality selection, recurring connections, user-to-user connection, and transparent data transport.
  • Layer 5: Session Layer – Manages sessions between users and machines.
  • Layer 6: Presentation Layer – Acts as the translator.
  • Layer 7: Application Layer – Includes protocols like HTTP.

TCP/IP Reference Model

The TCP/IP model is the standard family...

Continue reading "ISO OSI and TCP/IP Networking Models Explained" »

Essential UI Design Principles and Standards

Computer science2.99 KB

Smith & Mosier Design Categories

The following categories represent the Smith & Mosier standards for interface design:

  • Data Entry (199): User actions involving input of data to a computer and computer responses to such inputs.
  • Data Display (298): Computer output of data to a user and assimilation of information from such outputs. Note: Data should be displayed in a usable form; do not force users to convert displayed data.
  • Sequence Control (184): User actions and computer logic that initiate, interrupt, or terminate transactions.
  • User Guidance (110): Error messages, alarms, prompts, labels, and formal instructional material to assist user interaction.
  • Data Transmission (83): Computer-mediated communication among system users and other systems.
...
Continue reading "Essential UI Design Principles and Standards" »

Understanding Flip Flop and Multiplexer Designs in VHDL

Computer science3.24 KB

Flip Flop XR

library ieee;

use ieee.std_logic_1164.all;

Entity FFXR is

Port( clk, x, r : in std_logic;

q: buffer std_logic);

End FFXR;

Architecture Behavior of FFXR is

Begin

Process

Begin

Wait until clk 'EVENT' and clk='1';

if x='0' then

if r='0' then

q <= not q;

Else

If r='0' then

q <= '0';

Else

q <= q;

End If;

End If;

End Process;

End Behavior;


Multiplexer 4-to-1

library ieee;

use ieee.std_logic_1164.all;

Entity Mux_4_1 is

Port(aB:...

Continue reading "Understanding Flip Flop and Multiplexer Designs in VHDL" »

Essential Components and Architecture of Modern Computers

Computer science2.43 KB

Essential Components of a PC

Hardware

Hardware refers to the set of physical elements, machinery, and components (such as the microprocessor, monitor, and keyboard) that constitute a PC.

Software and Data

Software consists of programs or applications, along with the data or information they handle and store. Computers transform data (raw input) into information (processed results). To be useful, information must meet the following criteria:

  • Relevant: Applicable to the current situation.
  • Current: Updated and available when needed.
  • Right: Accurate in all details.
  • Concise: Condensed into a reasonable size.
  • Comprehensive: All important elements are covered.

Human Intervention and Procedures

People: Computers require human intervention to function effectively....

Continue reading "Essential Components and Architecture of Modern Computers" »

Computer Memory Types: A Comprehensive Technical Breakdown

Computer science2.35 KB

Classification of Computer Memory by Function

Core Memory Components

  • Central Memory: The portion of the CPU where instructions and data necessary for a given process are stored.
  • Cache Memory: Stores frequently used instructions and data, significantly improving computer performance.
  • Conventional Extended Memory: Accessed via specific software that forces the microprocessor into protected mode, or by utilizing 386/486 capabilities to allocate expanded memory as conventional memory.
  • Conventional Expanded Memory: Memory inaccessible to standard MS-DOS programs. It requires an Expanded Memory Manager (EMM) to allocate pages of bytes as needed. Only EMS-compatible software can utilize this.

Primary Memory Types

  • RAM (Random Access Memory): Classified by
...
Continue reading "Computer Memory Types: A Comprehensive Technical Breakdown" »