Skip to content

๐Ÿ“ This is a collection of implementations I did for my university data structures course. Each exercise has testing, profiling, a demo recording and some useful resources. Java, C and Python were used.

Notifications You must be signed in to change notification settings

armi3/data-structures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Data structures

This is a collection of implementations I did for my university data structures course. Each exercise has testing, profiling, a demo recording and some useful resources. Java, C and Python were used.

Table of contents

  1. Exercise 1 ๐Ÿงฎ
  2. Exercise 2 (Stacks)
  3. Exercise 3 (Arrays) ๐Ÿ’ณ
  4. Exercise 4 (Matrices) ๐Ÿ›’
  5. Exercise 5 (Strings) ๐Ÿ“Š
  6. Exercise 6 (Structs)
  7. Exercise 7 (Circular Linked List) ๐ŸŽง
  8. Exercise 8 (Queue and Simply Linked List) ๐Ÿ“†
  9. Exercise 9 (B-tree) ๐ŸŒณ
  10. Laboratory (Dijkstra's SPF algorithm)
  11. Final project (Boxit) ๐Ÿ“ฆ

Exercise 1 ๐Ÿงฎ

  • Algorithm to find the sum of the first N natural numbers.
  • Code in C
  • Demo: https://youtu.be/8mKBWEocZ48
  • Unit testing with dockerized CUnit
  • Profiling with dockerized Valgrind:
    • Memory profiling with Memcheck tool
    • Heap, allocation tree and stack profiling with Massif tool
    • Call profiling with Callgrind tool

Walkthrough

Get the program compiled and running:

git clone https://github.com/armi3/data-structures.git; \
cd exercise\ 1/src && cc -std=c99 -o app app.c functions.c && ./app

Build Ubuntu 16 based container with CUnit and Valgrind:

cd .. && docker build -t memory-test:0.1 .

Test the program's methods with dockerized CUnit:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o tests/functions_test tests/functions_test.c -lcunit -v; \
tests/functions_test"

Profile program with dockerized Valgrind

Heap, allocation tree and stack profiling:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o src/app src/app.c src/functions.c -g; \
valgrind --tool=massif --stacks=yes --massif-out-file=profiling/massif_app src/app; \
ms_print profiling/massif_app"

Memory profiling:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o src/app src/app.c src/functions.c -g; \
valgrind --leak-check=full -v src/app"

Call profiling:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o src/app src/app.c src/functions.c -g; \
valgrind --tool=callgrind --callgrind-out-file=profiling/callgrind_app -v src/app; \
valgrind callgrind_annotate --tree=both --auto=yes profiling/callgrind_app"

Profile test with dockerized Valgrind

Heap, allocation tree and stack profiling:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o tests/functions_test tests/functions_test.c -g -lcunit -v; \
valgrind --tool=massif --stacks=yes --massif-out-file=profiling/massif_functions_test tests/functions_test; \
ms_print profiling/massif_functions_test"

Memory profiling:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o tests/functions_test tests/functions_test.c -g -lcunit -v; \
valgrind --leak-check=full -v tests/functions_test"

Call profiling:

docker run -ti -v $PWD:/test memory-test:0.1 bash -c \
"cd /test/; gcc -std=c99 -o tests/functions_test tests/functions_test.c -g -lcunit -v; \
valgrind --tool=callgrind --callgrind-out-file=profiling/callgrind_functions_test -v tests/functions_test; \
valgrind callgrind_annotate --tree=both --auto=yes profiling/callgrind_functions_test"

Resources

Exercise 2 (Stacks)

  • Algorithm to implement a stack data structure.
  • Code in Java
  • Demo: https://youtu.be/9xWy4dNyj6g
  • Unit testing with JUnit 5
  • Profiling with JProfiler

Resources

Exercise 3 (Arrays) ๐Ÿ’ณ

resources

Exercise 4 (Matrices) ๐Ÿ›’

  • Shopping cart and payment methods manager.
  • Code in Java
  • Demo: https://youtu.be/ERi7V_H97Us
  • Unit testing with JUnit 5
  • Profiling with JProfiler

Exercise 5 (Strings) ๐Ÿ“Š

  • Returns a histogram with the top 10 most repeated chars.
  • Code in Java
  • Demo: https://youtu.be/uZgNDzgXhUM
  • Unit testing with JUnit 5
  • Profiling with JProfiler

Resources

Exercise 6 (Structs)

  • Returns point's quadrant implementing a struct (class without methods).
  • Code in Java
  • Demo: https://youtu.be/J9PImk7_7ho
  • Unit testing with JUnit 5
  • Profiling with JProfiler

Resources

Exercise 7 (Circular Linked List) ๐ŸŽง

  • Music player simulation implementing a circular linked list.
  • Code in Java
  • Demo: https://youtu.be/dOMIVKmkuMM
  • Unit testing with JUnit 5
  • Profiling with JProfiler

Exercise 8 (Queue and Simply Linked List) ๐Ÿ“†

  • Stores scheduled jobs in queue and updates linked list of employees.
  • Code in Java
  • Unit testing with TestNG
  • Profiling with JProfiler
  • Demo: https://youtu.be/9Br9xS27suI

Exercise 9 (B-tree) ๐ŸŒณ

  • Compares linked list performance versus b-tree.
  • Code in Java
  • Demo: https://youtu.be/1zJ_lNlY4vg
  • Unit testing with TestNG
  • Profiling with JProfiler

Resources

Laboratory (Dijkstra's SPF algorithm) ๐Ÿ’ท

  • Uses the shortest path first algorithm to find exchange rates.
  • Code in Python

Final project (Boxit) ๐Ÿ“ฆ

  • Boxit is a desktop prototype app for creating suscription boxes.
  • Implements the data structures learned throughout this course.
  • Code in Java
  • Demo: https://youtu.be/8nPCmNAcdlc
  • Unit testing with TestNG
  • Profiling with JProfiler
  • Front end with JavaFX

Screenshots

Spotlight Lab

About

๐Ÿ“ This is a collection of implementations I did for my university data structures course. Each exercise has testing, profiling, a demo recording and some useful resources. Java, C and Python were used.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages