Skip to content

A collection of implementations of commonly used data structures in C.

License

Notifications You must be signed in to change notification settings

JeepWay/data-structures-in-C

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Structures in C

License Language

This repository contains implementations of various data structures in C, based on the concepts and examples presented in the book "Fundamentals of Data Structures in C" by Ellis Horowitz, Sartaj Sahni, and Susan Anderson-Freed.

Each data structure is implemented in a separate directory, with a main.c file that demonstrates the usage of the data structure. For example, the stack of general data type using arrays is in the stack/general_stack directory, with the main.c file demonstrating the usage of the stack.

The Makefile in the root directory can be used to compile and run the demo programs for each data structure according to the TARGET specified, you can find them in the usage section below.

Table of Contents

Makefile Usage

Stacks

  • Stack of general data type 📃
    make test TARGET=general_stack
  • Stack of integer data type 📃
    make test TARGET=int_stack

Queues

  • Queue of general data type using arrays with N-1 slots 📃
    make test TARGET=general_circular_array_n-1_slot_queue
  • Queue of general data type using arrays with N slots 📃
    make test TARGET=general_circular_array_n_slot_queue
  • Circular of general data type using single linked list 📃
    make test TARGET=general_single_list_queue

Linked Lists

  • Singly linked list of general data type 📃
    make test TARGET=general_single_linked_list
  • Singly linked list of integer data type 📃
    make test TARGET=int_single_linked_list
  • Doubly linked list of general data type 📃
    make test TARGET=general_double_linked_list
  • Doubly linked list of integer data type 📃
    make test TARGET=int_double_linked_list

Trees

  • Binary tree 📃
    make test TARGET=binary_tree
  • Binary search tree 📃
    make test TARGET=binary_search_tree

Sets

  • Disjoint sets 📃
    make test TARGET=disjoint_set

Graphs

  • BFS 📃
    make test TARGET=graph_bfs
  • DFS 📃
    make test TARGET=graph_dfs
  • Kruskal's Minimum Spanning Tree 📃
    make test TARGET=Kruskal_mst

Hashing

  • Hash table using linked list 📃
    make test TARGET=hashtable_list
  • Hash table using arrays 📃
    make test TARGET=hashtable_array
    • If collision occurs during insertion, the key is inserted into the next available slot according to linear probing.

Heap Structures

  • Min heap of general data type 📃
    make test TARGET=general_min_heap
  • Min heap of integer data type 📃
    make test TARGET=int_min_heap
  • Max heap of integer data type 📃
    make test TARGET=int_max_heap
  • Min-max heap of general data type 📃
    make test TARGET=general_min_max_heap
  • Deap of general data type 📃
    make test TARGET=general_deap
  • Min leftist tree of general data type 📃
    make test TARGET=general_min_leftist_tree
  • Binomial heap 📃
    make test TARGET=binomial_heap
  • Fibonacci heap 📃
    make test TARGET=fibonacci_heap

Clean up object and executable files

make clean

Acknowledgments

Inspired by and references from:

About

A collection of implementations of commonly used data structures in C.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published