/algorithm-data-structure-exercises

This repo stores notes for problems related to algorithms and data structures

Primary LanguagePython

Algorithms and Data Structures Exercises

Welcome to the Algorithms and Data Structures Exercises repository! This repository is designed to help you practice and master various algorithms and data structures through hands-on coding exercises.

Table of Contents

Introduction

This repository contains a collection of algorithm and data structure exercises that are essential for anyone looking to improve their problem-solving skills and prepare for technical interviews. Each exercise is designed to help you understand the fundamental concepts and apply them to solve real-world problems.

Getting Started

To get started with the exercises, you will need to clone this repository to your local machine. You can do this using the following command:

git clone https://github.com/wcy41gtc/algorithm-data-structure-exercises.git

Navigate to the cloned repository:

cd algorithms-data-structures-exercises

Each exercise is contained within its respective folder, along with a README file explaining the problem statement and any additional information you might need to solve the exercise.

Folder Structure

The repository is organized as follows:

algorithms-data-structures-exercises/
│
├── array/
│   ├── exercise1/
│   └── ...
│
├── linked_list/
│   ├── exercise1/
│   └── ...
│
├── stack/
│   ├── exercise1/
│   └── ...
│
├── queue/
│   ├── exercise1/
│   └── ...
│
├── tree/
│   ├── exercise1/
│   └── ...
│
├── graph/
│   ├── exercise1/
│   └── ...
│
├── hash_maps/
│   ├── exercise1/
│   └── ...
│
├── sorting_algorithms/
│   ├── exercise1/
│   └── ...
│
├── search_algorithms/
│   ├── exercise1/
│   └── ...
│
├── projects/
│   ├── exercise1/
│   └── ...
│
└── README.md

Each folder contains exercises related to a specific data structure or algorithm. Inside each exercise folder, you will find:

  • README.md: Detailed problem statement and instructions.
  • solution.py: Placeholder for your solution (in Python).
  • test.py: Test cases to verify your solution.

Exercises

Array

Practice problems related to arrays, such as finding the maximum subarray, rotating an array, and more.

Linked List

Exercises on linked lists, including reversing a linked list, detecting cycles, and merging two sorted linked lists.

Stack

Problems involving stack operations like evaluating expressions, checking for balanced parentheses, and implementing a stack using queues.

Queue

Queue-related exercises such as implementing a circular queue, using two stacks to create a queue, and solving the "Josephus problem".

Tree

Exercises on binary trees, binary search trees, AVL trees, and more. Problems include traversals, finding the height of a tree, and converting a tree to a doubly linked list.

Graph

Graph-related problems including depth-first search (DFS), breadth-first search (BFS), detecting cycles, and finding the shortest path.

Hash Map

Exercises involving hash maps, such as implementing a hash map, designing an LRU cache, and solving problems like two-sum and group anagrams.

Sorting Algorithms

Practice implementing various sorting algorithms like quicksort, mergesort, bubblesort, and understanding their time complexities.

Search Algorithms

Exercises on searching algorithms, including binary search, linear search, and searching in a rotated sorted array.

Projects

Small standalone projects for real world applications.

Contributing

We welcome contributions from the community! If you have an exercise you would like to add or an improvement to an existing one, please fork the repository and create a pull request. Make sure to follow the guidelines in the CONTRIBUTING.md file.

License

This repository is licensed under the MIT License. See the LICENSE file for more information.

Happy coding!