C Language Data Structures and Algorithms Implementations
C Language Data Structures and Algorithms
This document presents fundamental data structures and algorithms implemented in C. Each section provides a complete code example, demonstrating core concepts like stack operations, sorting, searching, and mathematical functions.
Stack Data Structure: Interactive Operations
A stack is a Last-In, First-Out (LIFO) data structure. This C program demonstrates a basic array-based stack implementation with interactive functions for pushing, popping, peeking, and
Read MoreOperating System Fundamentals: Processes, Memory, Concurrency, Scheduling
Operating System Processes
Process View: The Illusion of Exclusivity
A process is essentially a running instance of a program. One of the key abstractions that the Operating System (OS) provides is the illusion that each process has exclusive access to the CPU and memory. However, in reality, the CPU and memory are shared among multiple processes.
How the Illusion is Created
- CPU Time Sharing: The OS rapidly switches between processes (context switching) so that it seems each process has its own CPU.
Implementing Stack, Queue, and Deque Data Structures
This document provides implementations of three fundamental data structures: Stack, Queue, and Deque. Each data structure is presented with code examples in both Python and C++, demonstrating their core functionalities using linked lists.
Stack Data Structure (LIFO)
A Stack is a Last-In, First-Out (LIFO) data structure. Elements are added and removed from the same end, often referred to as the “top” of the stack.
Python Stack Implementation
The Python implementation uses a simple Node class to build
Read MoreC Programming Examples: Data Structures & Algorithms
C Programming Examples: Data Structures and Algorithms
This document presents a collection of fundamental C programming examples, covering essential data structures and algorithms. Each section includes a C code implementation along with a brief explanation of its functionality.
1. String Length and Concatenation in C
This C program demonstrates how to calculate the length of a string and concatenate two strings without using built-in library functions like strlen()
or strcat()
. It provides a menu-
Object-Oriented Concepts and UML Diagrams Explained
Object-Oriented Concepts
Object: An object is anything that we can recognize with an identity, a state, and behavior.
Class: It is an abstraction representing a set of objects with similar behavioral characteristics.
Use Cases
Use Case: A sequence of interactions (user-software product) to meet requirements.
Actor: Anyone who needs to meet their requirements. There may be 3 types:
- Main: The one who initiates the use case and needs to fulfill its requirements.
- Partner: An actor interacting with the principal
Validação de Formulários HTML com JavaScript e Regex
Validação com Expressões Regulares (Regex)
Validar Apenas Números
Expressão regular para checar se o campo possui apenas números.
function validaApenasNumero() {
var regex = /^\d+$/;
var value = document.getElementById("name1").value;
if (regex.test(value)) {
alert("Correto");
return;
}
alert("Errado");
return;
}
Nome: Ok
Validar Apenas Letras
Expressão regular para checar se o campo possui apenas letras.
function validaApenasLetras(){
var regex = /^[a-zA-Z]+$/;
// Corrigido:
Read More