Skip to content

A collection of common interview algorithms implemented in C# with detailed explanations and an interactive demo.

Notifications You must be signed in to change notification settings

beheshty/Interview-Algo-Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interview Algorithm Lab 🧪

Welcome to the Interview Algorithm Lab! This repository is a focused collection of classic computer science algorithms, implemented in C#. It's designed to be a practical resource for interview preparation, learning, and practice.

Whether you're brushing up for a technical interview, studying data structures and algorithms, or just curious, this lab provides clear, well-documented, and easy-to-understand implementations.

✨ Features

  • Clear Implementations: Each algorithm is implemented in C# with a focus on readability and correctness.
  • Detailed Explanations: Every algorithm includes a README.md file that explains its logic, time/space complexity, and a real-world analogy.
  • Interactive Demo: A console application is included to run each algorithm and see it in action, step-by-step.

📚 Algorithms & Data Structures Included

This repository contains a collection of fundamental searching algorithms, sorting algorithms, and data structures.

🔍 Searching Algorithms

  • Binary Search: An efficient algorithm for finding an item from a sorted list of items.
  • Linear Search: A simple method that sequentially checks each element of a list until a match is found or the whole list has been searched.

🧩 Sorting Algorithms

  • Bubble Sort: A straightforward sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
  • Insertion Sort: A simple sorting algorithm that builds the final sorted array one item at a time.
  • Merge Sort: A highly efficient, stable, comparison-based sorting algorithm using a divide and conquer strategy.
  • Quick Sort: An efficient, in-place sorting algorithm that uses a divide and conquer approach. It is often faster in practice than other $O(n \log n)$ algorithms.

🏗️ Data Structures

  • HashTable: A data structure that maps keys to values for highly efficient lookup, implementing an associative array.
  • LinkedList: A linear collection of data elements where each element points to the next, allowing for efficient insertions and deletions.
  • Queue: A linear structure which follows a First-In-First-Out (FIFO) order.
  • Stack: A linear structure which follows a Last-In-First-Out (LIFO) order.

🚀 Interactive Demo Application

The Algorithms.Demo project makes it easy to visualize and understand how these algorithms work.

How it Works

The console application provides a simple menu to:

  1. Choose an algorithm to execute (e.g., Bubble Sort, Binary Search).
  2. Select your input:
    • Enter a comma-separated list of numbers.
    • Generate a random array of a specified size.
  3. See the output: The application will print the step-by-step execution of the chosen algorithm, showing comparisons, swaps, and the state of the array at each stage.

Getting Started

To get started with this repository:

  1. Clone the repository:
    git clone https://github.com/beheshty/interview-algo-lab.git
    
  2. Open in Visual Studio: Open the Interview-Algo-Lab.sln solution file.
  3. Explore the code: Navigate through the Algorithms directory to see the implementations and read the detailed README.md files for each algorithm.

Contributing

Contributions are welcome! If you'd like to add more algorithms, improve existing ones, or enhance the demo application, please feel free to fork the repository and submit a pull request.

About

A collection of common interview algorithms implemented in C# with detailed explanations and an interactive demo.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages