Skip to content

This repository contains my implementations and studies of various data structures and algorithms using Swift, organized in Xcode Playgrounds.

Notifications You must be signed in to change notification settings

ramonfsk/data-structures-and-algorithms-swift

Repository files navigation

DSA in Swift

Welcome to my Data Structures and Algorithms (DSA) studies repository! This repository contains my implementations and studies of various data structures and algorithms using Swift, organized in Xcode Playgrounds.

Table of Contents

About

This repository is a collection of my implementations and experiments with various data structures and algorithms in Swift. It is organized using Xcode Playgrounds, making it interactive and easy to test and modify.

Data Structures

The following data structures are implemented in this repository:

  • Arrays
  • Linked Lists
  • Stacks
  • Queues
  • Trees
  • Graphs
  • Hash Tables
  • Heaps

Algorithms

The following algorithms are implemented in this repository:

Sorting Algorithms

  • Bubble Sort
  • Insertion Sort
  • Selection Sort
  • Merge Sort
  • Quick Sort

Searching Algorithms

  • Linear Search
  • Binary Search
  • Graph Algorithms:
  • Depth-First Search (DFS)
  • Breadth-First Search (BFS)

Dynamic Programming

  • Fibonacci Sequence
  • Longest Common Subsequence
  • Other Algorithms:
  • Dijkstra's Shortest Path
  • Knuth-Morris-Pratt (KMP) String Matching

Examples

Here are some example usages of the data structures and algorithms:

// Example of Binary Search
let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
if let index = binarySearch(array, target: 5) {
    print("Element found at index \(index)")
} else {
    print("Element not found")
}

// Example of Merge Sort
let unsortedArray = [3, 6, 1, 8, 4, 5]
let sortedArray = mergeSort(unsortedArray)
print("Sorted Array: \(sortedArray)")

Contributing

Contributions are welcome! If you have any improvements, bug fixes, or new algorithms and data structures to add, feel free to open a pull request.

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

Contact

If you have any questions or suggestions, feel free to contact me:

Thank you for visiting my DSA studies repository!

About

This repository contains my implementations and studies of various data structures and algorithms using Swift, organized in Xcode Playgrounds.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages