Programmer Friendly Data Structures (PFDS)

版本 1.5.0 (159.2 KB) 作者: Steve Lenk
Nodes + data structures + methods = solutions.
21.0 次下载
更新时间 2025/4/8

查看许可证

PFDS - Programmer Friendly Data Structures for MATLAB
April 8, 2025
PFDS provides data structures and nodes for problem solving.
PFDS is programmer friendly, made to integrate with MATLAB.
PFDS is made MATLAB friendly, not to replace MATLAB..
Solve your software problems by directly using or extending PFDS.
PFDS is implemented as a hierarchy of is-a class relationships.
There is a documented use relationship between nodes and data structures.
Nodes, data structures, and algorithms work together.
OO methods are algorithms for nodes and data structures.
Nodes match things in your problem space. Extend node types where needed.
Data structures provide organized nodes to which methods are applied.
Nodes and data structures work together to provide code insight.
Data structure info() function walks nodes and uses node info() function: >> object_reference.info()
Both data structures and nodes are open for extention by YOU. Class hierarchy is arranged for method reuse or modification.
Solutions.
Think nodes, extend selected node type to suit your problem.
Pick data structure for your problem. Use methods as a guide.
Add methods as needed to nodes and data structures.
Make nodes and add them to data structure.
Apply methods to data structure to obtain solution.
Is-a and has-a for applications both work fine. See examples listed below.
Use PFDS test code and example code to learn how to use PFDS.
Coding name conventions used by PFDS.
o is a Node object
obj is a data structure object
l is a logical
s is a string
p is parent
cel is cell array
Classes use caps for start of words in class name
Methods start with lower case letter
Methods may have _moreinfo appended
Variables are lower case letters
Variables or functions with _ inside are Ok
Write readable code to reduce comment clutter
Examples in Mathworks: ToyWorld_3D, Information_Demo and testDijkstraTwoStack.
Tests.
Unit tests and testAll.m are provided.
PFDS/toolbox/test/results directory retains result files.
Watch the tests and check for yourself.
Feel free to improve them.
Nodes provided:
Node (base class for all nodes)
SingleChildNode (one parent) < Node
MultiChildNode < Node
PriorityQueueNode < SingleChildNode
BinaryTreeNode < Node
BinarySearchTreeNode < BinaryTreeNode
AVLNode < BinarySearchTreeNode
Node_3D < MultiChildNode
Part < Node_3D
Surface < Part
HeapNode < Node
Data Structures provided:
DataStructure(base class for all data Structures)
DoublyLinkedList < DataStructure
Queue < DoublyLinkedList
PriorityQueue < Queue
Stack < DoublyLinkedList
Tree < DataStructure
BinaryTree < Tree
BinarySearchTree < BinaryTree
MultiChildTree < Tree
AVLTree < BinarySearchTree
Tree_3D < MultiChildTree
Heap < DataStructure
Copyright 2025 Steve Lenk, see BSD 3-clause for details.

引用格式

Steve Lenk (2025). Programmer Friendly Data Structures (PFDS) (https://www.mathworks.com/matlabcentral/fileexchange/164691-programmer-friendly-data-structures-pfds), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2024a
兼容 R2024a
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.5.0

Improved tests; Node "Slug" now mutable for find and modify in place; Removed nodes are removed from structure, but not deleted.

1.4.0

Nodes have immutable Slugs (data).
Tests for BST and AVL updated for comparison.

1.3.0

"Complete" set of nodes + data structures + methods to make solutions in MATLAB. V1.3.0. Pls enjoy.

1.1.0

AVL Tree, Part, Surface added. Cleanups done.

1.0.0