Skip to content
harshu-belalPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

TCS302 – Data Structures with C

Unit-wise C Programs

All programs are written in standard C (C99) and have been compiled and tested with gcc.

Folder Structure

TCS302_Codes/
├── Unit1_Arrays_Stacks_Recursion/
│   ├── array_operations.c        - Insert, delete, traverse, linear search on arrays
│   ├── stack_array.c             - Stack using array (push, pop, peek)
│   ├── stack_linkedlist.c        - Stack using linked list
│   ├── infix_to_postfix.c        - Infix to postfix conversion using stack
│   ├── postfix_evaluation.c      - Evaluate a postfix expression using stack
│   └── tower_of_hanoi.c          - Tower of Hanoi using recursion
│
├── Unit2_Queues_LinkedLists/
│   ├── queue_array.c             - Simple queue using array
│   ├── circular_queue.c          - Circular queue implementation
│   ├── dequeue.c                 - Double-ended queue (insert/delete both ends)
│   ├── singly_linked_list.c      - Insert, delete, search, traverse
│   ├── doubly_linked_list.c      - Insert, delete, forward/backward traversal
│   └── polynomial_addition.c     - Polynomial representation & addition using linked list
│
├── Unit3_Trees_Searching_Hashing/
│   ├── binary_tree_traversal.c   - Inorder, preorder, postorder traversal
│   ├── huffman_coding.c          - Huffman tree & code generation
│   ├── linear_binary_search.c    - Linear search vs binary search
│   └── hashing_chaining.c        - Hash table with chaining for collisions
│
├── Unit4_Sorting_BST/
│   ├── sorting_algorithms.c      - Insertion, bubble, quick, merge, heap sort
│   ├── bst_operations.c          - BST insert, delete (all 3 cases), search
│   └── avl_tree.c                - Self-balancing AVL tree with rotations
│
└── Unit5_Files_Graphs/
    ├── graph_bfs_dfs.c           - BFS and DFS traversal (adjacency matrix)
    ├── bipartite_check.c         - Check if a graph is bipartite (2-coloring)
    ├── union_find.c              - Disjoint set with path compression & union by rank
    ├── kruskal_mst.c             - Kruskal's algorithm for MST
    └── prim_mst.c                - Prim's algorithm for MST

How to Compile & Run

For any file:

gcc filename.c -o output -lm
./output

(-lm links the math library, needed only for postfix_evaluation.c which uses pow().)

Some programs (infix_to_postfix.c, postfix_evaluation.c, tower_of_hanoi.c) take input from the user via scanf — run them interactively in a terminal.

Notes

  • Programs use simple struct-based implementations matching what's typically expected in a first-year Data Structures course.
  • Sample data is hardcoded in main() for demonstration — feel free to modify values or add scanf inputs for practice.
  • Paired with the theory notes (TCS302_Notes.md) for exam prep — each file maps directly to a syllabus topic.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages