Thanks to visit codestin.com
Credit goes to github.com

Skip to content

giaom/Skiplist

Repository files navigation

Skiplist Project

Aisha Maabreh CSS 342 Winter 2023

Goals: Working with pointers and linked lists

Overview

This project implements a Skiplist data structure in C++. A Skiplist is a probabilistic data structure that allows for fast search, insertion, and deletion operations. It is similar to a linked list but with multiple levels, where each level is a subset of the level below it.

Files

  • .clang-format: Configuration file for clang-format to ensure consistent code formatting.
  • .clang-tidy: Configuration file for clang-tidy to enforce coding standards and catch common errors.
  • .gitignore: Specifies files and directories to be ignored by Git.
  • .vscode/: Contains Visual Studio Code configuration files.
    • c_cpp_properties.json: Configuration for IntelliSense and compiler paths.
    • launch.json: Configuration for debugging.
    • settings.json: General settings for the workspace.
    • tasks.json: Tasks for building the project.
  • check-code-coverage.sh: Script to compile the program with code coverage flags and generate a report.
  • create-output.sh: Script to compile, run, and check the program for warnings, formatting issues, and memory leaks.
  • main.cpp: Contains the main function and test cases for the Skiplist.
  • random.cpp: Implementation of a simple random number generator.
  • random.h: Header file for random.cpp.
  • README.md: This file.
  • runit.sh: Script to compile and run the program.
  • sample-output.txt: Sample output of the program.
  • skiplist.cpp: Implementation of the Skiplist data structure.
  • skiplist.h: Header file for skiplist.cpp.
  • DoublyAndCircularDoublyLinkedListsDiagram.jpg: Unrelated diagram of a doubly and a circular doubly linked list.

Building and Running

Prerequisites

  • clang++ or g++ compiler
  • clang-tidy
  • clang-format
  • valgrind (optional, for memory leak detection)

Build and Run

To build and run the project, you can use the provided scripts:

  1. runit.sh: Compiles and runs the program.

    ./runit.sh
  2. create-output.sh: Compiles, runs, and checks the program for warnings, formatting issues, and memory leaks.

    ./create-output.sh > output.txt 2>&1
  3. check-code-coverage.sh: Compiles the program with code coverage flags and generates a report.

    ./check-code-coverage.sh

Testing

The main.cpp file contains test cases for the Skiplist. These tests cover basic operations, copy constructor, multi-level Skiplist, and removal operations. The tests use the Random::random function to generate random numbers, ensuring consistent results across runs.

Code Formatting and Linting

The project uses clang-format and clang-tidy to ensure consistent code formatting and catch common errors. The configuration files for these tools are provided in the repository.

Memory Leak Detection

The project uses valgrind to detect memory leaks. The create-output.sh script runs the program with valgrind and reports any memory leaks.

Code Coverage

The check-code-coverage.sh script compiles the program with code coverage flags and generates a coverage report using llvm-profdata and llvm-cov.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •