Tag: array

  • Algorithms 101: Deque Implementation Using Fixed Array

    Deque Implementation Using Fixed Array (双端队列用固定数组的实现) Implementing a deque using a fixed-size array is another efficient method that provides constant-time access to elements and operations at both ends of the deque. This approach, however, requires handling the circular nature of the deque when the array is full or when operations…

  • Algorithms 101: Circular Queue Implementation Using Array

    环形队列用数组实现 Circular Queue Implementation Using Array A circular queue is a more efficient implementation of a queue using an array, where the end of the array wraps around to the beginning. This avoids the need to shift elements and allows the queue to efficiently utilize space. Unlike a traditional linear…

  • Algorithms 101: Stack Implementation Using Array

    栈的数组实现 Stack Implementation Using Array A stack can be implemented using an array where the push operation adds an element to the end of the array (top of the stack), and the pop operation removes the element from the end. This implementation is simple and leverages the dynamic resizing capabilities…

  • Algorithms 101: Queue Implementation Using Linked List and Array

    队列的链表实现和数组实现 Queue Implementation Using Linked List and Array 1. 使用链表实现队列 1. Queue Implementation Using Linked List A queue can be implemented using a linked list where each node represents an element in the queue. The head of the linked list represents the front of the queue, and the tail represents…

  • Comparison: List (list) vs Array (array)

    Comparison: List (list) vs Array (array)

    Comparison: List (list) vs Array (array) Here’s a detailed comparison between Python’s list and array from the array module. Comparison Table 比较表 Feature List (list) Array (array) Definition Built-in mutable sequence Module-based sequence for storing homogeneous data 定义 内置的可变序列 基于模块的同质数据存储序列 Import Required No Yes (from array import array) 需要导入 否…