Algorithm: A finite sequence of elementary operations arranged in a specific order, which specifies a calculation scheme. According to the Encyclopedia Universalis, it is a schema of calculation expressed as a finite set of elementary operations obeying a determined sequence. (Source: Encyclopaedia Universalis)
Algorithm as Data Transformation: An algorithm functions as a process that transforms input data into output results through a series of well-defined steps. It systematically processes data to achieve a certain goal. (Implied from the general definition)
Deterministic Algorithm: An algorithm that, given the same input, always produces the same sequence of operations and results. This property ensures consistency and predictability in execution. (Source: Encyclopaedia Universalis)
Historical Origin of Algorithms: The concept predates modern computers, with early formulations by Euclid (3rd century BC) and the Babylonians (1800 BC, during Hammurabi's era). The term "algorithm" itself derives from Al-Khwarizmi (820 AD), whose work on arithmetic and calculation rules significantly influenced the development of systematic problem-solving methods. (Source: Encyclopaedia Universalis)
Algorithm as a Data Transformation Process: It is a process that takes data (inputs) and applies a finite set of elementary operations to produce results (outputs). This emphasizes the functional aspect of algorithms in converting data from one form to another. (Implied from the general definition)
An algorithm is a finite, deterministic sequence of elementary operations that transforms data into results, with origins tracing back to ancient mathematicians like Euclid and Al-Khwarizmi, forming the basis of systematic problem-solving in computing.
Algorithm expression is independent of programming language: The conceptual formulation of an algorithm does not rely on any specific programming language, meaning its logic and structure remain consistent regardless of the language used for implementation. This allows for universal understanding and transferability of algorithmic ideas (see section 1-2).
Algorithm must be expressed in a programming language for execution: To be executed by a computer, an algorithm needs to be translated into a specific programming language. This step involves coding the algorithm's logic into syntax and structures that a machine can interpret and run (see section 1-2).
Algorithm + data structures = program (Wirth): According to Wirth (1976), a complete program is formed by combining the algorithmic logic with appropriate data structures. The data structures organize and store data efficiently, enabling the algorithm to operate effectively, thus creating a functional program.
Algorithm expression is a language-independent conceptual framework that must be translated into a programming language to be executed, and when combined with data structures, it forms a complete program as per Wirth's principle.
A program is a carefully structured sequence of instructions that abstracts hardware complexity, enabling the processor to manipulate data and produce results efficiently during execution in main memory.
Algorithm complexity (see source): Measures the execution cost of an algorithm, primarily focusing on the time required to complete its operations, which depends on data size and input values. It provides a way to evaluate and compare algorithm efficiency.
Worst-case, average-case, and best-case complexities (see source): These are scenarios used to analyze an algorithm's performance:
Asymptotic complexity and Big O notation (see source): A mathematical framework to describe the growth rate of an algorithm's execution time as input size n approaches infinity. If T(n) ≤ c·f(n) for some constants c and n₀, then T(n) = O(f(n)), indicating T(n) is asymptotically bounded by f(n).
Rules for calculating complexity of loops, conditionals, sequences (see source):
Examples of complexity classes (see source): Common classes include:
Algorithm complexity measures execution cost in terms of time, enabling comparison and optimization. Asymptotic notation like Big O provides a practical way to evaluate algorithm efficiency for large data, guiding the choice of the most suitable algorithm for a given problem.
Sequential search in an unsorted array (see source): A method that scans each element in the array one by one until the target element is found or the end of the array is reached. Its time complexity is O(n), where n is the number of elements, because in the worst case, every element must be checked.
Sequential search in a sorted array with early stopping (see source): An optimized version of sequential search that stops the search process as soon as it encounters an element greater than the target, leveraging the array's sorted property. This reduces unnecessary comparisons, but in the worst case, still has O(n) complexity.
Search function returns index or -1 if not found (see source): A common convention where the search operation outputs the position (index) of the target element within the array if it exists, or -1 if the element is absent, indicating unsuccessful search.
Insertion and deletion operations in arrays (see source): Procedures to add or remove elements from an array. Insertion at the end is typically O(1) if space permits, but insertion or deletion at arbitrary positions requires shifting elements, resulting in O(n) time complexity due to element movement.
Sequential search in an unsorted array has O(n) worst-case complexity because it may need to examine every element to find the target or conclude absence.
When the array is sorted, early stopping in sequential search improves efficiency in practice, especially if the target is near the beginning or the array contains larger elements early on, but the worst-case complexity remains O(n).
In arrays, insertion and deletion are not constant-time operations; inserting or deleting an element at a specific position involves shifting subsequent elements, leading to O(n) time complexity.
The search function's output—either the index of the found element or -1—provides a straightforward way to verify search success or failure.
Sequential search methods are simple and effective for small or unsorted datasets, with linear time complexity, while operations like insertion and deletion in arrays require shifting elements, also resulting in linear time costs. The search function's return value clearly indicates success or failure, facilitating further processing.
Sorting problem: The task of arranging elements in a collection based on a key field, such as numerical or alphabetical order. The goal is to produce an ordered sequence that satisfies specific criteria.
Stable sorting: A sorting method that preserves the initial relative order of elements with equal keys. According to AUTHOR (date), stability ensures that if two elements are equal, their original order remains unchanged after sorting.
In-place sorting: A sorting technique that uses only the existing memory of the data structure, without requiring additional space proportional to the input size. This approach minimizes memory usage during sorting.
Elementary O(n^2) sorting algorithms: Basic sorting algorithms with quadratic time complexity, suitable for small datasets. These include bubble sort, selection sort, and insertion sort.
Bubble sort: An elementary sorting algorithm that repeatedly swaps adjacent elements if they are in the wrong order. This process continues until the entire array is sorted, with the largest elements "bubbling" to the end through repeated passes.
The sorting problem involves ordering elements based on a key field, which can be numerical, alphabetical, or any comparable attribute. Efficient sorting is crucial for data organization, searching, and retrieval.
Stable sorting is particularly important when the order of equal elements carries significance, such as in multi-criteria sorting or maintaining original insertion order. AUTHOR (date) emphasizes its importance in preserving data integrity.
In-place sorting algorithms are preferred when memory resources are limited, as they do not require additional space beyond the input array. This is especially relevant in embedded systems or large datasets.
Elementary algorithms like bubble sort perform repeated adjacent swaps, which makes them simple but inefficient for large datasets. Despite their quadratic time complexity, they are useful for educational purposes and small data.
The bubble sort algorithm continues passes over the array, swapping neighboring elements if they are out of order, until no swaps are needed, indicating the array is sorted.
Elementary O(n^2) sorting algorithms, such as bubble sort, are simple and easy to implement but are inefficient for large datasets. Stable and in-place sorting are important properties that influence the choice of sorting method depending on the application's requirements.
Key data in records:
A specific field within a record used to uniquely identify or organize data. It serves as the primary attribute for sorting or searching, such as a student ID or product code. (see section 3)
Satellite data:
The remaining fields in a record that are not part of the key. These contain supplementary information associated with the key, like a student's name or age, and are processed alongside the key during data operations.
Data structures as containers:
Abstract or concrete implementations designed to organize, store, and manage data efficiently. They provide mechanisms for data access, insertion, deletion, and organization, serving as the foundation for algorithms and applications. (see section 1-8)
Arrays:
Basic data structures that store elements of the same type in contiguous memory locations. Arrays allow direct access to elements via their index, enabling efficient retrieval and modification. They are fundamental for implementing more complex structures like lists or matrices.
Stack (pile): An abstract data type following the Last-In-First-Out (LIFO) principle, where the most recently added element is the first to be removed. (No specific author/date provided)
Queue (file): An abstract data type based on the First-In-First-Out (FIFO) principle, where the earliest added element is the first to be removed. (No specific author/date provided)
Push/Pop Operations: Operations specific to stacks; push adds an element to the top of the stack, pop removes the top element. (No specific author/date provided)
Enqueue/Dequeue Operations: Operations specific to queues; enqueue adds an element at the rear, dequeue removes an element from the front. (No specific author/date provided)
LIFO (Last-In-First-Out): The principle that the last element added to a stack is the first to be removed. (No specific author/date provided)
FIFO (First-In-First-Out): The principle that the first element added to a queue is the first to be removed. (No specific author/date provided)
Stacks and queues are fundamental data structures used to manage collections of elements with specific orderings—LIFO for stacks, FIFO for queues.
Operations push/pop for stacks and enqueue/dequeue for queues are the primary methods to add or remove elements, respecting their respective principles.
The stack structure is useful in scenarios like function call management, undo mechanisms, and syntax parsing, where the most recent operation needs to be accessed first.
The queue structure is applicable in scheduling, buffering, and breadth-first search algorithms, where elements are processed in the order they arrive.
These data types abstract the underlying implementation, allowing flexible usage across different programming contexts.
Stacks and queues are essential abstract data types that organize data according to LIFO and FIFO principles, respectively, enabling efficient management of ordered collections in various computational processes.
Linked list structure: A linear collection of nodes where each node contains data and a pointer to the next node, forming a chain. (Source: M. E. RIFFI, 2025/2026)
Node: The fundamental unit of a linked list, comprising two parts: the data (or content) and a pointer (or reference) to the next node in the sequence. (Source: M. E. RIFFI, 2025/2026)
Insertion in linked lists: The process of adding a new node at a specified position (beginning, end, or middle) by adjusting pointers, without shifting existing elements. (Source: M. E. RIFFI, 2025/2026)
Deletion in linked lists: Removing a node by re-linking the previous node's pointer to the node following the one to be deleted, effectively excising it from the chain. (Source: M. E. RIFFI, 2025/2026)
Advantages over arrays for dynamic data: Linked lists allow efficient insertion and deletion at arbitrary positions without shifting elements, and they can grow or shrink in size dynamically, unlike arrays which require contiguous memory and resizing. (Source: M. E. RIFFI, 2025/2026)
A linked list's structure relies on nodes connected via pointers, enabling flexible memory usage and dynamic resizing. Unlike arrays, linked lists do not require contiguous memory blocks, which makes them suitable for applications where the size of data changes frequently.
Insertion and deletion operations are efficient in linked lists because they involve only pointer adjustments, especially at the beginning or end of the list, avoiding the costly shifting of elements seen in arrays.
The main advantage over arrays is the ability to insert or delete elements in constant time (O(1)) at known positions, provided the node's location is known, and the list is singly linked (see source for detailed algorithms).
Despite their flexibility, linked lists have disadvantages such as higher memory overhead due to storing pointers and slower access times (O(n)) for random element access compared to arrays.
Linked lists provide a flexible, dynamic data structure ideal for applications requiring frequent insertions and deletions, offering advantages over arrays in managing variable-sized data efficiently.
Tree (see source): A hierarchical data structure composed of nodes connected by edges, where each node has a parent (except the root) and zero or more children, forming a parent-child relationship. It models a hierarchy with a single entry point called the root.
Node (see source): The fundamental element of a tree, containing data and references (or links) to its child nodes. Each node may have a parent node (except the root) and multiple children.
Binary Tree (see source): A specialized tree where each node has at most two children, commonly referred to as the left and right child. This restriction simplifies traversal and operations.
Traversal Methods (see source): Procedures to visit all nodes in a tree systematically. Common traversal methods include:
Properties of Traversals (see source): Traversal methods allow for various operations such as searching, printing, or modifying nodes. They are fundamental for algorithms like sorting, searching, and tree manipulation.
A tree is a non-linear data structure with nodes connected via parent-child relationships, forming a hierarchy with a unique root node (see source). It is used to represent structured data such as organizational charts, file systems, and decision processes.
Each node in a tree contains data and references to its children, enabling recursive traversal and manipulation. The parent-child links define the structure's hierarchy.
A binary tree restricts each node to having at most two children, which simplifies algorithms for traversal, insertion, and deletion, and is the basis for more complex structures like binary search trees and heaps.
Traversal methods systematically visit nodes in a specific order:
Traversal properties are essential for algorithms that require visiting all nodes, such as searching for a value or printing the tree structure.
A tree is a hierarchical data structure with parent-child relationships, and binary trees are a simplified form where each node has at most two children. Traversal methods enable systematic access to all nodes, underpinning many algorithms in data management and processing.
Adjacency Matrix: A two-dimensional array used to represent a graph where each cell (i, j) indicates the presence or absence of an edge between vertices i and j. For a graph with n vertices, it is an n x n matrix. (Source: RIFFI, 2025/2026)
Adjacency List: A collection of lists where each list corresponds to a vertex and contains all adjacent vertices connected by edges. It is an efficient way to represent sparse graphs, reducing space complexity compared to adjacency matrices. (Source: RIFFI, 2025/2026)
Directed Graph: A graph where edges have a direction, going from one vertex to another, represented as ordered pairs (u, v). The adjacency matrix or list reflects the directionality, indicating edges from u to v only. (Source: RIFFI, 2025/2026)
Undirected Graph: A graph where edges have no direction; connections are bidirectional. In adjacency representations, the matrix or list is symmetric, showing mutual connectivity between vertices. (Source: RIFFI, 2025/2026)
Graph Traversal (Basics): The process of visiting all vertices and edges in a graph systematically, typically using algorithms like Depth-First Search (DFS) or Breadth-First Search (BFS). Traversal helps in exploring graph structure, connectivity, and pathfinding. (Source: RIFFI, 2025/2026)
Adjacency matrix provides constant-time edge lookup (O(1)) but uses O(n²) space, making it suitable for dense graphs. It is straightforward to implement but less efficient for sparse graphs. (RIFFI, 2025/2026)
Adjacency list uses space proportional to the number of edges plus vertices (O(n + e)), making it ideal for sparse graphs. Traversal algorithms like DFS and BFS are more efficient with adjacency lists, especially in large, sparse graphs. (RIFFI, 2025/2026)
Directed graphs are used to model asymmetric relationships such as web links or one-way streets. Their adjacency representations reflect directionality, affecting traversal and pathfinding algorithms. (RIFFI, 2025/2026)
Undirected graphs model symmetric relationships like social networks or road maps. Their adjacency matrices are symmetric, simplifying certain algorithms but potentially increasing space usage. (RIFFI, 2025/2026)
Graph traversal algorithms (DFS and BFS) are fundamental for exploring graphs, detecting connectivity, cycles, and shortest paths. DFS uses a stack or recursion, while BFS uses a queue, systematically visiting vertices. (RIFFI, 2025/2026)
Graph representations like adjacency matrices and lists are essential for efficiently modeling different types of graphs, with traversal algorithms enabling systematic exploration of their structure. The choice of representation depends on graph density and application needs.
Hashing techniques efficiently access data by mapping keys to table indices using hash functions, with collision resolution methods like chaining and double hashing ensuring reliable data retrieval even in the presence of collisions.
| Aspect | Description | Key Authors / References |
|---|---|---|
| Algorithm Definition | Finite sequence of elementary operations, deterministic, data transformation process | Encyclopaedia Universalis, Euclid, Al-Khwarizmi |
| Algorithm Expression | Language-independent conceptual formulation; must be translated into a programming language; Wirth's view: algorithm + data structures = program | Wirth (1976) |
| Program Concept | Sequence of instructions executed by hardware; abstracts hardware; stored in main memory; CPU performs arithmetic and logical operations | Source: general programming principles |
| Complexity Notion | Measures algorithm efficiency; includes worst, average, best cases; analyzed via Big O notation | Source: algorithm analysis literature |
| Search & Sorting Algorithms | Techniques for data retrieval and ordering; efficiency depends on data structures and input size | Standard algorithms (e.g., binary search, quicksort) |
| Data Structures | Organized data storage: arrays, linked lists, trees, graphs, hash tables | Standard CS references |
| Stacks & Queues | LIFO and FIFO structures; used for managing data flow | Standard CS references |
| Linked Lists | Dynamic data structure with nodes pointing to next element | Standard CS references |
| Trees & Binary Trees | Hierarchical structures; binary trees enable efficient searching | Standard CS references |
| Graph Representations | Adjacency matrix, list; models relationships between entities | Standard CS references |
| Hashing Techniques | Data retrieval via hash functions; handles collisions with chaining or open addressing | Standard CS references |
Teste seu conhecimento sobre Fundamentals of Algorithms and Data Structures com 12 perguntas de múltipla escolha com correções detalhadas.
1. What is an algorithm primarily characterized as?
2. Who is the historical figure from whom the term 'algorithm' is derived?
Memorize os conceitos chave de Fundamentals of Algorithms and Data Structures com 24 flashcards interativos.
Algorithm — definition?
Finite sequence of elementary operations solving a problem.
Algorithm expression — language?
Language-independent; describes *what* to do, not *how*.
Program — concept?
Sequence of instructions executed by hardware to perform tasks.
Intelligence Artificielle
Bases de données
Bases de données
Bases de données
Importe seu curso e a IA gera fichas, quizzes e flashcards em 30 segundos.
Gerador de fichas