{"id":22999379,"url":"https://github.com/waynewbishop/bishop-algorithms-swift-package","last_synced_at":"2025-08-14T00:32:45.608Z","repository":{"id":235276792,"uuid":"277039605","full_name":"waynewbishop/bishop-algorithms-swift-package","owner":"waynewbishop","description":"Examples of commonly used algorithms and data structures in Swift Package format. ","archived":false,"fork":false,"pushed_at":"2024-10-04T22:04:19.000Z","size":205,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-01T20:37:30.098Z","etag":null,"topics":["algorithms","data-structures","ios-sdk","swift","swift-package","swift-package-manager","xcode","xctest"],"latest_commit_sha":null,"homepage":"http://www.waynewbishop.com","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waynewbishop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-04T04:41:20.000Z","updated_at":"2024-10-04T22:52:58.000Z","dependencies_parsed_at":"2024-11-01T20:37:36.300Z","dependency_job_id":"9e0ee86e-53ec-4982-a756-995d9a3a9490","html_url":"https://github.com/waynewbishop/bishop-algorithms-swift-package","commit_stats":null,"previous_names":["waynewbishop/structures","waynewbishop/swift-structures","waynewbishop/bishop-algorithms-swift-package"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynewbishop%2Fbishop-algorithms-swift-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynewbishop%2Fbishop-algorithms-swift-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynewbishop%2Fbishop-algorithms-swift-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waynewbishop%2Fbishop-algorithms-swift-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waynewbishop","download_url":"https://codeload.github.com/waynewbishop/bishop-algorithms-swift-package/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229786958,"owners_count":18124014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","data-structures","ios-sdk","swift","swift-package","swift-package-manager","xcode","xctest"],"created_at":"2024-12-15T06:16:33.191Z","updated_at":"2024-12-15T06:16:33.728Z","avatar_url":"https://github.com/waynewbishop.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"Swift Structures Package\n====================\n\nThis project provides a framework for commonly used data structures and algorithms written in Swift. While details of many algorithms exist on Wikipedia, these implementations are often written as pseudocode or are expressed in C or C++. This code project, along with my [Github book](https://github.com/waynewbishop/bishop-algorithms-book), provides theory, instruction and guidance on many commonly used models. These educational designs can help you pass your next technical interview or build your next app.\n\n\nAudience\n---------------------\n\nTo best utilize this project, you should already be familiar with the basics of programming. Beyond algorithms, this code also aims to provide an alternative for learning the basics of Swift. Code examples include many Swift-specific features such as optionals, extensions, protocols and generics. Beyond Swift, audiences should be familiar with **Singleton** and **Factory** design patterns along with sets, arrays and dictionaries.\n\n\nPackage Benefits\n---------------------\n\nThe project is an Xcode package project which brings added benefits and flexibility. The source, along with its 90+ unit tests can be opened and executed as a standalone project or included as a project dependency. Since Swift packages support all Apple platforms, **Structures** can be used in any iOS, WatchOS, MacOS, or TvOS application. Quick help documentation has also been made available for the many custom types and implementations.\n\n\n```swift\nimport Structures\n\n //create a new stack\n let stack = Stack\u003cInt\u003e()\n\n //push items\n stack.push(8)\n stack.push(10)\n stack.push(2)\n stack.push(9)\n stack.push(20)\n\n if let item = stack.peek() {\n    print(\"top level item is: \\(String(describing: item))\") //prints 20\n }\n\n //remove item from structure\n stack.pop()\n```\n\nStyle Guide\n---------------------\n\nIn addition to the over **90 included** unit tests, this project also contains a sample **Swift Playground** to demonstrate how one can use the custom types. Executing the example provides an interactive illustration of building a Stack data structure. Beyond the algorithm, a visual implementation is also shown using SwiftUI. \n\n\nFeatures\n--------------------\n\nThe project features code-level examples for the following items:\n\n+ Linked Lists\n+ Binary Search\n+ Insertion Sort\n+ Bubble Sort\n+ Selection Sort\n+ Quick Sort\n+ Binary Search Trees\n+ Tree Balancing - Rotations\n+ Stacks\n+ Queues\n+ Heaps \u0026 Heapsort Operations\n+ Priority Queues\n+ Hash Tables\n+ Tries\n+ Graph Theory\n+ Dijkstra's Shortest Path\n+ Depth-First Search\n+ Breadth-First Search\n+ PageRank\n+ Blockchain Networks\n+ Generics\n+ Type Contraints\n+ Protocol Extensions\n+ Enumerations\n+ Fibonacci Numbers\n+ Dyanmic Programming\n+ Closures\n\n\nThe Book\n--------------------\n\nNow in its **5th edition** and supporting latest version of **Swift**, [The Swift Algorithms Book](https://github.com/waynewbishop/bishop-algorithms-book) features code and color illustrations that benefits students and professionals. As an ongoing effort, I also welcome [feedback and contribution](https://github.com/waynewbishop/bishop-algorithms-book/pulls) from others. \n\n\nExample\n--------------------\n\n```swift\n// complexity: O(1) - constant time average time for all operations.\npublic struct Stack \u003cT\u003e {\n\n   var elements : [T] = [T]()\n\n    public init() {\n        //initialization\n    }\n    \n    //the number of items\n    var count: Int {\n        return elements.count\n    }\n    \n    public func peek() -\u003e T? {\n          return elements.last\n      }\n  \n    public mutating func push(_ element: T) {\n          elements.append(element)\n      }\n\n    public mutating func pop() -\u003e T? {\n          return elements.popLast()\n      }\n\n    //swap positions\n    public mutating func swapAt(lhs: Int, rhs: Int) -\u003e () {\n        self.elements.swapAt(lhs, rhs)\n    }        \n}\n```\n\nGetting Started\n--------------------\n\nSwift Structures has been optimized for **Swift 5.9** (e.g., Xcode 15.0) or later. The directories are organized as follows:\n+ Sources - Code for all Swift data structures, algorithms and source extensions\n+ Playgrounds - Getting started material plus an interactive example of Stack algorithms. \n+ Tests - 90+ unit tests with XCTest Framework\n\n**Note:** If required, also set `ENABLE_TESTING_SEARCH_PATHS` to `YES` for your project configuration.\n\n\nUsage\n--------------------\n\nIndividuals are welcome to use the code with commercial and open-source projects. As a courtesy, please provide attribution to [Wayne Bishop](https://www.linkedin.com/in/waynebishop). For more information, review the complete [license agreement](https://github.com/waynewbishop/SwiftStructures/blob/master/License.md). \n\n\nQuestions\n--------------------\n\nHave a question? Feel free to contact me on [LinkedIn](https://www.linkedin.com/in/waynebishop)\u003c/a\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaynewbishop%2Fbishop-algorithms-swift-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaynewbishop%2Fbishop-algorithms-swift-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaynewbishop%2Fbishop-algorithms-swift-package/lists"}