Notes, summaries, assignments, exams, and exercises for Computer science for Primary education

Prolog Implementation of the Traveling Salesperson Problem: Exact and Heuristic Solvers

Computer scienceUpdated on 4.75 KB

This document presents two distinct approaches to solving the Traveling Salesperson Problem (TSP) using Prolog: an exact, brute-force method and a heuristic-based Nearest Neighbor algorithm. Both implementations are demonstrated with code and sample queries.

Exact Solver: Brute-Force TSP Algorithm

This section details a Prolog program that finds the optimal (shortest) path for the Traveling Salesperson Problem by generating and evaluating all possible tours. This method guarantees the optimal solution but can be computationally intensive for larger sets of cities.

Defining City Distances in Prolog

The distances between cities are defined using dist/3 facts. The predicate is made symmetric to ensure that dist(X,Y,D) implies dist(Y,X,D).

dist(a,b,
...
Continue reading "Prolog Implementation of the Traveling Salesperson Problem: Exact and Heuristic Solvers" »

Step-by-Step Installation of OmniOS with Napp-IT

Computer scienceUpdated on 3.94 KB

Manual Installation:
Current State (Tests are Conducted in ESXi5):


1. Download OmniOS (Bloody or Stable)
2a. Option: Run on ESXi, create a new VM (Solaris 10-64) with e1000 or install on hardware (15 GB disk minimum)

2b. Run on Hardware:
You can install Omni + Napp-IT onto SATA or fast USB sticks >=16 GB (absolute minimum=8 GB when needed).
If you use USB, the best are external USB3 enclosures with a SATA SSD >=16 GB inside.
(Prefer USB3; they are mostly even faster on USB2)

3. Install with defaults from CD or USB install media, login as root (no password)

4. Setup Network. Network is set to (by default): network/physical:default,
so login as root (no password)

4.1 Create Interface
- List available interfaces and use link name, e.g., e1000g0:
dladm...

Continue reading "Step-by-Step Installation of OmniOS with Napp-IT" »

Active Directory: Estructura, Características e Funcionamento

Computer science2.58 KB

Active Directory

Active Directory é o termo que emprega Microsoft para referirse á súa implementación de servizo de directorio nunha rede distribuída. Permite crear un único inicio de sesión e un repositorio central de información para toda a súa rede, simplificando a administración de usuarios e equipos, e mellorando o acceso aos recursos.

Active Directory é unha implementación de servizo de directorio centralizado nunha rede distribuída que facilita o control, a administración e a consulta de todos os elementos lóxicos dunha rede (como poden ser usuarios, equipos e recursos).

É seguro, distribuído e replicado:

  • Está deseñado para funcionar tanto nun só servidor con algún obxecto como en múltiples servidores e millóns de
...
Continue reading "Active Directory: Estructura, Características e Funcionamento" »

Software Testing and Debugging

Computer science4.52 KB

SOFTWARE TESTING

Testing can only show the presence of errors, not their absence. The goal of testing is confidence.

  • Validation: Are we building the right product? What does the customer need?
  • Verification: Are we building the product right? Functional/Non-Functional requirements.

SOFTWARE INSPECTION VS. SOFTWARE TESTING

While inspection will go through the code without running the program, testing will run the program and look at the results. Incomplete programs can only be inspected, not tested. Inspections can control aspects of good software (maintainability…), not just the results.

TEST CASE:

  • Requirements
  • Data/Input
  • Actions
  • Expected Results

TEST CASE PRINCIPLES:

  • A test tries to find flaws in a program.
  • A good test case will show a possible defect
...
Continue reading "Software Testing and Debugging" »

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" »

Computer Memory Systems and I/O Device Management

Computer science12.61 KB

🧠 Computer Memory Systems

Computer memory is essential for storing data and instructions. It is measured and organized using specific terminologies and a hierarchical structure.

1. Fundamental Memory Concepts

A. Basic Units of Data Storage

The smallest addressable units of data in a computer are based on the binary system:

UnitSizeDescription
Bit (Binary Digit)1The smallest unit of data, represented as either a 0 or a 1.
Nibble4 bitsHalf of a byte; often corresponds to a single hexadecimal digit.
Byte8 bitsThe fundamental unit of data storage; typically represents a single character (e.g., 'A', '7', '$').
WordVaries (16, 32, 64 bits)The natural unit of data used by a specific CPU design (its register size and bus width).

B. Storage Locations and Addresses

  • Storage
...
Continue reading "Computer Memory Systems and I/O Device Management" »

Key Concepts in Information Systems and Technology

Computer science5.24 KB

Expert systems

have four major components. Which of the following is not one of the four?

  • Interference motor

Major categories of E-commerce

include all of the following except which one?

  • Business to department (B2D)

Computing environment

that is always present and is capable perceive the surroundings and offer recommendations based on individual need and requirement is known as:

  • Contextual computing

AI application

includes Bots, Virtual agents, and Intelligent virtual agents. Which of the following best describes this AI technology?

  • Intelligent agents

Application used in all the functions of a business

which supports decision making throughout the organization is known as___

  • Enterprise system

Four phases of the decision-making process

in a typical organization...

Continue reading "Key Concepts in Information Systems and Technology" »

CPU Register Types and Functions

Computer science3.48 KB

CPU Internal Registers

Internal registers are a set of temporary storage units available to the Central Processing Unit (CPU) for its operation. They serve as high-speed storage locations within the CPU itself.

The size of these registers depends on the function to be performed and the type of CPU. They generally match the size of the Data Bus or the Address Bus.

Classification of CPU Registers

CPU registers are broadly classified into two main types:

  • Inaccessible Registers: Not directly controllable by the user.
  • Accessible Registers: Controllable by the user.

Inaccessible Registers

Inaccessible registers are those whose operation or content the user cannot directly control. They are for the exclusive and restricted use of the CPU. From the user's...

Continue reading "CPU Register Types and Functions" »

Understanding SEO: A Comprehensive Guide to Search Engine Optimization

Computer science4.24 KB

Understanding Search Engine Optimization (SEO)

Crawling and Indexing

Web crawlers, also known as bots, robots, or spiders, are software programs designed to follow links, gather information, and send it back to search engines for indexing. This process allows search engines to understand the content and structure of websites.

Evolution of Google Search Algorithms

Over the years, Google has implemented various algorithm updates to improve search results and combat spam. Some notable updates include:

  • Google Dance (2002): Click-through rates started influencing search rankings.
  • Austin (2004): Targeted websites with keyword stuffing.
  • Google Suggest (2008) & Google Instant (2010): Introduced predictive search based on search history.
  • Hummingbird (2013)
...
Continue reading "Understanding SEO: A Comprehensive Guide to Search Engine Optimization" »

Python Syntax, Indentation, Comments, Variables, Data Types, Numbers, Casting, and Strings

Computer science5.67 KB

Python Syntax

As we learned in the previous page, Python syntax can be executed by writing directly in the Command Line:

>>> print("Hello, World!")
Hello, World!

Python Indentation

Indentation refers to the spaces at the beginning of a code line.

Where in other programming languages the indentation in code is for readability only, the indentation in Python is very important.

Python uses indentation to indicate a block of code.

if5 > 2:
    print("Five is greater than two!")

Python will give you an error if you skip the indentation:

if5 > 2:
print("Five is greater than two!")

Python Comments

Comments can be used to explain Python code.

Comments can be used to make the code more readable.

Comments can be used to prevent execution when testing...

Continue reading "Python Syntax, Indentation, Comments, Variables, Data Types, Numbers, Casting, and Strings" »