Skip to content

This repository provides a custom C library featuring data structures like linked lists, stacks, queues, hash tables, trees, and graphs, along with sorting algorithms and a dynamic string utility. It aims to offer efficient and flexible tools for C projects. Here is the link to the documentation where you can learn how it works.

Notifications You must be signed in to change notification settings

Gagan2004bansal/CDS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDS-Library

C Data Structures Library is a comprehensive library for C, offering a collection of data structures, algorithms, and utilities. It simplifies the use of essential data structures, sorting algorithms, and string manipulations, allowing you to focus on developing your application.

Key Features

  • Prebuilt Data Structures: Includes major data structures such as Linked Lists, Stacks, Queues etc.
  • Algorithms: Implements a range of sorting and searching algorithms like Bubble Sort, Merge Sort, Quick Sort, Linear Search, and many more.
  • Custom String Utilities: Provides a custom String type with dynamic resizing and various utility functions similar to std::string in C++.
  • Custom Functions: Each data structure and algorithm comes with a set of commonly used operations (e.g., insert, delete, search, traverse) tailored for ease of use.
  • Header-Only Access: Include the relevant header files in your project to start using the data structures, algorithms, and utilities without additional setup.

Supported Components

Data Structures

  • String
    • String create();
    • void freeS(String *str);
    • void appendS(String *str, const char* suffix);
    • size_t lenghtS(const String *str);
    • const char* getS(const String *str);
    • void readS(String *str);
    • bool isemptyS(const String* str);
    • void rep_substring(String *str, const char *old_sub, const char *new_sub);
    • void reverseS(String *str);
  • Linked List
    • Node* CreateList(int data);
    • void InsertAtHead(Node** head, int data);
    • void InsertAtTail(Node** head, int data);
    • void InsertAtPosition(Node** head, int data, int position);
    • void DeleteByValue(Node** head, int data);
    • void DeleteAtPosition(Node** head, int position);
    • void DeleteList(Node** head);
    • void PrintList(Node* head);
    • int SearchList(Node* head, int data);
    • int LengthList(Node* head);
    • void SortList(Node** head);
  • Generic Stack
    • Stack *stackCreate(size_t element_size);
    • void stackDelete(Stack *stack);
    • bool stackPush(Stack *stack, const void *element);
    • bool stackPop(Stack *stack);
    • bool stackPeek(const Stack *stack, void *element);
    • bool stackIsEmpty(const Stack *stack);
  • Generic Queue
    • Queue *queueCreate(size_t element_size);
    • void queueDelete(Queue *queue);
    • bool queueEnqueue(Queue *queue, const void *element);
    • bool queueDequeue(Queue *queue);
    • bool queuePeek(const Queue *queue, void *element);
    • bool queueIsEmpty(const Queue *queue);

Searching Algorithms

  • Linear Search
  • Binary Search

Sorting Algorithms

  • Bubble Sort
  • Insertion Sort
  • Selection Sort
  • Merge Sort
  • Quick Sort

Usage

  • Include the necessary header files in your C code.
  • Initialize and use the data structures and algorithms as needed.
  • Refer to the documentation in the code comments for detailed usage instructions.

About

This repository provides a custom C library featuring data structures like linked lists, stacks, queues, hash tables, trees, and graphs, along with sorting algorithms and a dynamic string utility. It aims to offer efficient and flexible tools for C projects. Here is the link to the documentation where you can learn how it works.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages