Skip to content

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | Italiano

C++ Data Structures — LASD Libraries 24-25

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.


Data Structures Implemented

Exercise 1 — Base Containers

Container interfaces

  • Container, ClearableContainer, ResizableContainer
  • TestableContainer, TraversableContainer, MappableContainer (with PreOrder/PostOrder variants)
  • DictionaryContainer, OrderedDictionaryContainer
  • LinearContainer, MutableLinearContainer, SortableLinearContainer

Linear structures

  • Vector / SortableVector — resizable, sortable array
  • List — singly linked list

Ordered sets

  • SetVec — ordered set built on top of Vector
  • SetLst — ordered set built on top of List

Exercise 2 — Heap and Priority Queue

  • Heap / HeapVec — heap interface and array-based implementation on top of SortableVector
  • PQ / PQHeap — priority queue interface and implementation on top of HeapVec

Exercise 2 includes and extends the code of Exercise 1.


Project Structure

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

Build and Run

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
./main

The 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 clean

Use Exercise1/ instead of exercise2/ to build Exercise 1 only.


Testing

Two test suites are included:

  1. zlasdtest — the official LASD course suite, with basic and full tests for every structure.
  2. 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.


Notes

  • 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.

About

Custom C++20 implementation of a container library hierarchy (vector, list, ordered sets, heap, priority queue) built from scratch as LASD course projects, with the official and a custom extensive test suite.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages