This project implements common data structures and algorithms based on the Computer Science Professional Foundation Exam syllabus using pure C language.
Header files containing data structure declarations.
seq_list.h- Sequential list (array-based implementation)link_list.h- Singly linked listdouble_link_list.h- Doubly linked listmulti_array.h- Multi-dimensional arraysparse_matrix.h- Sparse matrix (Triplet and Cross List)special_matrix.h- Special matrices (Symmetric, Triangular, Tridiagonal)
seq_stack.h- Sequential stacklink_stack.h- Linked stackseq_queue.h- Sequential queue (circular buffer)link_queue.h- Linked queuestack_applications.h- Stack applications (bracket matching, expression evaluation)
binary_tree.h- Binary tree with traversal operationsdisjoint_set.h- Disjoint set (Union-Find)heap.h- Max heap and Min heaphuffman_tree.h- Huffman tree with encoding
matrix_graph.h- Graph using adjacency matrixadj_list_graph.h- Graph using adjacency listmultilist_graph.h- Adjacency multilist graphorthogonal_list_graph.h- Orthogonal list (cross list) graph
sequential_search.h- Sequential searchblock_search.h- Block searchbinary_search_tree.h- Binary search tree (BST)avl_tree.h- AVL tree (self-balancing BST)red_black_tree.h- Red-Black treeb_tree.h- B treeb_plus_tree.h- B+ treehash_table.h- Hash tablekmp.h- KMP string pattern matching
insert_sort.h- Insertion sort and binary insertion sortbubble_sort.h- Bubble sortselection_sort.h- Selection sortshell_sort.h- Shell sortquick_sort.h- Quick sortheap_sort.h- Heap sortmerge_sort.h- Merge sortradix_sort.h- Radix sortexternal_sort.h- External sort
Source files containing implementations of all data structures and algorithms.
seq_list.c- Sequential list with insert, delete, searchlink_list.c- Singly linked listdouble_link_list.c- Doubly linked listmulti_array.c- Multi-dimensional array operationssparse_matrix.c- Sparse matrix (Triplet and Cross List)special_matrix.c- Special matrices compression storage
seq_stack.c- Sequential stack (push, pop, getTop)link_stack.c- Linked stackseq_queue.c- Circular queuelink_queue.c- Linked queuestack_applications.c- Stack applications:- Bracket matching
- Infix to postfix conversion
- Postfix expression evaluation
- Factorial simulation with stack
- Fibonacci simulation with stack
- Tower of Hanoi
binary_tree.c- Binary tree with:- Preorder, Inorder, Postorder, Level-order traversals
- Tree depth, node count, leaf count
- Threaded binary tree
disjoint_set.c- Union-Find operationsheap.c- Max heap and Min heap with insert, delete, heapifyhuffman_tree.c- Huffman tree construction and encoding
matrix_graph.c- Adjacency matrix graph with:- DFS and BFS traversals
- Prim's and Kruskal's MST algorithms
- Dijkstra's shortest path
- Floyd-Warshall all-pairs shortest paths
- Topological sort
- Critical path (AOE network)
adj_list_graph.c- Adjacency list graph with DFS and BFSmultilist_graph.c- Adjacency multilist for undirected graphsorthogonal_list_graph.c- Orthogonal list for directed graphs
sequential_search.c- Sequential search with count and sentinelblock_search.c- Block search with optional binary searchbinary_search_tree.c- BST with insert, search, deleteavl_tree.c- AVL tree with rotationsred_black_tree.c- Red-Black treeb_tree.c- B tree operationsb_plus_tree.c- B+ tree operationshash_table.h- Hash table with linear probingkmp.c- KMP and improved KMP (nextval), brute force
All sorting algorithms with 0-based array indexing:
insert_sort.c- Insertion sort and binary insertion sortbubble_sort.c- Bubble sort with optimizationselection_sort.c- Selection sortshell_sort.c- Shell sortquick_sort.c- Quick sort with partitionheap_sort.c- Heap sortmerge_sort.c- Merge sort (divide and conquer)radix_sort.c- Radix sort for non-negative integersexternal_sort.c- External sort for large files
Test programs for each data structure module.
test_seq_list.c- Sequential list operationstest_link_list.c- Linked list operationstest_multi_array.c- Multi-dimensional arraytest_sparse_matrix.c- Sparse matrix (Triplet and Cross List)test_special_matrix.c- Special matrix compression
test_stack.c- Stack operationstest_queue.c- Queue operationstest_stack_applications.c- Stack applications
test_binary_tree.c- Binary tree traversalstest_heap.c- Heap operationstest_huffman_tree.c- Huffman coding
test_matrix_graph.c- Matrix graph operationstest_adj_list_graph.c- Adjacency list graphtest_multilist_graph.c- Multilist graphtest_orthogonal_list_graph.c- Orthogonal list graph
test_sequential_search.c- Sequential searchtest_block_search.c- Block searchtest_bst.c- Binary search treetest_avl.c- AVL treetest_red_black_tree.c- Red-Black treetest_b_tree.c- B treetest_b_plus_tree.c- B+ treetest_hash.c- Hash tabletest_kmp.c- KMP string matching
test_sort.c- All sorting algorithmstest_external_sort.c- External sorting
build_all.batquick_test.bat# Linear list
gcc -I. -o test_seq_list.exe src/linear_list/seq_list.c tests/linear_list/test_seq_list.c
test_seq_list.exe
# Sort algorithms
gcc -I. -o test_sort.exe src/sort/*.c tests/sort/test_sort.c
test_sort.exe