English | Italiano
C++20 implementations of the data structure libraries for the Laboratory of Algorithms and Data Structures (LASD) course at the University of Naples Federico II, Academic Year 2024/2025.
This repository contains the solutions to Exercise 1 and Exercise 2, assigned as midterm projects. Every structure is implemented from scratch — no STL containers.
Container interfaces
Container,ClearableContainer,ResizableContainerTestableContainer,TraversableContainer,MappableContainer(withPreOrder/PostOrdervariants)DictionaryContainer,OrderedDictionaryContainerLinearContainer,MutableLinearContainer,SortableLinearContainer
Linear structures
Vector/SortableVector— resizable, sortable arrayList— singly linked list
Ordered sets
SetVec— ordered set built on top ofVectorSetLst— ordered set built on top ofList
Heap/HeapVec— heap interface and array-based implementation on top ofSortableVectorPQ/PQHeap— priority queue interface and implementation on top ofHeapVec
Exercise 2 includes and extends the code of Exercise 1.
cpp-data-structures/
├── Librerie_Da_Consegnare/
│ ├── Exercise1/
│ │ ├── container/ # base container interfaces (traversable, mappable, dictionary, linear)
│ │ ├── vector/ # Vector and SortableVector
│ │ ├── list/ # linked List
│ │ ├── set/ # SetVec and SetLst
│ │ ├── zlasdtest/ # official course test suite
│ │ ├── zmytest/ # custom test suite
│ │ ├── main.cpp # CLI entry point (test suite selection)
│ │ └── makefile
│ └── exercise2/
│ ├── container/ # updated base containers
│ ├── vector/ # updated Vector and SortableVector
│ ├── list/ # updated List
│ ├── set/ # updated SetVec and SetLst
│ ├── heap/ # Heap and HeapVec
│ ├── pq/ # PQ and PQHeap
│ ├── zlasdtest/ # official test suite (Exercise 1 + 2)
│ ├── zmytest/ # custom test suite (Exercise 1 + 2)
│ ├── main.cpp
│ └── makefile
└── README.md
Requirements: g++ with C++20 support and GNU make.
git clone https://github.com/kiyx/cpp-data-structures.git
cd cpp-data-structures/Librerie_Da_Consegnare/exercise2
make # g++ -Wall -pedantic -O3 -std=c++20 -fsanitize=address
./mainThe main executable shows a CLI menu:
0— run the official test suite (lasdtest)1— run the custom test suite (mytest)- any other number — exit
To clean build artifacts:
make cleanUse Exercise1/ instead of exercise2/ to build Exercise 1 only.
Two test suites are included:
zlasdtest— the official LASD course suite, with basic and full tests for every structure.zmytest— a custom suite with additional coverage (edge cases, mixed operations, stress tests).
Both build with AddressSanitizer enabled (-fsanitize=address) to catch memory errors during testing.
- Each exercise is a self-contained makefile project.
- Exercise 2 reuses the Exercise 1 library and adds heap and priority queue on top of it.