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

Java Programming Concepts and Functions

Computer science2.41 KB

public static void main(String[] args) {
Scanner entrada = new Scanner(System.in);
String frase= entrada.nextLine();
Stack invertidas = new Stack();
Queue ordenadas = new LinkedList();
for(int i=0;i char letra= frase.charAt(i);
if(Character.isLetter(letra)){
invertidas.push(Character.toLowerCase(letra));
ordenadas.add(Character.toLowerCase(letra));
}
}
while(!invertidas.isEmpty() && invertidas.peek()==ordenadas.peek()) {
invertidas.pop();
ordenadas.poll();
}
if(invertidas.isEmpty() && ordenadas.isEmpty()){
System.out.println( 'A frase é palíndrome');
}
else{
...
Continue reading "Java Programming Concepts and Functions" »

Adobe Fireworks CS4: Features and Capabilities

Computer science3.53 KB

Adobe Fireworks CS4: A Powerful Tool for Web Graphics

Fireworks was originally created in 1998 by Macromedia. Since the company was acquired by Adobe Systems Incorporated, it has been part of the Adobe family. The most recent and improved version is Fireworks CS4.

Fireworks is a software from the multimedia family, and it is a versatile application. Images for the web can be created, designed, edited, and optimized easily. The use of this software is not exclusive to people who work in this area. Those who enjoy design and creating their own images or editing their favorite pictures can use the program. Company logos, advertising banners, and even animations are developed with it. This way, web pages become more attractive and receive more visits.

...

Continue reading "Adobe Fireworks CS4: Features and Capabilities" »

Microsoft Access Database Essentials: Tables, Queries, and Fields

Computer science2.78 KB

Topic 4: Advanced Tables and Data Analysis

  • What is an advanced table?
    The most efficient template for initiating a new database.
  • Difference between SUM and COUNT functions:
    The SUM function adds the numerical elements of a column, while the COUNT function calculates the total number of entries in a column.
  • Standard Deviation Function:
    A statistical measure used to determine the dispersion or variability of data relative to the mean.
  • Table Analyzer:
    An assistant tool that examines a table and suggests whether it should be normalized into two or more separate tables.

Topic 5: Creating and Modifying Fields

  • Methods to create a field:
    There are three primary ways to create a field in Microsoft Access.
  • Adding fields in views:
    You can add a field in Datasheet
...
Continue reading "Microsoft Access Database Essentials: Tables, Queries, and Fields" »

Biological Specimen Collection Safety and Identification Protocol

Computer science3.29 KB

General Protocol for Specimen Collection

Keep in mind that all specimens must be treated with care and respect, as any sample can be potentially infectious. Personnel must therefore fulfill universal precautions for the protection of workers against the risks of exposure to biological agents. These precautions are a set of measures designed to protect workers while they handle patients, fluids, or specimens.

The Three Phases of Specimen Procurement

Phase One: User Identification and Information

This phase involves the identification of the user requesting the analysis. This includes:

  • Verifying that the user data coincides with the request data.
  • Studying the request and noting any special conditions that require specific determinations.
  • User Preparation:
...
Continue reading "Biological Specimen Collection Safety and Identification Protocol" »

Algorithm Analysis: Efficiency Measurement Techniques

Computer science3.14 KB

Problem Solving and Algorithm Goals

There are several ways to solve a problem. How do we choose between them? There are generally two goals in the design of computer programs:
  • The design of an algorithm that is easy to understand, codify, and debug (Software Engineering).
  • The design of an algorithm that makes efficient use of computer resources (Analysis and Design of Algorithms).
The analysis of algorithms allows us to measure the difficulty of a problem and evaluate the efficiency of an algorithm.

Measuring Execution Time

You cannot measure time in seconds because there is no reference standard computer; instead, we measure the number of basic or elementary operations. The basic operations are performed by the computer in time bounded by a constant,
...
Continue reading "Algorithm Analysis: Efficiency Measurement Techniques" »

Core Concepts in Robotics and Structured Programming

Computer science3.53 KB

Robotics Fundamentals

  • Machines involved in an assembly line, often appearing very smart, are known as industrial robots.
  • The third generation of robots is characterized by using computers for control and having environmental perception through sensors.
  • The word 'robot' originates from a term meaning servant or slave.
  • Robotics is the branch of science and technology that studies the design and construction of machines capable of performing tasks typically done by humans or requiring intelligence.
  • Light sensors and bumpers are devices that allow robots to locate themselves or objects in their environment.

Structured Programming and Algorithms

  • Structured programming requires that all programs are built from three basic control structures: sequence, selection,
...
Continue reading "Core Concepts in Robotics and Structured Programming" »

Finite State Machines and Automata Theory with JFLAP

Computer science3.32 KB

Fundamentals of Abstract Machines

An abstract machine is a model in computer science representing a digital, discrete-time host. The simplification of complex skills makes it easier to understand the behavior of a machine and compare different models.

Core Behavior and State Transitions

The basic behavior of an automaton remains consistent: the machine processes an external command sequence of characters. The machine exists in a specific state. Each time an input character arrives, the machine moves to a successor state based on the current state and the input. This process is known as a state transition.

The set of possible transitions defines the machine's behavior. These are described using a transition function, which dictates how the machine...

Continue reading "Finite State Machines and Automata Theory with JFLAP" »

Fundamentals of Computer Programming Concepts

Computer science4.62 KB

Programming Fundamentals

Programming in computing involves automatic data processing and communication. Computers perform arithmetic and logical operations based on instructions, which collectively form a program.

Programming Languages

A programming language is a character set with a specific syntax used to create instructions that a computer can interpret.

Low-Level Languages

These languages are closest to the computer's understanding (binary code). Their characteristics include using characters closely related to the computer's internal operations (bits).

Machine Language

Machine language is one of the lowest levels. It uses the language of 1s and 0s, and each processor has its own specific machine language.

Assembly Language

Assembly language uses...

Continue reading "Fundamentals of Computer Programming Concepts" »

Mastering Multithreading: Synchronization and Concurrency

Computer science1.59 MB

qGVLGm2yySS1cN0JACAgBISAEhMC8R2DmvCdBFAgBISAEhIAQEAJCQAgIASHgCCDBiRQfEmxIryGJyIFMHD5jtvjSQQcdVEVFmp4DuuSEgBAQAkJACAiByYeAJNwmX5uIIiEgBISAEBACQkAICIFpjgCnWc+ZM6crCqilcnrurFmzusZRgBAQAkJACAgBITDvEBDDbd5hr5KFgBAQAkJACAgBISAEhEBXBG644Ybq4Jmrrroq29zceOON0+zZs9NOO+0kZltX5BQgBISAEBACQmDeIyCG27xvA1EgBISAEBACQkAICAEhIAR6IoBaKYdEtDksqmdGChQCQkAICAEhIAQmBAEx3CYEZhUiBISAEBACQkAICAEhIASEgBAQAkJACAgBITBdEJgxXSqqegoBISAEhIAQEAJCQAgIASEgBISAEBACQkAICIGJQEAMt4lAWWUIASEgBISAEBACQkAICAEhIASEgBAQAkJACEwbBMRwmzZNrYoKASEgBISAEBACQkAICAEhIASEgBAQAkJACEwEAmK4TQTKKkMICAEhIASEgBAQAkJACAgBISAEhIAQEAJCYNogIIbbtGlqVVQICAEhIASEgBAQAkJACAgBISAEhIAQEAJCYCIQEMNtIlBWGUJACAgBISAEhIAQEAJCQAgIASEgBISAEBAC0wYBMdymTVOrokJACAgBISAEhIAQEAJCQAgIASEgBISAEBACE4GAGG4TgbLKEAJCQAgIASEgBISAEBACQkAICAEhIASEgBCYNgiI4TZtmloVFQJCQAgIASEgBISAEBACQkAICAEhIASEgBCYCAT+HyWALbQbtlyiAAAAAElFTkSuQmCC
aUYra0n3POOTMqHP7ejoAj4Ag4Ao6AI+AIOAKOgCPQDQj8P+NhDYXW1R55AAAAAElFTkSuQmCC
kuoQAAAAAElFTkSuQmCC
AXrPdSYSRfcvAAAAAElFTkSuQmCC
mbeQTol1LPUPY27XQ683KlFIuACEwiASnGJrFUlCYREAEREAEREAEREAEREAEREAEREAEREIGxE5CNsbEjVgQiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAKTSECKsUksFaVJBERABERABERABERABERABERABERABERg7ASkGBs7YkUgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIwiQSkGJvEUlGaREAEREAEREAEREAEREAEREAEREAEREAExk5AirGxI1YEIiACIiACIiACIiACIiACIiACIiACIiACk0hAirFJLBWlSQREQAREQAREQAREQAREQAREQAREQAREYOwEpBgbO2JFIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIkEpBibxFJRmkRABERABERABERABERABERABERABERABMZOQIqxsSNWBCIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgApNIQIqxSSwVpUkEREAEREAEREAEREAEREAEREAEREAERGDsBKQYGztiRSACIiACIiACIiACIiACIiACIiACIiACIjCJBKQYm8RSUZpEQAREQAREQAREQAREQAREQAREQAREQATGTkCKsbEjVgQiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAKTSECKsUksFaVJBERABERABERABERABERABERABERABERg7ASkGBs7YkUgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIwiQT+F4vc9jGTjhomAAAAAElFTkSuQmCC


Understanding Synchronization

Synchronization ensures the correct ordering of instructions across threads. It relies on hardware support to achieve two primary concurrency objectives:

  • Mutual Exclusion: Solved using locks.
  • Ordering: Solved using locks and semaphores.

A condition variable acts as a queue for waiting threads. Maintain state alongside condition variables; they are used to signal threads when state changes. If the state is already as needed, the thread does not wait for a signal. Whenever a lock is acquired, recheck assumptions about the state. Some libraries experience spurious wakeups, where multiple threads may wake up unexpectedly. To wake the right thread, use specific condition variables per condition rather than waking all threads....

Continue reading "Mastering Multithreading: Synchronization and Concurrency" »

Fixing STM32 Register-Level C Code: GPIO, Clock, ADC, Timer and UART Setup

Computer science11.84 KB

main.h

// main.h
#ifndef MAIN_H_
#define MAIN_H_
// Libraries
#include <stdio.h>
#include <stdint.h>
// Register declaration example (GPIOs)
typedef struct {
volatile uint32_t CRL;
volatile uint32_t CRH;
volatile uint32_t IDR;
volatile uint32_t ODR;
volatile uint32_t BSRR;
volatile uint32_t BRR;
volatile uint32_t LCKR;
} GPIO_TypeDef;
// Address definitions
#define RCC_BASE 0x40021000UL // RCC base address
#define GPIOA_BASE 0x40010800UL // GPIO Port A base address
#define GPIOB_BASE 0x40010C00UL // GPIO Port B base address
#define GPIOC_BASE 0x40011000UL // GPIO Port C base address
#define TIM2_BASE 0x40000000UL // TIM2 timer base address
#define ADC1_BASE 0x40012400UL // ADC1 base address
#define USART1_BASE 0x40013800UL // USART1 base
...
Continue reading "Fixing STM32 Register-Level C Code: GPIO, Clock, ADC, Timer and UART Setup" »