Notes, summaries, assignments, exams, and problems for Computers

Sort by
Subject
Level

UrarenKalitatea: Pascal Source Code for Water Quality

Classified in Computers

Written on in English with a size of 5.27 KB

UrarenKalitatea Pascal Source Code

The following is a complete Pascal program designed to manage and calculate water quality measurements and indices.

PROGRAM UrarenKalitatea ;

USES
  Crt, SysUtils ;

CONST
  MAX_NEURKETAK = 1000 ;

TYPE
  tsKateLabur = STRING [10] ;
  tsKateLuze = STRING [150] ;
  tarOinarrizkoParametroak = ARRAY [1..9] OF Real ;
  trdNeurketa = RECORD
    sBehatokia,
    sData: tsKateLabur ;
    rKIO: Real ;
    iKI: Integer ;
    arParametroak : tarOinarrizkoParametroak ;
  END ;
  tardNeurketenZerrenda = ARRAY [1..MAX_NEURKETAK] OF trdNeurketa ;
  tfrdNeurketenFitxategia = FILE OF trdNeurketa ;

FUNCTION fncAukeraIrakurri : Char ;
VAR
  cAukera : Char ;
BEGIN
  Writeln('1. Neurketen fitxategiaren edukia erakutsi') ;
  Writeln(
... Continue reading "UrarenKalitatea: Pascal Source Code for Water Quality" »

Understanding HashMaps in Python: A Practical Example

Classified in Computers

Written on in English with a size of 7.43 KB

Understanding HashMaps in Python

Introduction

This document demonstrates a simple implementation of a HashMap in Python. A HashMap, also known as a hash table, is a data structure that implements an associative array abstract data type, a structure that can map keys to values. A hash function is used to compute an index into an array of buckets or slots, from which the desired value can be found.

Code Implementation

The following code provides a basic HashMap class in Python:

from random import *

class HashMap:
DEFAULT_SIZE = 4096
class item:
def __init__(self,k,v):
self.key = k
self.value = v

def __init__(self):
self.table = [None] * self.DEFAULT_SIZE
self.size = 0

def __eq__(self,
... Continue reading "Understanding HashMaps in Python: A Practical Example" »

Internal Transport and Storage Systems in Warehouses

Classified in Computers

Written on in English with a size of 3.96 KB

Internal transport

Refers to the physical movement of products inside loading/unloading areas, docks, order preparation zones, truck load and any other eventual activity that implies products movements inside the warehouse.

Horizontal transport:

On this type of transport merchandise do not need to be raised to locate in a determined place. (Pallet truck, roller conveyor, conveyor belt system, auto guide transport system).

Vertical transport:

This transport not just allows the product to be transported from one place to another, but also to be raised to locate in a specific place. (Conventional forklift, retractable forklift, trilateral forklift).

Conventional forklift/truck lift (“Toros”)

Could be fixed mast or counterbalance, they need from 3... Continue reading "Internal Transport and Storage Systems in Warehouses" »

Java Data Structures: Sorted Lists and Hash Tables

Classified in Computers

Written on in English with a size of 3.32 KB

Sorted Linked List Insertion

The following method, insertAtSorted(T x), demonstrates how to insert an element into a sorted linked list while maintaining the correct order.

public void insertAtSorted(T x) {
    if (this.length == 0) {
        this.firstNode = nn;
        this.lastNode = nn;
    } else if (((Comparable)x).compareTo(this.firstNode.data) < 0) {
        nn.next = this.firstNode;
        this.firstNode = nn;
    } else {
        SNode<T> curr = this.firstNode;
        while (((Comparable)x).compareTo(curr.next.data) >= 0) {
            curr = curr.next;
        }
        nn.next = curr.next;
        curr.next = nn;
    }
    this.length++;
}

Priority Queue Enqueue Implementation

The enqueuer method handles inserting items... Continue reading "Java Data Structures: Sorted Lists and Hash Tables" »

Understanding CIDR, Subnetting, and Supernetting in IP Addressing

Classified in Computers

Written on in English with a size of 3.13 KB

Drawbacks of Classful Addressing

Subnets have a fixed number of host addresses, leading to many unused/wasted IP addresses.

Solutions for IP Address Shortages

Short-term: Classless addressing
Long-term: IPv6

CIDR (Classless Inter-Domain Routing)

CIDR uses a hierarchical addressing scheme based on VLSM (Variable Length Subnet Masking).

Advantages of CIDR

  • Replaces classful addressing with a more flexible and less wasteful classless scheme.
  • Enhances route aggregation.

How VLSM Works

VLSM further subnets existing subnets by taking bits from the host ID, creating a multi-level hierarchy with "sub-subnets."

Supernetting

Supernetting combines continuous network addresses into a new address defined by the subnet mask. Multiple networks are combined into a larger... Continue reading "Understanding CIDR, Subnetting, and Supernetting in IP Addressing" »

Automated Fact-Checking of Text Summaries for Relational Databases

Classified in Computers

Written on in English with a size of 4.06 KB

Verifying Text Summaries of Relational Data Sets

• Relational data is often summarized by text.
• The focus of this paper is the problem of verifying, in an automated fashion, whether text claims are consistent with the actual database.
• The authors proposed a tool for verifying text summaries of relational data sets, which works similarly to a spell checker and marks up claims that are believed to be erroneous.
• The system converts claims into SQL queries and then evaluates them.
• The main problem is converting natural language claims to SQL queries.
• The tool is called AggChecker.

AggChecker

• AggChecker consists of two parts: a relational data set and a text document.
• The text contains claims about the data.
• The goal is to
... Continue reading "Automated Fact-Checking of Text Summaries for Relational Databases" »

Fruteria: Añadir, Comprar y Pagar Frutas

Classified in Computers

Written on in English with a size of 3.49 KB

int opcion=0;

double cantidad, vuelto;

double pago, total = 0;

string[,] fruta = { { 'Manzana', '4.9' }, { 'Pera', '5.5' }, { 'Naranja', '8.6' }, { 'Platano', '2.7' } ,{ 'Fresa', '1.9' } ,{ 'Piña', '2.4' }, { 'Papaya', '4.2' }, { 'Sandia', '3.4' } ,{ 'Durazno', '3.5' } };

String[,] añaFruta = newString[50, 5];

int i=0, j=0;

int añadir = 0,tFruta=0;

do{

do{

i = 0;

Console.Write('_________________________ ' +

'FRUTERIA .... '+

'1) AÑADIR FRUTA. ');

while (i < 9)

{ Console.Write(i+2+') '+fruta[i,0]+' ');

i++;

}

if(añadir>0)

{j = 11;

i = 0;

tFruta = añadir+9;

while (i < añadir)

{Console.Write(j + ') ' + añaFruta[i, 0] + ' ');

j++;i++;

}

}

else { tFruta = 9; }

Console.Write(tFruta + 2+') Pagar. ');

opcion = int.Parse(Console.ReadLine(

... Continue reading "Fruteria: Añadir, Comprar y Pagar Frutas" »

Fundamentals of Internet Architecture and Java Programming Concepts

Classified in Computers

Written on in English with a size of 28.51 KB

Internet Architecture and Core Protocols

The Three Layers of Internet Architecture

The internet architecture can be broadly classified into three layers:

  1. Internet Backbones and High-Speed Network Lines: This first layer consists of Internet Backbones and very high-speed network lines. The National Science Foundation (NSF) created the first high-speed backbone in 1987 called NSFNET. It was a T1 line that connected 170 smaller networks together and operated at 1.544 Mbps (million bits per second). IBM, MCI, and Merit worked with NSF to create the backbone and developed a T3 (45 Mbps) backbone the following year. Backbones are typically fiber optic trunk lines. The trunk line has multiple fiber optic cables combined together to increase capacity.
... Continue reading "Fundamentals of Internet Architecture and Java Programming Concepts" »

Introduction to Computer Systems and Assembly Language Programming

Classified in Computers

Written on in English with a size of 7.29 KB

Computer System

Components:

  • CPU
  • Memory (ROM/RAM)
  • I/O unit

BCD (Binary-Coded Decimal)

  • Add 0110 to the result if it falls between 1010 and 1111.

Overflow

  • Occurs when both numbers being added are positive or negative, and the result exceeds the maximum representable value.

IEEE-754 Standard

  • 32 bits: 1 sign bit, 8 exponent bits, 23 mantissa bits
  • NAN (Not a Number): Represents an error, exponent with all 1s and a sign bit of 0.
  • Always add trailing zeros to complete the required number of bits.

Decoder

  • Converts input to output using 2^n AND gates.

Memory

  • Components: Address, data, enable, read, write

Control Unit

  • Hardware instruction logic
  • Decodes and monitors the execution of instructions.

ALU (Arithmetic Logic Unit)

  • Performs numerical and logical evaluations.
  • Receives
... Continue reading "Introduction to Computer Systems and Assembly Language Programming" »

C# Currency Persistence Class Implementation

Classified in Computers

Written on in English with a size of 3.25 KB

Namespace Pers
{
    public class Persistencia
    {
        

Method: Add Currency (AniadirDivisa)

Adds a currency and its value to Divisas.txt if it does not already exist.

public static void AniadirDivisa(String d, double valor)
{
    if (!ExisteDivisa(d))
    {
        StreamWriter sw = new StreamWriter(@"Divisas.txt", true);
        sw.WriteLine(d + "\t" + valor);
        sw.Close();
    }
}

Method: Get Currency Value (ValorDivisa)

Retrieves the value associated with a specific currency symbol.

public static double ValorDivisa(String d)
{
    String v = "";
    StreamReader sr = new StreamReader(@"Divisas.txt");
    String l = sr.ReadLine();
    while (l != null)
    {
        if (l.Contains(d))
        {
            // Extracts the value
... Continue reading "C# Currency Persistence Class Implementation" »