Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues GPLv3 License


DataStructures

A personal collection of classic data-structure implementations in C, Java and Python.
Explore the repository »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

DataStructures gathers hand-written implementations of the classic abstract data types — lists, stacks, queues, hash tables, skip lists, graphs, heaps and trees — across three languages. It started as the coursework for the Estructura de Dades (Data Structures) course of the Computer Science degree at Universitat Rovira i Virgili (URV) (2019–2020) and has been extended since with a small object-oriented list hierarchy in Python and a double-ended queue in Java.

Each structure is implemented from first principles (no standard-library containers) and ships with its own runnable test driver, so the repository doubles as a study reference for how each structure is built and exercised.

The three language trees are independent; pick the one you want and build only that.

(back to top)

Built With

  • C   C (C99, built with gcc)
  • Java   Java (IntelliJ project, Java 8+)
  • Python   Python 3
  • GNU Make   GNU Make (one makefile per C module)

(back to top)

What's Inside

C/        classic structures in C, each folder with its own makefile + test driver
java/     IntelliJ project with three sub-projects
python/   small object-oriented List / LinkedList hierarchy

C/

Module Structure Extras / driver
ArrayList/ Dynamic array list Sorting & search-cost exercise (ArrayListTest.c)
Stack/ Generic stack (pila) and a real-valued stack Reverse-Polish-notation calculator (rpn.c, rpn_reals.c)
Queue/ Stacks and queues (pilas, colas) main.c demo
CircularQueue/ Circular queue (cua) built on top of the stack Pascal-triangle generator (trianglePascal.c)
DoubleLinkedList/ Doubly linked list Student Manager interactive CLI that persists to a file
HashTable/ Hash table with chaining (thash) Driver that loads keys from datos_hash.txt
SkipList/ Probabilistic skip list Randomised insert / search / delete test
includes/ Shared helpers: commonlib, random, ErrorCodes.h

java/

Sub-project Contents
DoubleQueue/ Double-ended queue with a static (array) and a dynamic (linked) implementation; Main uses it for palindrome checking
Graph_Heap/ Generic graph + binary heap; Main loads Pajek .net networks from data/ (airports, US power grid, world-trade web, URV e-mail)
Huffman/ Generic list ADT + iterator and a Huffman tree / coder

python/

  • List (abstract base class) with Array / ArrayImpl, ArrayList and LinkedList (Node) implementations, plus a main.py demo.

(back to top)

Getting Started

Prerequisites

You only need the toolchain for the language you want to run:

  • C — a C compiler and GNU Make
    sudo apt install build-essential
  • Java — a JDK (11+). The sub-projects are IntelliJ IDEA modules with no build file, so opening java/ in IntelliJ is the smoothest path; javac on each src/ tree also works.
  • Python — Python 3 (standard library only)
    python3 --version

Installation

git clone https://github.com/AleixMT/DataStructures
cd DataStructures

(back to top)

Usage

C

Every module has its own makefile. From inside a module folder:

cd C/Stack
make            # build the test / demo binaries
./test          # run the stack test driver

Notes:

  • make run (where defined) builds and then runs the module's main binary.
  • C/CircularQueue and C/DoubleLinkedList reference sources under C/Stack and C/includes, so keep the tree intact.
  • C/Stack/rpn reads its expression from input3.txt in the current directory — run it from inside C/Stack/.
  • Test-driver output is currently in Catalan / Spanish.

Java

Open java/ (or an individual sub-project) in IntelliJ IDEA and run the Main class of the sub-project you want. Graph_Heap expects java/Graph_Heap as the working directory so it can find data/*.net.

Python

cd python
python3 main.py

(back to top)

Roadmap

  • Fix C/ArrayList include path (../_includes/../includes/)
  • Fix the conflicting pila declaration in C/Queue/pilas.c
  • Modernise C/HashTable/main.c for current compilers (#include <string.h>, getline buffer type)
  • Remove the committed C/HashTable/main binary and add a top-level make that builds every module
  • Add a real build file (Maven or Gradle) for the Java sub-projects
  • Translate the C test-driver output to English and unify the drivers
  • Grow the Python side to cover stacks, queues, hash tables and trees like the C and Java trees

See the open issues for the current list.

(back to top)

Contributing

Contributions are what make the open-source community such an amazing place to learn and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GNU General Public License v3.0. See LICENSE for more information.

(back to top)

Contact

Aleix Mariné-Tena — aleix.marine.tena@gmail.comLinkedIn

Project Link: https://github.com/AleixMT/DataStructures

(back to top)

Acknowledgments

(back to top)

About

Personal collection of classic data-structure implementations in C, Java and Python.

Topics

Resources

Code of conduct

Security policy

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages