Notes, summaries, assignments, exams, and exercises for Computer science for Other courses

Android Development Concepts: UI Components and Architecture

Computer science11.09 KB

1. ListView vs RecyclerView Comparison

ListView

ListView is an older Android UI component used to display a scrollable list of items vertically. Each item is displayed one below another.

  • Uses Adapter to bind data.
  • Uses convertView for view reuse.
  • Only supports vertical scrolling.
  • Less efficient for large datasets.
  • No built-in animations.
  • ViewHolder pattern is optional.
  • Simple to use.
  • Suitable for small lists.

Example:

ListView listView = findViewById(R.id.listview); 
// ArrayAdapter<String> adapter = 
// new ArrayAdapter<>(this, 
// android.R.layout.simple_list_item_1, data); 
///listView.setAdapter(adapter);

RecyclerView

RecyclerView is an advanced and flexible version of ListView, introduced in Android.

  • Uses ViewHolder pattern by default.
  • Highly
...
Continue reading "Android Development Concepts: UI Components and Architecture" »

빅데이터, CSV, 인코딩과 파이썬 모듈·패키지·라이브러리 완벽 정리

Computer science9.38 KB

빅데이터란?

빅데이터란 디지털 환경에서 생성되는 모든 데이터, 즉 최근에 얻을 수 있게 된 데이터의 총칭입니다. 많은 양의 데이터가 매우 빠르게 생성되고 있으며 다양한 형태(문자, 영상 등)로 생성되고 있습니다.

빅데이터의 특징 (3V)

  • ① 크기(Volume): 일반적으로 수십 테라바이트 혹은 페타바이트 이상
  • ② 속도(Velocity): 매우 빠른 속도로 생산
  • ③ 다양성(Variety): 문자, 이미지, 영상과 같이 정형/비정형/반정형의 다양한 종류의 데이터

CSV 파일이란?

CSV는 ‘Comma-Separated Values’의 약자로, 각각의 데이터 값을 콤마(,)로 구분하는 파일 형식입니다.

*API란?

서비스 제공자가 소프트웨어...

Continue reading "빅데이터, CSV, 인코딩과 파이썬 모듈·패키지·라이브러리 완벽 정리" »

C Data Structures and Algorithms: Sorting, Lists, Queues, Stacks, Trees and Hashing

Computer science29.72 KB

C Data Structures and Algorithms: Code Examples

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#include <stdio.h>
#include <stdlib.h>

int bubbling(int *arr, int n) {
for (int i = 0; i < n - 1; i++) { // Outer loop controls the number of sorting passes
for (int j = 0; j < n - 1 - i; j++) { // Inner loop controls the comparisons in each pass
if (arr[j] < arr[j + 1]) { // If the previous element is smaller than the next one, swap them
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
return 0;
}

int main() {
int arr[6] = {0, 1, 4, 6, 8, 9};
bubbling(arr, 6); // Call the bubble sort
for (int i = 0; i < 6; i++) printf("%d", arr[i]);
return 0;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Greatest

...
Continue reading "C Data Structures and Algorithms: Sorting, Lists, Queues, Stacks, Trees and Hashing" »

Neural Networks and Machine Learning Fundamentals

Computer science3.27 KB

What is a Neural Network?

A Neural Network is a component of Artificial Intelligence (AI) that mimics how the human brain works. It is used to process information, recognize patterns, and make decisions, similar to human cognition.

Core Structure and Function

  • Neural networks are computer systems modeled on the structure of the human brain. They consist of layers of nodes (neurons).

Layers of a Neural Network

  • Input Layer: Takes the input data.
  • Hidden Layers: Process the data using mathematical operations.
  • Output Layer: Gives the final result.

How Neural Networks Learn

Neural networks learn by identifying patterns in data through training.

How a Neural Network Works (Step-by-Step)

  1. Input: Data is given to the network through the input layer.
  2. Processing: Hidden
...
Continue reading "Neural Networks and Machine Learning Fundamentals" »

Layer Functions, ARP Variants, Switching and CSMA/CD Explained

Computer science6.27 KB

ECE-GY 6353

A device that is said to operate at layer "X" implements protocols and processes headers up to and including layer "X", but no higher.

  • A host implements protocols and processes headers up to and including the application layer.
  • A router implements protocols and processes headers up to and including the network layer.
  • A link layer switch (bridge) implements protocols and processes headers up to and including the data link layer.
  • A hub or an Ethernet segment only implements the physical layer.

NIC

Identifies the network interface card (NIC) in the local network that should process the frame.

MAC address in data link layer header

EtherType

EtherType is a field in the Ethernet frame header used to identify the network layer protocol carried by...

Continue reading "Layer Functions, ARP Variants, Switching and CSMA/CD Explained" »

UDP and TCP Socket Programming in C with Winsock: Sender and Receiver Examples

Computer science13.97 KB

UDP Sender 1

#include <winsock.h>
#include <stdio.h>

#define msg "This is a UDP message."
int main(int argc, int **argv)
{
WSADATA wsda; // Structure to store info
// returned from WSAStartup
struct hostent *host; // Used to store information
// retrieved about the server
char szMessage[80];
int iMessageLen;
int ret;
char szAddress[64];
int iPort;
SOCKET s; // Our UDP socket handle
SOCKADDR_IN addr; // The host's address

Check Arguments

if(argc != 3 ||
(argc==2 && strcmp((char *) &argv[1][0], "/?")==0))
{
printf("wsudpsnd server port\n");
printf(" server: the server to send the packet to\n");
printf(" port: the port on the remote...

Continue reading "UDP and TCP Socket Programming in C with Winsock: Sender and Receiver Examples" »

Contrast Stretching and Range Compression in Python with OpenCV

Computer science4.08 KB

Contrast Stretching and Range Compression in Python

This script loads a grayscale image and applies two intensity transformations: contrast stretching and range compression. The results are displayed side by side with the original image using Matplotlib.

Loading the Image and Input Parameters

The image Cat.jpg is loaded in grayscale. The user enters two coordinate points (A and B) that define the breakpoints of the piecewise linear transformation, along with the constant c used for range compression.

Helper Functions

Line Equation Function

The function prava(x1, y1, x2, y2) calculates the slope m and intercept b of the line passing through two points.

Contrast Stretching Function

The function konstrast(slika, koordinati) applies a piecewise linear...

Continue reading "Contrast Stretching and Range Compression in Python with OpenCV" »

Programa Java para Calcular Media, Máximo y Mínimo

Computer science3.39 KB

Clase Principal Ejercicio2Procesos1

public class Ejercicio2Procesos1 {
    int numero1, numero2, numero3, numero4, numero5, numero6;

    public static void main(String[] args) throws IOException {
        System.out.println("Introduce un numero");
        Scanner sc = new Scanner(System.in);

        ejercicio2procesos1.Metodos1 media = new ejercicio2procesos1.Metodos1();
        media.Media(numero1, numero2, numero3, numero4, numero5, numero6);

        ejercicio2procesos1.Metodos1 maximo = new ejercicio2procesos1.Metodos1();
        maximo.Maximo(numero1, numero2, numero3, numero4, numero5, numero6);

        ejercicio2procesos1.Metodos1 minimo = new ejercicio2procesos1.Metodos1();
        minimo.Minimo(numero1, numero2, numero3, numero4,
...
Continue reading "Programa Java para Calcular Media, Máximo y Mínimo" »

Implementing a Custom HashTable in Java

Computer science2.67 KB

Custom HashTable Implementation in Java

This document provides a robust implementation of a HashTable in Java, demonstrating core concepts like load factors, capacity management, and collision handling.

Class Definition

public class HashTable1 implements IHashTable {
    private Entry1 table[];
    private int size;
    private final float loadFactor;
    private int threshold;
    private final int DEFAULT_INITIAL_CAPACITY = 12;
    private final float DEFAULT_LOAD_FACTOR = 0.75f;

    public HashTable1() {
        loadFactor = DEFAULT_LOAD_FACTOR;
        threshold = DEFAULT_INITIAL_CAPACITY;
        table = new Entry1[DEFAULT_INITIAL_CAPACITY];
    }

    public HashTable1(int initialCapacity, float loadFactor) {
        if (initialCapacity
...
Continue reading "Implementing a Custom HashTable in Java" »

REST Architectural Style: Statelessness, Caching, and Layered Systems

Computer science192.43 KB

Chapter 3: Statelessness

This means that each request from a service consumer should contain all the necessary information for the service to understand the meaning of the request. All session state data should then be returned to the service consumer at the end of each request.

Figure 5.2. Statelessness ensures that each service consumer request can be treated independently by the service.

Image