Skip to content

A collection of data structure implementations from the CSE220 (Data Structures) course at BRAC University, Fall 2023 semester.

License

Notifications You must be signed in to change notification settings

777-flyer/Data-Structures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSE220 - Data Structures Course (Fall 2023)

License: MIT Python NumPy Jupyter Course

A comprehensive collection of data structure implementations from the CSE220 (Data Structures) course at BRAC University, Fall 2023 semester.

Course Overview

This repository contains implementations of fundamental data structures covered in CSE220, including:

  • Arrays & Array Operations: Multi-dimensional arrays, matrix operations, pattern generation
  • Linked Lists: Singly linked lists, operations, and manipulations
  • Doubly Linked Lists: Circular doubly linked lists, patient management system
  • Stacks: Array-based and linked-list implementations, parenthesis balancing
  • Queues: Standard and priority queue implementations
  • Recursion: Various recursive algorithms and problem-solving techniques
  • Hash Tables: Hash functions, collision handling, layered hashing
  • Binary Trees: BST operations, traversals, tree algorithms

Repository Structure

CSE220-Data-Structures/
├── Lab01/                 # Arrays and numpy operations
├── Lab02/                 # Multi-dimensional arrays
├── Lab03/                 # Singly linked lists
├── Lab04/                 # Circular doubly linked lists
├── Lab05/                 # Recursion fundamentals
├── Lab06/                 # Stack implementations
├── Lab07/                 # Hash tables and hashing
├── Lab08/                 # Binary trees and BST
├── LICENSE
└── README.md

Each lab folder contains:

  • Jupyter Notebook (.ipynb) with complete implementations
  • Lab-specific README with problem descriptions
  • Test cases and driver code

Prerequisites

  • Python 3.8 or higher
  • Jupyter Notebook or JupyterLab
  • NumPy library
  • fhm-unittest (for testing)
  • fuzzywuzzy (for output validation)

Installation

  1. Clone the repository:
git clone https://github.com/777-flyer/Data-Structures.git
cd Data-Structures
  1. Install required packages:
pip install numpy jupyter fhm-unittest fuzzywuzzy
  1. Launch Jupyter Notebook:
jupyter notebook
  1. Navigate to any lab folder and open the notebook.

Lab Contents

Lab 01: Array Operations & NumPy Basics

  • Play Right (array rotation)
  • Discard Cards (element removal)
  • Merge Lineup (array merging with None handling)
  • Balance Salami (equilibrium point)
  • Protect Salami (duplicate frequency check)
  • Bonus: Odd-Even Wave pattern

Key Concepts: Array manipulation, iteration, boundary conditions


Lab 02: Multi-Dimensional Arrays

  • Zigzag Walk (2D array traversal)
  • Wall Up Trost District (matrix padding)
  • Crows vs Cats (matrix pair operations)
  • ATM's Triangle (Pascal-like triangle generation)
  • Trace The BOT (grid navigation)

Key Concepts: 2D arrays, matrix operations, pattern generation, coordinate systems


Lab 03: Singly Linked Lists

  • Number Beads (rotation detection)
  • Building Blocks (list comparison)
  • Remove Compartment (node deletion)
  • Capture the Flag (divisibility pattern)
  • Shuffle on Song (even-odd ASCII reordering)
  • Bonus: Assemble Conga Line, Remove from Last

Key Concepts: Linked list traversal, node manipulation, insertion, deletion


Lab 04: Doubly Linked Lists & Applications

  • Waiting Room Management System (WRM)
    • Patient registration with serial numbers
    • Serve patients (FIFO)
    • Cancel all appointments
    • Check if doctor can leave
    • Show all patients
    • Reverse the line

Key Concepts: Circular doubly linked lists, dummy nodes, queue-like operations


Lab 05: Recursion

  • Very Easy: Recursive sum, nCr calculation, digit counting, prime checking
  • Easy: Decimal to hexadecimal conversion, linked list comparison, vowel-consonant printing
  • Medium: House of Cards builder, maximum element finder
  • Hard: Number patterns (triangular and exponential)
  • Very Hard: Flatten nested lists

Key Concepts: Base cases, recursive calls, divide and conquer, backtracking


Lab 06: Stacks

  • Stack implementation (push, pop, peek, isEmpty)
  • Parenthesis balancing (brackets validation)
  • Diamond count (matching pairs)
  • Bonus: Tower of God (remove n-th block)

Key Concepts: LIFO operations, stack-based algorithms, expression validation


Lab 07: Hash Tables

  • Nerdy Run (duplicate detection within distance k)
  • Hash table with chaining (custom hash function)
  • Layered hashtable (express lane optimization)

Key Concepts: Hash functions, collision resolution, chaining, layered data structures


Lab 08: Binary Trees

  • Convert to mirror tree (tree reflection)
  • Smallest value per level (level-order processing)
  • Inorder predecessor in BST
  • Lowest Common Ancestor (LCA) in BST
  • Bonus: Sum tree validation, odd-even level difference

Key Concepts: Tree traversals, BST properties, ancestor finding, tree validation


Key Data Structures Implemented

Data Structure Lab Operations Time Complexity
Arrays 01, 02 Access, Insert, Delete O(1), O(n), O(n)
Singly Linked List 03 Insert, Delete, Search O(1), O(n), O(n)
Doubly Linked List 04 Insert, Delete, Reverse O(1), O(n), O(n)
Stack 06 Push, Pop, Peek O(1), O(1), O(1)
Hash Table 07 Insert, Search, Delete O(1) avg, O(n) worst
Binary Tree 08 Insert, Search, Traverse O(log n) avg BST

Learning Outcomes

  • Implementing fundamental data structures from scratch
  • Understanding time and space complexity trade-offs
  • Working with pointers and references
  • Solving real-world problems with appropriate data structures
  • Writing clean, modular, and well-documented code
  • Testing and validating implementations
  • Recursion and iterative problem-solving techniques

Running Tests

Each notebook includes test cases using the fhm-unittest framework:

import fhm_unittest as unittest

returned_value = your_function(parameters)
unittest.output_test(returned_value, expected_value)

Look for "Accepted" output to verify correctness.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

While this is primarily an educational repository, suggestions for improvements are welcome:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit your changes (git commit -am 'Add improvement')
  4. Push to the branch (git push origin feature/improvement)
  5. Open a Pull Request

Contact

For questions or discussions about the implementations:

  • Create an issue in this repository
  • Connect via LinkedIn

Acknowledgments

  • Institution: BRAC University
  • Course: CSE220 - Data Structures
  • Semester: Fall 2023

Faculty Acknowledgment

I would like to sincerely thank the course faculty for their guidance and support throughout the semester:

  • Mr. Zaber Mohammad
    Lecturer, Department of Computer Science and Engineering
    BRAC University

  • Priata Nowshin
    Lecturer, Department of Computer Science and Engineering
    BRAC University

  • Nazia Afreen
    Lecturer, Department of Computer Science and Engineering
    BRAC University

⚠️ Academic Integrity

This repository is shared publicly for learning and reference purposes. While you're welcome to study the implementations and understand the concepts, please do not copy code directly for your coursework or assignments.

Academic integrity matters. Use this as a learning resource to build your own understanding, not as a shortcut. Your future self (and your professor) will thank you.


Note: This repository represents coursework completed in Fall 2023. Jupyter notebooks are included for interactive exploration and learning. Problem statements are proprietary to BRAC University and are not included to respect copyright.

Happy Coding!

About

A collection of data structure implementations from the CSE220 (Data Structures) course at BRAC University, Fall 2023 semester.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published