algorithm package
Classes
Class | Description |
|---|---|
Self-balancing tree. 自平衡树。 | |
A deque implementation based on array. 一个基于数组的双向队列。 | |
A queue implementation based on array. 一个基于数组的单向队列。 | |
A stack implementation based on arrays. 一个基于数组实现的栈。 | |
一个比较合适的哈希表,采用 djb2 哈希算法,以及平方探测,用以解决冲突。 | |
Binary Search Tree 二叉搜索树 | |
Doubly Linked List Class 双向链表 | |
Doubly Linked List Node Class 双向链表节点 | |
Edge class. 边类。 | |
Graph class 图类。(邻接表) | |
A key-value pair. 一个键值对。 | |
A hashmap with linear probing. 一个使用线性探查的哈希表。 | |
A deque implementation based on DoublyLinkedList. 一个基于链表的双向队列。 | |
A hash map with linked list chaining. When encountering hash collisions, it continues to search in the linked list. 一个链式寻址的哈希表。 若遇到哈希值冲突时,将会根据在链表中继续寻找。 | |
A queue implementation based on SinglyLinkedList. 一个基于链表的单向队列。 | |
A stack implementation based on SinglyLinkedList. 一个基于数组实现的栈。 | |
Max Heap Class 最大堆 | |
Min Heap Class 最小堆 | |
A deque implementation based on object. 一个基于对象的双向队列。 | |
A queue implementation based on object. 一个基于对象的单向队列。 | |
A stack implementation based on object. 一个基于对象实现的栈。 | |
Red-Black Tree 红黑树 | |
Red-Black Tree Node 红黑树节点 | |
A class that extends Set with additional functionalities. 一个扩展了 Set 的类,提供了额外的功能。 | |
A simple hashmap. It is prone to key collision issues, where conflicting keys cannot be added to the hashmap. 一个简单的哈希表。 它容易遇到键冲突问题,冲突的键无法添加到哈希表中。 | |
Singly Linked List Class 单向链表 | |
Singly Linked List Node Class 单向链表节点 | |
Sorted Linked List Class 有序链表 | |
A hashmap with square probing. 一个使用平方探查法的哈希表。 | |
Vertex class. 顶点类。 |
Abstract Classes
Abstract Class | Description |
|---|---|
Base class for algorithm. 基类。 | |
A base class for hash maps. 一个哈希表的基类。 |
Enumerations
Enumeration | Description |
|---|---|
Compare the two values. 比较两值结果。 |
Functions
Function | Description |
|---|---|
Sequential search algorithm.(AdelsonVelskiiLandiTree) Input parameters do not need to be sorted. 线性搜索算法。(自平衡树) 传入参数必须已经进行从小到大排序。 | |
Binary search algorithm. Input parameters must be sorted in ascending order. 二分搜索算法。 传入参数无需排序。 | |
Sequential search algorithm.(BinarySearchTree) Input parameters do not need to be sorted. 线性搜索算法。(二叉搜索树) 传入参数必须已经进行从小到大排序。 | |
Breadth-first search algorithm (BFS). 广度优先搜索算法(BFS)。 | |
Using Breadth-first search algorithm to obtain shortest path information. 使用广度优先搜索算法获取最短路径信息。 | |
breadthFirstSearchShortestPathString(graph, startVertex, chars) | Using Breadth-first search algorithm to obtain shortest path information.(Return string) 使用广度优先搜索算法获取最短路径信息。(返回字符串) |
Bubble sort algorithm. 冒泡排序。 Time complexity: O(n^2 / 2) Time complexity badest case: O(n^2 / 2) Time complexity goodest case: O(n) Space complexity: O(1) | |
Bubble sort algorithm. 冒泡排序。 Time complexity: O(n^2) Time complexity badest case: O(n^2) Time complexity goodest case: O(n) Space complexity: O(1) | |
Bucket sort algorithm. 桶排序。 Time complexity: O(n) | |
Counting sort algorithm. 计数排序。 Time complexity: O(n+k) Time complexity badest case: O(n+k) Time complexity goodest case: O(n+k) Space complexity: O(n+k) | |
Compare the relationship between a and b. 比较 a 和 b 的大小关系。 | |
Check if a and b are equal. 判断 a 和 b 是否相等。 | |
Convert any type to a number. This function should ensure that different objects in the target dataset are not converted to the same number. 将任意类型转换为数字。 此函数应保证目标数据集中不同对象不会被转换为相同数字。 | |
Depth-first search algorithm (DFS). 深度优先搜索算法(DFS)。 | |
Using Depth-first search algorithm to obtain shortest path information. FIXME: The results are not accurate, not recommended for use. 使用深度优先搜索算法获取最短路径信息。 !!!结果不够准确,不建议使用。 | |
depthFirstSearchShortestPathString(graph, startVertex, chars) | Using Depth-first search algorithm to obtain shortest path information.(Return string) FIXME: The results are not accurate, not recommended for use. 使用深度优先搜索算法获取最短路径信息。(返回字符串) !!!结果不够准确,不建议使用。 |
Depth-first search algorithm (DFS). A variant implementation. 深度优先搜索算法(DFS)。 一个变种实现。 | |
Hash search algorithm. Input parameters do not need to be sorted. 哈希搜索算法。 传入参数无需排序。 | |
Heap sort algorithm. 堆排序。 Time complexity: O(n logn) Time complexity badest case: O(n logn) Time complexity goodest case: O(n logn) Space complexity: O(1) | |
Insertion sort algorithm. 插入排序。 Time complexity: O(n^2) Time complexity badest case: O(n^2) Time complexity goodest case: O(n) Space complexity: O(1) | |
Interpolation search algorithm. Input parameters must be sorted in ascending order. 内插搜索算法。 传入参数必须已经进行从小到大排序。 | |
The equality function for KeyValue objects. KeyValue 对象的相等性函数。 | |
The default function to convert a key-value pair to an object. 将键值对转换为对象的默认函数。 | |
Merge sort algorithm. 归并排序。 Time complexity: O(n logn) Time complexity badest case: O(n logn) Time complexity goodest case: O(n logn) Space complexity: O(n) | |
Quick sort algorithm. 快速排序。 Time complexity: O(n logn) Time complexity badest case: O(n^2) Time complexity goodest case: O(n logn) Space complexity: O(n logn) | |
Radix sort algorithm. 基数排序。 Time complexity: O(n*m) Time complexity badest case: O(n*m) Time complexity goodest case: O(n*m) Space complexity: O(m) | |
Sequential search algorithm.(RedBlackTree) Input parameters do not need to be sorted. 线性搜索算法。(红黑树) 传入参数必须已经进行从小到大排序。 | |
Selection sort algorithm. 选择排序。 Time complexity: O(n^2) Time complexity badest case: O(n^2) Time complexity goodest case: O(n) Space complexity: O(1) | |
Sequential search algorithm. Input parameters must be sorted in ascending order. 线性搜索算法。 传入参数必须已经进行从小到大排序。 | |
Shuffle the array randomly. 随机打乱数组。 | |
Converts a key to a string. 将键转换为字符串。 |
Interfaces
Interface | Description |
|---|---|
Graph class toArray function returns an array item. Graph 类 toArray 函数返回的数组项。 | |
An interface representing a key-value object. 表示键值对象的接口。 |
Variables
Variable | Description |
|---|---|
djb2 hash function. Better than loselose hash function. djb2 散列函数。比 loselose 散列函数更好。 | |
An empty KeyValue. 一个空的 KeyValue。 | |
loselose hash function. loselose 散列函数。 |
Type Aliases
Type Alias | Description |
|---|---|
(Type) Compare the relationship between a and b. (类型) 比较 a 和 b 的大小关系。 | |
(Type) Check if a and b are equal. (类型) 判断 a 和 b 是否相等。 | |
Converts a string key to a hash code. 将字符串键转换为哈希码。 | |
Converts a key to a string. 将键转换为字符串。 | |
Convert any type to a number. This function should ensure that different objects in the target dataset are not converted to the same number. 将任意类型转换为数字。 此函数应保证目标数据集中不同对象不会被转换为相同数字。 |