My implementations of Data Structures in C - written as I learn, not after. Each file reflects what I understood when I wrote it.
Most files are straightforward implementations. Some may follow different approaches where I was figuring out why one is cleaner than the other - dummy node vs special-casing head, pointer-to-pointer traversal vs index walking, iterative vs recursive.
Code style is consistent throughout using .clang-format with the LLVM standard.
- Pointers
- Structures
- Dynamic Memory Allocation
- Linked List
- Stacks
- Extra
- Problems
- Language and Style
- Legal
- License
- About
| File | Description |
|---|---|
pointer.c |
Pointer basics - declaration, dereferencing, address-of |
pointer_arithmetics.c |
Arithmetic on pointers - increment, decrement, offset |
call_by_value.c |
Passing by value - local copy, no effect on original |
call_by_reference.c |
Passing by pointer - modifying the original variable |
array_elements_pointer.c |
Accessing array elements via pointer |
array_of_pointers.c |
Array where each element is a pointer |
double_pointer.c |
Pointer to pointer - **ptr |
| File | Description |
|---|---|
structure_variables.c |
Struct declaration, initialization, and member access |
structures_functions.c |
Passing structs to functions - by value and by pointer |
selfref_structure.c |
Self-referential struct - a struct with a pointer to itself, the basis of linked lists |
| File | Description |
|---|---|
malloc.c |
malloc - allocates uninitialized memory |
calloc.c |
calloc - allocates zero-initialized memory |
realloc.c |
realloc - resizes an existing allocation, preserving data |
| File | Description |
|---|---|
linked_list.c |
Node structure, traversal, and print |
insert_at_beg.c |
Insert at head |
insert_at_end.c |
Insert at tail |
insert_at_pos.c |
Insert at given 1-based position |
delete_head.c |
Delete head node |
delete_last.c |
Delete tail node |
delete_at_pos.c |
Delete at given 1-based position |
| File | Description |
|---|---|
stack_using_array.c |
Stack implementation using array - push, pop, peek, isEmpty, isFull |
stack_using_linkedlist.c |
Stack implementation using linked list - dynamic push/pop operations |
Advanced algorithms and applications using the implemented data structures.
| File | Topic | Description |
|---|---|---|
reverse_list.c |
Linked List | Iterative three pointer reversal |
length_of_list.c |
Linked List | Length of a linked list |
floyd_cycle_detection.c |
Linked List | Cycle detection - Floyd's tortoise and hare |
middle_node.c |
Linked List | Find middle node using slow/fast pointers |
Problems from external platforms, organised by source. Only solution code is stored - no problem statements or sample data.
| Platform | Directory | Naming |
|---|---|---|
| LeetCode | Problems/LeetCode/ |
lc_XXXX_problem_name.c |
| GeeksForGeeks | Problems/GeeksForGeeks/ |
gfg_problem_name.c |
See PROBLEMS.md for the full list with approaches and links.
- Language: C
- LLVM code style via
.clang-format - Compiled with Clang
- Some files have multiple solutions showing how the approach changed as I understood the problem better
Problem statements on competitive programming platforms are copyrighted by their respective authors and platforms. This repository:
- Does not include problem descriptions
- Does not include sample inputs or outputs
- Stores only original solution code
Problem links may be included for external reference without reproducing any platform content.
MIT - free to use, study, and modify. See LICENSE for details.
I'm 18, studying CS, interested in DSA, competitive programming, and machine learning. I try to actually understand what I'm writing rather than just getting it to work - this repo is where that process is visible.
Made with 💙 by Tamil Selvan