GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Junaidk11/Data_Structures_And_Algorithm: Implementations of Data Structures and Algorithms with C/C++

BranchesTags
Open more actions menu

Latest commit

 

History

200 Commits
200 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
Array
Array
 
 
BinarySearchTree
BinarySearchTree
 
 
Graphs-Practice
Graphs-Practice
 
 
Graphs
Graphs
 
 
Linkedlist
Linkedlist
 
 
Queue_w_array
Queue_w_array
 
 
Queue_w_linkedlist
Queue_w_linkedlist
 
 
Queue_w_stack
Queue_w_stack
 
 
Queues
Queues
 
 
Recursion/TailHeadRecursion
Recursion/TailHeadRecursion
 
 
Review
Review
 
 
Sorting Algorithms
Sorting Algorithms
 
 
Stack_w_Array
Stack_w_Array
 
 
Stack_w_linkedlist
Stack_w_linkedlist
 
 
Stacks
Stacks
 
 
Strings
Strings
 
 
Trees-practice
Trees-practice
 
 
linkedlists
linkedlists
 
 
.gitattributes
.gitattributes
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Data Structures And Algorithms

A comprehensive collection of data structures and algorithms implementations in C and C++. This repository contains practical implementations with detailed documentation, test cases, and examples for learning and reference purposes.

šŸ“š Table of Contents

  • Overview
  • Data Structures
  • Algorithms
  • Project Structure
  • Getting Started
  • Usage Examples
  • Complexity Analysis
  • Contributing
  • License

🌟 Overview

This repository serves as a learning resource and reference implementation for fundamental data structures and algorithms. Each implementation includes:

  • Clean, well-documented code
  • Comprehensive test cases
  • Time and space complexity analysis
  • Practical usage examples
  • Multiple implementation approaches where applicable

šŸ—ļø Data Structures

Arrays

  • Location: Array/, Array.xcodeproj/
  • Features:
    • Static and dynamic array implementations
    • Array operations: insert, delete, search, append
    • Binary search (recursive and iterative)
    • Array manipulation: shift, rotate, reverse
    • Set operations: union, intersection, difference
    • Duplicate detection and removal
    • Missing element finding algorithms
    • Pair finding for given sum

Linked Lists

  • Location: Linkedlist/, linkedlists/
  • Implementations:
    • Singly Linked List: Basic operations, search, insertion, deletion
    • Doubly Linked List: Bidirectional traversal
    • Circular Linked List: Circular structure implementation
  • Features:
    • Recursive and iterative traversals
    • List reversal algorithms
    • Duplicate removal
    • List merging and concatenation
    • Loop detection
    • Middle node finding

Stacks

  • Location: Stacks/, Stack_w_Array/, Stack_w_linkedlist/
  • Implementations:
    • Array-based Stack: Fixed size with overflow handling
    • Linked List-based Stack: Dynamic size
    • Character Stack: Specialized for character operations
  • Operations: Push, Pop, Peek, isEmpty, Display

Queues

  • Location: Queues/, Queue_w_array/, Queue_w_linkedlist/, Queue_w_stack/
  • Implementations:
    • Array-based Queue: Linear and circular implementations
    • Linked List-based Queue: Dynamic size
    • Stack-based Queue: Implementation using two stacks
  • Features:
    • Standard queue operations (enqueue, dequeue)
    • Circular queue to optimize space usage
    • Queue implementation with stacks for educational purposes

Trees

  • Location: BinarySearchTree/, Trees-practice/
  • Implementations:
    • Binary Search Tree: Insertion, search, traversals
    • General Tree: Basic tree operations with queue-based level order
  • Features:
    • Tree traversals: Pre-order, In-order, Post-order (recursive and iterative)
    • Level-order traversal using queues
    • Tree construction and manipulation

Graphs

  • Location: Graphs/, Graphs-Practice/
  • Implementations:
    • Adjacency List: Dynamic graph representation
    • Adjacency Matrix: Fixed-size graph representation
  • Features:
    • Graph traversals: Depth-First Search (DFS), Breadth-First Search (BFS)
    • Graph construction and manipulation
    • Visited node tracking

🧮 Algorithms

Sorting Algorithms

  • Location: Sorting Algorithms/
  • Implementations:
    • Merge Sort: Recursive and iterative implementations
    • Time Complexity: O(n log n)
    • Space Complexity: O(n)
  • Features:
    • Detailed algorithm explanation with examples
    • Step-by-step visualization comments
    • Both stable implementations

Searching Algorithms

  • Linear Search: O(n) with optimization techniques
  • Binary Search: O(log n) recursive and iterative
  • Set membership: Optimized for sorted and unsorted data

Recursion

  • Location: Recursion/
  • Types:
    • Tail Recursion: Optimizable recursive calls
    • Head Recursion: Non-tail recursive implementations
  • Applications: Mathematical computations, tree traversals

String Operations

  • Location: Strings/
  • Features: String manipulation and processing algorithms

šŸ“‚ Project Structure

Data_Structures_And_Algorithm/
ā”œā”€ā”€ Array/                     # Array implementations and operations
ā”œā”€ā”€ BinarySearchTree/          # BST implementation in C++
ā”œā”€ā”€ Graphs/                    # Graph data structure and algorithms
ā”œā”€ā”€ Graphs-Practice/           # Additional graph practice problems
ā”œā”€ā”€ Linkedlist/                # Various linked list implementations
ā”œā”€ā”€ linkedlists/               # Additional linked list projects
ā”œā”€ā”€ Queue_w_array/             # Array-based queue implementations
ā”œā”€ā”€ Queue_w_linkedlist/        # Linked list-based queue
ā”œā”€ā”€ Queue_w_stack/             # Queue implementation using stacks
ā”œā”€ā”€ Queues/                    # General queue implementations
ā”œā”€ā”€ Recursion/                 # Recursion examples and types
ā”œā”€ā”€ Review/                    # Code review and practice
ā”œā”€ā”€ Sorting Algorithms/        # Sorting algorithm implementations
ā”œā”€ā”€ Stack_w_Array/             # Array-based stack
ā”œā”€ā”€ Stack_w_linkedlist/        # Linked list-based stack
ā”œā”€ā”€ Stacks/                    # General stack implementations
ā”œā”€ā”€ Strings/                   # String processing algorithms
ā”œā”€ā”€ Trees-practice/            # Tree implementations and practice
└── README.md                  # This file

šŸš€ Getting Started

Prerequisites

  • C Compiler: GCC or Clang
  • C++ Compiler: G++ or Clang++
  • IDE: Xcode (for .xcodeproj files) or any text editor
  • Operating System: macOS, Linux, or Windows

Compilation

For C files:

gcc -o program_name source_file.c
./program_name

For C++ files:

g++ -o program_name source_file.cpp
./program_name

For Xcode projects:

Open the .xcodeproj file in Xcode and build/run the project.

Running Examples

Each directory contains main files with test cases. For example:

# Array operations
cd Array/Array/
gcc -o array_demo main.c
./array_demo

# Binary Search Tree
cd BinarySearchTree/
g++ -o bst_demo binarySearchTree_main.cpp BinarySearchTree.cpp
./bst_demo

# Graph algorithms
cd Graphs-Practice/Graphs-Practice/
gcc -o graph_demo main.c
./graph_demo

šŸ’” Usage Examples

Array Operations

// Create and manipulate arrays
struct dynamicArray arr = createDynamicStruct();
dynamicArray_append(&arr, 10);
dynamicArray_insertAtIndex(&arr, 0, 5);
int index = dynamicArray_linearSearch(&arr, 10);

Binary Search Tree

// BST operations
BinarySearchTree bst;
bst.insert(50);
bst.insert(30);
bst.insert(70);
bool found = bst.searchTree(30);
bst.in_order(); // Print in sorted order

Graph Traversal

// DFS traversal
int visited[8] = {0};
DFS(1); // Start DFS from vertex 1

// BFS traversal
BFS(1); // Start BFS from vertex 1

⚔ Complexity Analysis

Time Complexities

Data Structure Operation Average Case Worst Case
Array Access O(1) O(1)
Array Search O(n) O(n)
Array Insertion O(n) O(n)
Array Deletion O(n) O(n)
Linked List Access O(n) O(n)
Linked List Search O(n) O(n)
Linked List Insertion O(1) O(1)
Linked List Deletion O(1) O(1)
Stack Push/Pop O(1) O(1)
Queue Enqueue/Dequeue O(1) O(1)
BST Search/Insert/Delete O(log n) O(n)

Algorithm Complexities

Algorithm Time Complexity Space Complexity
Linear Search O(n) O(1)
Binary Search O(log n) O(1)
Merge Sort O(n log n) O(n)
DFS/BFS O(V + E) O(V)

šŸŽÆ Key Features

Educational Focus

  • Detailed Comments: Every implementation includes comprehensive explanations
  • Multiple Approaches: Different implementation strategies for the same concept
  • Test Cases: Extensive testing with various scenarios
  • Performance Analysis: Time and space complexity discussions

Advanced Topics

  • Optimization Techniques: Improved search algorithms with transposition
  • Edge Case Handling: Comprehensive coverage of boundary conditions
  • Alternative Implementations: Multiple ways to solve the same problem
  • Real-World Applications: Practical use cases and examples

šŸ› ļø Development Environment

This project was developed and tested on:

  • macOS: Primary development environment
  • Xcode: IDE with project files included
  • GCC/Clang: Command-line compilation
  • Language Standards: C99/C11 and C++11/C++14

šŸ“„ License

This project is open source and available under the MIT License.

About

Implementations of Data Structures and Algorithms with C/C++

Topics

binary-search-treedata-structureslinkedlistqueuesstackstree-structure

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.