├── CNAME
├── Ordered Set
└── OrderedSet.playground
│ ├── Contents.swift
│ └── contents.xcplayground
├── .gitignore
├── Kth Largest Element
└── kthLargest.playground
│ ├── Contents.swift
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Ring Buffer
└── RingBuffer.playground
│ ├── Sources
│ └── RingBuffer.swift
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ └── andyron.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── Skip-List
├── SkipList.playground
│ ├── Contents.swift
│ ├── timeline.xctimeline
│ ├── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ │ └── andyron.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
└── Images
│ ├── Insert1.png
│ ├── Insert2.png
│ ├── Insert3.png
│ ├── Insert4.png
│ ├── Insert5.png
│ ├── Insert6.png
│ ├── Insert8.png
│ ├── Insert9.png
│ ├── Intro.png
│ ├── Search1.png
│ ├── insert7.png
│ ├── Insert10.png
│ ├── Insert11.png
│ └── Insert12.png
├── Union-Find
├── UnionFind.playground
│ ├── Contents.swift
│ ├── playground.xcworkspace
│ │ └── contents.xcworkspacedata
│ ├── timeline.xctimeline
│ └── contents.xcplayground
└── Images
│ ├── AfterFind.png
│ ├── AfterUnion.png
│ ├── BeforeFind.png
│ └── BeforeUnion.png
├── Graph
├── Images
│ ├── DAG.png
│ ├── Demo1.png
│ ├── Graph.png
│ ├── Tasks.png
│ ├── ChordMap.png
│ ├── CoreData.png
│ ├── DAG.graffle
│ ├── Flights.png
│ ├── Demo1.graffle
│ ├── Flights.graffle
│ ├── Graph.graffle
│ ├── Tasks.graffle
│ ├── TreeAndList.png
│ ├── AdjacencyList.png
│ ├── ChordMap.graffle
│ ├── CoreData.graffle
│ ├── SocialNetwork.png
│ ├── StateMachine.png
│ ├── AdjacencyMatrix.png
│ ├── FlightsDirected.png
│ ├── StateMachine.graffle
│ ├── TreeAndList.graffle
│ ├── AdjacencyList.graffle
│ ├── SocialNetwork.graffle
│ ├── AdjacencyMatrix.graffle
│ └── FlightsDirected.graffle
└── Graph
│ ├── Graph
│ ├── other
│ │ └── Assets.xcassets
│ │ │ ├── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Graph.entitlements
│ ├── Vertex.swift
│ ├── Info.plist
│ └── Edge.swift
│ └── Graph.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ └── andyron.xcuserdatad
│ ├── xcschemes
│ └── xcschememanagement.plist
│ └── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
├── Tree
├── Images
│ ├── Tree.png
│ ├── Cycles.png
│ ├── Example.png
│ ├── Tree.graffle
│ ├── Cycles.graffle
│ ├── Example.graffle
│ ├── ParentChildren.png
│ └── ParentChildren.graffle
└── Tree.playground
│ └── contents.xcplayground
├── Trie
└── images
│ └── trie.png
├── B-Tree
├── Images
│ ├── Node.png
│ ├── BTree20.png
│ ├── MovingKey.png
│ ├── MergingNodes.png
│ └── InsertionSplit.png
└── BTree.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Heap
└── Images
│ ├── Array.png
│ ├── Heap1.png
│ ├── Insert1.png
│ ├── Insert2.png
│ ├── Insert3.png
│ ├── Remove1.png
│ ├── Remove2.png
│ ├── Remove3.png
│ ├── Remove4.png
│ ├── Remove5.png
│ ├── Array.graffle
│ ├── Heap1.graffle
│ ├── HeapShape.png
│ ├── LargeHeap.png
│ ├── Insert1.graffle
│ ├── Insert2.graffle
│ ├── Insert3.graffle
│ ├── RegularTree.png
│ ├── Remove1.graffle
│ ├── Remove2.graffle
│ ├── Remove3.graffle
│ ├── Remove4.graffle
│ ├── Remove5.graffle
│ ├── SortedArray.png
│ ├── HeapShape.graffle
│ ├── LargeHeap.graffle
│ ├── RegularTree.graffle
│ └── SortedArray.graffle
├── Selection Sampling
└── SelectionSampling.playground
│ ├── Contents.swift
│ ├── timeline.xctimeline
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Splay Tree
├── Images
│ ├── zig.png
│ ├── zigzag1.png
│ ├── zigzag2.png
│ ├── zigzig1.png
│ ├── zigzig2.png
│ ├── example1-1.png
│ ├── example1-2.png
│ ├── example1-3.png
│ ├── examplezig1.png
│ ├── examplezig2.png
│ ├── worst-case-1.png
│ ├── worst-case-2.png
│ ├── worst-case-3.png
│ ├── worst-case-4.png
│ ├── worst-case-5.png
│ ├── worst-case-6.png
│ ├── example-zigzig-1.png
│ ├── example-zigzig-2.png
│ ├── example-zigzig-3.png
│ ├── example-zigzig-4.png
│ ├── example-zigzig-5.png
│ ├── examplezigzig1.png
│ ├── examplezigzig2.png
│ ├── examplezigzig3.png
│ └── zigzig-wrongrotated.png
└── SplayTree.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── AVL Tree
├── Images
│ ├── Balanced.png
│ ├── Height.png
│ ├── BalanceOK.png
│ ├── Height.graffle
│ ├── Unbalanced.png
│ ├── BalanceNotOK.png
│ ├── BalanceOK.graffle
│ ├── Balanced.graffle
│ ├── RotationStep0.jpg
│ ├── RotationStep1.jpg
│ ├── RotationStep2.jpg
│ ├── RotationStep3.jpg
│ ├── Unbalanced.graffle
│ └── BalanceNotOK.graffle
└── AVLTree.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Heap Sort
├── Images
│ ├── MaxHeap.png
│ └── MaxHeap.graffle
├── HeapSort.playground
│ └── contents.xcplayground
└── HeapSort.swift
├── QuadTree
├── Images
│ └── quadtree.png
└── QuadTree.playground
│ ├── contents.xcplayground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── Contents.swift
├── Quicksort
├── Images
│ ├── Example.png
│ └── Example.graffle
└── Quicksort.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Huffman Coding
└── Images
│ ├── Tree.png
│ ├── BuildTree.gif
│ ├── BuildTree.psd
│ ├── Tree.graffle
│ ├── Compression.png
│ ├── BuildTree.graffle
│ ├── Decompression.png
│ ├── Compression.graffle
│ └── Decompression.graffle
├── Sparse Table
└── Images
│ ├── query.png
│ ├── recursion.png
│ ├── structure.png
│ ├── idempotency.png
│ ├── query_example.png
│ ├── recursion_examples.png
│ └── structure_examples.png
├── Binary Tree
├── Images
│ ├── BinaryTree.png
│ ├── Operations.png
│ ├── BinaryTree.graffle
│ └── Operations.graffle
└── BinaryTree.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Fixed Size Array
├── Images
│ ├── array.png
│ ├── append.png
│ ├── delete.png
│ ├── insert.png
│ ├── indexing.png
│ ├── delete-no-copy.png
│ └── FixedSizeArrays.graffle
└── FixedSizeArray.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── contents.xcplayground
│ └── Contents.swift
├── Hash Set
├── Images
│ └── CombineSets.png
└── HashSet.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── K-Means
└── Images
│ ├── k_means_bad1.png
│ ├── k_means_bad2.png
│ └── k_means_good.png
├── MinimumCoinChange
└── eurocoins.gif
├── Radix Sort
├── image
│ └── radix_sort.jpg
└── RadixSort.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Segment Tree
├── Images
│ ├── Structure.png
│ ├── LeftSegment.png
│ ├── EqualSegments.png
│ ├── MixedSegment.png
│ └── RightSegment.png
├── LazyPropagation
│ └── Images
│ │ ├── pushUp.png
│ │ ├── pushdown.png
│ │ ├── Segment-tree.png
│ │ └── lazy-sample-2.png
└── SegmentTree.playground
│ └── contents.xcplayground
├── Shell Sort
├── image
│ ├── shell_sort_1.png
│ └── shell_sort_2.png
└── Shell Sort.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── contents.xcplayground
│ └── Contents.swift
├── Topological Sort
└── Images
│ ├── Graph.png
│ ├── Example.png
│ ├── Algorithms.png
│ ├── Graph.graffle
│ ├── Example.graffle
│ ├── GraphResult.png
│ ├── InvalidSort.png
│ ├── Algorithms.graffle
│ ├── GraphResult.graffle
│ ├── InvalidSort.graffle
│ ├── TopologicalSort.png
│ └── TopologicalSort.graffle
├── All-Pairs Shortest Paths
└── img
│ ├── d0.png
│ ├── d1.png
│ ├── d2.png
│ ├── d3.png
│ ├── pi0.png
│ ├── pi1.png
│ ├── pi2.png
│ ├── pi3.png
│ ├── example_graph.png
│ ├── original_adjacency_matrix.png
│ └── weight_comparison_formula.png
├── Binary Search Tree
├── Images
│ ├── Tree1.png
│ ├── Tree2.png
│ ├── DeleteLeaf.png
│ ├── Searching.png
│ ├── Traversing.png
│ ├── Tree1.graffle
│ ├── Tree2.graffle
│ ├── Searching.graffle
│ ├── DeleteLeaf.graffle
│ ├── DeleteOneChild.png
│ ├── MinimumMaximum.png
│ ├── Traversing.graffle
│ ├── DeleteOneChild.graffle
│ ├── DeleteTwoChildren.png
│ ├── MinimumMaximum.graffle
│ └── DeleteTwoChildren.graffle
├── Solution 1
│ └── BinarySearchTree.playground
│ │ ├── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ │ └── andyron.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ ├── contents.xcplayground
│ │ └── timeline.xctimeline
└── Solution 2
│ └── BinarySearchTree.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Egg Drop Problem
└── images
│ ├── eggdrop.png
│ └── eggdrop2.png
├── Linear Regression
└── Images
│ ├── graph1.png
│ ├── graph2.png
│ └── graph3.png
├── Dijkstra Algorithm
└── Images
│ ├── Vertices.png
│ ├── image1.png
│ ├── image2.png
│ ├── image3.png
│ ├── image4.png
│ ├── image5.png
│ ├── image6.png
│ ├── image7.png
│ ├── DirectedGraph.png
│ ├── WeightedDirectedGraph.png
│ ├── WeightedUndirectedGraph.png
│ └── WeightedDirectedGraphFinal.png
├── Images
├── SwiftAlgorithm-410-transp.png
└── scheme-settings-for-travis.png
├── Minimum Spanning Tree
├── Images
│ ├── prim.png
│ └── kruskal.png
└── MinimumSpanningTree.playground
│ ├── Resources
│ └── mst.png
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Naive Bayes Classifier
└── images
│ ├── mean.gif
│ ├── bayes.gif
│ ├── multinomial.gif
│ ├── code_example.png
│ ├── tennis_dataset.png
│ ├── normal_distribution.gif
│ └── standard_deviation.gif
├── Threaded Binary Tree
├── Images
│ ├── Base.png
│ ├── Full.png
│ ├── Insert1.png
│ ├── Insert2.png
│ ├── Insert3.png
│ ├── Partial.png
│ ├── Remove1.png
│ ├── Remove2.png
│ ├── Remove3.png
│ └── Remove4.png
└── ThreadedBinaryTree.playground
│ └── contents.xcplayground
├── Depth-First Search
├── Images
│ ├── TraversalTree.png
│ ├── AnimatedExample.gif
│ ├── AnimatedExample.psd
│ ├── TraversalTree.graffle
│ └── AnimatedExample.graffle
└── DepthFirstSearch.playground
│ ├── contents.xcplayground
│ ├── Sources
│ ├── Edge.swift
│ └── Node.swift
│ └── Contents.swift
├── Shortest Path (Unweighted)
├── Images
│ ├── Graph.png
│ └── Graph.graffle
└── ShortestPath.playground
│ ├── contents.xcplayground
│ └── Sources
│ ├── Edge.swift
│ ├── Queue.swift
│ └── Node.swift
├── Breadth-First Search
├── Images
│ ├── TraversalTree.png
│ ├── AnimatedExample.gif
│ ├── AnimatedExample.psd
│ ├── TraversalTree.graffle
│ └── AnimatedExample.graffle
└── BreadthFirstSearch.playground
│ ├── contents.xcplayground
│ ├── Sources
│ ├── Edge.swift
│ ├── Queue.swift
│ └── Node.swift
│ └── Contents.swift
├── Rootish Array Stack
├── images
│ ├── quadratic_formula.jpg
│ ├── quadratic_equation.jpg
│ ├── RootishArrayStackIntro.png
│ ├── RootishArrayStackExample.png
│ └── RootishArrayStackExample2.png
└── RootishArrayStack.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Bit Set
└── BitSet.playground
│ ├── Contents.swift
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Miller-Rabin Primality Test
└── Images
│ └── img_pseudo.png
├── Minimum Spanning Tree(Unweighted)
├── Images
│ ├── Graph.png
│ ├── Tree.png
│ ├── Graph.sketch
│ ├── Tree.graffle
│ ├── MinimumSpanningTree.png
│ └── MinimumSpanningTree.sketch
└── MinimumSpanningTree(unweighted).playground
│ ├── contents.xcplayground
│ └── Sources
│ ├── Edge.swift
│ ├── Queue.swift
│ └── Node.swift
├── Single-Source Shortest Paths (Weighted)
└── img
│ ├── example_graph.png
│ └── negative_cycle_example.png
├── Insertion Sort
├── Tests
│ ├── InsertionSortTests.swift
│ ├── Tests.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ ├── xcuserdata
│ │ │ │ └── andyron.xcuserdatad
│ │ │ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── andyron.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── Info.plist
└── InsertionSort.playground
│ ├── contents.xcplayground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── Contents.swift
├── GCD
└── GCD.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Octree
├── OcTree.playground
│ ├── contents.xcplayground
│ └── Contents.swift
└── README.md
├── Queue
├── Queue.playground
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Tests
│ ├── Tests.xcodeproj
│ │ └── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ └── Info.plist
├── Queue-Simple.swift
└── Queue-Optimized.swift
├── Stack
├── Stack.playground
│ ├── contents.xcplayground
│ ├── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ │ └── andyron.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Contents.swift
└── Tests
│ ├── Tests.xcodeproj
│ └── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── Info.plist
├── Multiset
└── Multiset.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Deque
├── Deque.playground
│ ├── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ │ └── andyron.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
└── Deque-Simple.swift
├── Merge Sort
└── MergeSort.playground
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ └── andyron.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── Binary Search
└── BinarySearch.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Bloom Filter
└── BloomFilter.playground
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ └── andyron.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── Linear Search
├── LinearSearch.playground
│ ├── contents.xcplayground
│ ├── playground.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ │ └── andyron.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Contents.swift
├── LinearSearch.swift
└── README.markdown
├── Red-Black Tree
└── RedBlackTree.playground
│ ├── contents.xcplayground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── timeline.xctimeline
│ └── Contents.swift
├── Selection Sort
├── SelectionSort.playground
│ ├── contents.xcplayground
│ └── Contents.swift
└── SelectionSort.swift
├── Hash Table
└── HashTable.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Introsort
└── Introsort.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── contents.xcplayground
│ ├── Sources
│ ├── Randomize.swift
│ ├── Sort3.swift
│ └── InsertionSort.swift
│ ├── timeline.xctimeline
│ └── Contents.swift
├── Linked List
└── LinkedList.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Ordered Array
└── OrderedArray.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Bounded Priority Queue
└── BoundedPriorityQueue.playground
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ └── andyron.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── Boyer-Moore-Horspool
└── BoyerMooreHorspool.playground
│ ├── contents.xcplayground
│ └── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ └── andyron.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── Priority Queue
└── PriorityQueue.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── contents.xcplayground
│ └── Contents.swift
├── Array2D
└── Array2D.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Count Occurrences
└── CountOccurrences.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── contents.xcplayground
│ └── Contents.swift
├── Knuth-Morris-Pratt
└── KnuthMorrisPratt.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── contents.xcplayground
├── Bubble Sort
├── BubbleSort.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── README_en.markdown
└── README.markdown
├── Counting Sort
└── CountingSort.playground
│ ├── contents.xcplayground
│ └── Contents.swift
├── Brute-Force String Search
└── BruteForceStringSearch.playground
│ ├── playground.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcuserdata
│ │ └── andyron.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ ├── contents.xcplayground
│ ├── Contents.swift
│ └── timeline.xctimeline
├── HaversineDistance
├── HaversineDistance.playground
│ ├── contents.xcplayground
│ └── Contents.swift
└── README_en.md
├── Select Minimum Maximum
└── SelectMinimumMaximum.playground
│ ├── contents.xcplayground
│ └── timeline.xctimeline
├── SUMMARY.md
├── What are Algorithms.markdown
├── Algorithm Design.markdown
├── Why Algorithms.markdown
├── Under Construction.markdown
└── Slow Sort
├── README.markdown
└── README_en.markdown
/CNAME:
--------------------------------------------------------------------------------
1 | hosting.gitbook.com
2 |
--------------------------------------------------------------------------------
/Ordered Set/OrderedSet.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | MyREADME\.md
3 |
4 | MyREADME\.markdown
5 |
--------------------------------------------------------------------------------
/Kth Largest Element/kthLargest.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Ring Buffer/RingBuffer.playground/Sources/RingBuffer.swift:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Skip-List/SkipList.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | var str = "Hello, playground"
4 |
--------------------------------------------------------------------------------
/Union-Find/UnionFind.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | var str = "Hello, playground"
4 |
--------------------------------------------------------------------------------
/Graph/Images/DAG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/DAG.png
--------------------------------------------------------------------------------
/Tree/Images/Tree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/Tree.png
--------------------------------------------------------------------------------
/Trie/images/trie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Trie/images/trie.png
--------------------------------------------------------------------------------
/B-Tree/Images/Node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/B-Tree/Images/Node.png
--------------------------------------------------------------------------------
/Graph/Images/Demo1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Demo1.png
--------------------------------------------------------------------------------
/Graph/Images/Graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Graph.png
--------------------------------------------------------------------------------
/Graph/Images/Tasks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Tasks.png
--------------------------------------------------------------------------------
/Heap/Images/Array.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Array.png
--------------------------------------------------------------------------------
/Heap/Images/Heap1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Heap1.png
--------------------------------------------------------------------------------
/Heap/Images/Insert1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Insert1.png
--------------------------------------------------------------------------------
/Heap/Images/Insert2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Insert2.png
--------------------------------------------------------------------------------
/Heap/Images/Insert3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Insert3.png
--------------------------------------------------------------------------------
/Heap/Images/Remove1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove1.png
--------------------------------------------------------------------------------
/Heap/Images/Remove2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove2.png
--------------------------------------------------------------------------------
/Heap/Images/Remove3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove3.png
--------------------------------------------------------------------------------
/Heap/Images/Remove4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove4.png
--------------------------------------------------------------------------------
/Heap/Images/Remove5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove5.png
--------------------------------------------------------------------------------
/Tree/Images/Cycles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/Cycles.png
--------------------------------------------------------------------------------
/Tree/Images/Example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/Example.png
--------------------------------------------------------------------------------
/B-Tree/Images/BTree20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/B-Tree/Images/BTree20.png
--------------------------------------------------------------------------------
/Graph/Images/ChordMap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/ChordMap.png
--------------------------------------------------------------------------------
/Graph/Images/CoreData.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/CoreData.png
--------------------------------------------------------------------------------
/Graph/Images/DAG.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/DAG.graffle
--------------------------------------------------------------------------------
/Graph/Images/Flights.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Flights.png
--------------------------------------------------------------------------------
/Heap/Images/Array.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Array.graffle
--------------------------------------------------------------------------------
/Heap/Images/Heap1.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Heap1.graffle
--------------------------------------------------------------------------------
/Heap/Images/HeapShape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/HeapShape.png
--------------------------------------------------------------------------------
/Heap/Images/LargeHeap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/LargeHeap.png
--------------------------------------------------------------------------------
/Selection Sampling/SelectionSampling.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 | var str = "Hello, playground"
4 |
--------------------------------------------------------------------------------
/Splay Tree/Images/zig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/zig.png
--------------------------------------------------------------------------------
/Tree/Images/Tree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/Tree.graffle
--------------------------------------------------------------------------------
/AVL Tree/Images/Balanced.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/Balanced.png
--------------------------------------------------------------------------------
/AVL Tree/Images/Height.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/Height.png
--------------------------------------------------------------------------------
/B-Tree/Images/MovingKey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/B-Tree/Images/MovingKey.png
--------------------------------------------------------------------------------
/Graph/Images/Demo1.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Demo1.graffle
--------------------------------------------------------------------------------
/Graph/Images/Flights.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Flights.graffle
--------------------------------------------------------------------------------
/Graph/Images/Graph.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Graph.graffle
--------------------------------------------------------------------------------
/Graph/Images/Tasks.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/Tasks.graffle
--------------------------------------------------------------------------------
/Graph/Images/TreeAndList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/TreeAndList.png
--------------------------------------------------------------------------------
/Heap Sort/Images/MaxHeap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap Sort/Images/MaxHeap.png
--------------------------------------------------------------------------------
/Heap/Images/Insert1.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Insert1.graffle
--------------------------------------------------------------------------------
/Heap/Images/Insert2.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Insert2.graffle
--------------------------------------------------------------------------------
/Heap/Images/Insert3.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Insert3.graffle
--------------------------------------------------------------------------------
/Heap/Images/RegularTree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/RegularTree.png
--------------------------------------------------------------------------------
/Heap/Images/Remove1.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove1.graffle
--------------------------------------------------------------------------------
/Heap/Images/Remove2.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove2.graffle
--------------------------------------------------------------------------------
/Heap/Images/Remove3.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove3.graffle
--------------------------------------------------------------------------------
/Heap/Images/Remove4.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove4.graffle
--------------------------------------------------------------------------------
/Heap/Images/Remove5.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/Remove5.graffle
--------------------------------------------------------------------------------
/Heap/Images/SortedArray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/SortedArray.png
--------------------------------------------------------------------------------
/QuadTree/Images/quadtree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/QuadTree/Images/quadtree.png
--------------------------------------------------------------------------------
/Quicksort/Images/Example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Quicksort/Images/Example.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert1.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert2.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert3.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert4.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert5.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert6.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert8.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert9.png
--------------------------------------------------------------------------------
/Skip-List/Images/Intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Intro.png
--------------------------------------------------------------------------------
/Skip-List/Images/Search1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Search1.png
--------------------------------------------------------------------------------
/Skip-List/Images/insert7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/insert7.png
--------------------------------------------------------------------------------
/Tree/Images/Cycles.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/Cycles.graffle
--------------------------------------------------------------------------------
/Tree/Images/Example.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/Example.graffle
--------------------------------------------------------------------------------
/AVL Tree/Images/BalanceOK.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/BalanceOK.png
--------------------------------------------------------------------------------
/AVL Tree/Images/Height.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/Height.graffle
--------------------------------------------------------------------------------
/AVL Tree/Images/Unbalanced.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/Unbalanced.png
--------------------------------------------------------------------------------
/B-Tree/Images/MergingNodes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/B-Tree/Images/MergingNodes.png
--------------------------------------------------------------------------------
/Graph/Images/AdjacencyList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/AdjacencyList.png
--------------------------------------------------------------------------------
/Graph/Images/ChordMap.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/ChordMap.graffle
--------------------------------------------------------------------------------
/Graph/Images/CoreData.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/CoreData.graffle
--------------------------------------------------------------------------------
/Graph/Images/SocialNetwork.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/SocialNetwork.png
--------------------------------------------------------------------------------
/Graph/Images/StateMachine.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/StateMachine.png
--------------------------------------------------------------------------------
/Heap/Images/HeapShape.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/HeapShape.graffle
--------------------------------------------------------------------------------
/Heap/Images/LargeHeap.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/LargeHeap.graffle
--------------------------------------------------------------------------------
/Huffman Coding/Images/Tree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/Tree.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert10.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert11.png
--------------------------------------------------------------------------------
/Skip-List/Images/Insert12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/Images/Insert12.png
--------------------------------------------------------------------------------
/Sparse Table/Images/query.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/query.png
--------------------------------------------------------------------------------
/Splay Tree/Images/zigzag1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/zigzag1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/zigzag2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/zigzag2.png
--------------------------------------------------------------------------------
/Splay Tree/Images/zigzig1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/zigzig1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/zigzig2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/zigzig2.png
--------------------------------------------------------------------------------
/Tree/Images/ParentChildren.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/ParentChildren.png
--------------------------------------------------------------------------------
/AVL Tree/Images/BalanceNotOK.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/BalanceNotOK.png
--------------------------------------------------------------------------------
/AVL Tree/Images/BalanceOK.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/BalanceOK.graffle
--------------------------------------------------------------------------------
/AVL Tree/Images/Balanced.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/Balanced.graffle
--------------------------------------------------------------------------------
/AVL Tree/Images/RotationStep0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/RotationStep0.jpg
--------------------------------------------------------------------------------
/AVL Tree/Images/RotationStep1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/RotationStep1.jpg
--------------------------------------------------------------------------------
/AVL Tree/Images/RotationStep2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/RotationStep2.jpg
--------------------------------------------------------------------------------
/AVL Tree/Images/RotationStep3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/RotationStep3.jpg
--------------------------------------------------------------------------------
/B-Tree/Images/InsertionSplit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/B-Tree/Images/InsertionSplit.png
--------------------------------------------------------------------------------
/Binary Tree/Images/BinaryTree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Tree/Images/BinaryTree.png
--------------------------------------------------------------------------------
/Binary Tree/Images/Operations.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Tree/Images/Operations.png
--------------------------------------------------------------------------------
/Fixed Size Array/Images/array.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/array.png
--------------------------------------------------------------------------------
/Graph/Images/AdjacencyMatrix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/AdjacencyMatrix.png
--------------------------------------------------------------------------------
/Graph/Images/FlightsDirected.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/FlightsDirected.png
--------------------------------------------------------------------------------
/Graph/Images/StateMachine.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/StateMachine.graffle
--------------------------------------------------------------------------------
/Graph/Images/TreeAndList.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/TreeAndList.graffle
--------------------------------------------------------------------------------
/Hash Set/Images/CombineSets.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Hash Set/Images/CombineSets.png
--------------------------------------------------------------------------------
/Heap Sort/Images/MaxHeap.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap Sort/Images/MaxHeap.graffle
--------------------------------------------------------------------------------
/Heap/Images/RegularTree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/RegularTree.graffle
--------------------------------------------------------------------------------
/Heap/Images/SortedArray.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Heap/Images/SortedArray.graffle
--------------------------------------------------------------------------------
/K-Means/Images/k_means_bad1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/K-Means/Images/k_means_bad1.png
--------------------------------------------------------------------------------
/K-Means/Images/k_means_bad2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/K-Means/Images/k_means_bad2.png
--------------------------------------------------------------------------------
/K-Means/Images/k_means_good.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/K-Means/Images/k_means_good.png
--------------------------------------------------------------------------------
/MinimumCoinChange/eurocoins.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/MinimumCoinChange/eurocoins.gif
--------------------------------------------------------------------------------
/Quicksort/Images/Example.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Quicksort/Images/Example.graffle
--------------------------------------------------------------------------------
/Radix Sort/image/radix_sort.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Radix Sort/image/radix_sort.jpg
--------------------------------------------------------------------------------
/Segment Tree/Images/Structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/Images/Structure.png
--------------------------------------------------------------------------------
/Shell Sort/image/shell_sort_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Shell Sort/image/shell_sort_1.png
--------------------------------------------------------------------------------
/Shell Sort/image/shell_sort_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Shell Sort/image/shell_sort_2.png
--------------------------------------------------------------------------------
/Sparse Table/Images/recursion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/recursion.png
--------------------------------------------------------------------------------
/Sparse Table/Images/structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/structure.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example1-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example1-1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example1-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example1-2.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example1-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example1-3.png
--------------------------------------------------------------------------------
/Splay Tree/Images/examplezig1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/examplezig1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/examplezig2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/examplezig2.png
--------------------------------------------------------------------------------
/Topological Sort/Images/Graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/Graph.png
--------------------------------------------------------------------------------
/Union-Find/Images/AfterFind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Union-Find/Images/AfterFind.png
--------------------------------------------------------------------------------
/Union-Find/Images/AfterUnion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Union-Find/Images/AfterUnion.png
--------------------------------------------------------------------------------
/Union-Find/Images/BeforeFind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Union-Find/Images/BeforeFind.png
--------------------------------------------------------------------------------
/Union-Find/Images/BeforeUnion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Union-Find/Images/BeforeUnion.png
--------------------------------------------------------------------------------
/AVL Tree/Images/Unbalanced.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/Unbalanced.graffle
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/d0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/d0.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/d1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/d1.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/d2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/d2.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/d3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/d3.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Tree1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Tree1.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Tree2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Tree2.png
--------------------------------------------------------------------------------
/Egg Drop Problem/images/eggdrop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Egg Drop Problem/images/eggdrop.png
--------------------------------------------------------------------------------
/Fixed Size Array/Images/append.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/append.png
--------------------------------------------------------------------------------
/Fixed Size Array/Images/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/delete.png
--------------------------------------------------------------------------------
/Fixed Size Array/Images/insert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/insert.png
--------------------------------------------------------------------------------
/Graph/Graph/Graph/other/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Graph/Images/AdjacencyList.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/AdjacencyList.graffle
--------------------------------------------------------------------------------
/Graph/Images/SocialNetwork.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/SocialNetwork.graffle
--------------------------------------------------------------------------------
/Huffman Coding/Images/BuildTree.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/BuildTree.gif
--------------------------------------------------------------------------------
/Huffman Coding/Images/BuildTree.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/BuildTree.psd
--------------------------------------------------------------------------------
/Huffman Coding/Images/Tree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/Tree.graffle
--------------------------------------------------------------------------------
/Linear Regression/Images/graph1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Linear Regression/Images/graph1.png
--------------------------------------------------------------------------------
/Linear Regression/Images/graph2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Linear Regression/Images/graph2.png
--------------------------------------------------------------------------------
/Linear Regression/Images/graph3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Linear Regression/Images/graph3.png
--------------------------------------------------------------------------------
/Segment Tree/Images/LeftSegment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/Images/LeftSegment.png
--------------------------------------------------------------------------------
/Sparse Table/Images/idempotency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/idempotency.png
--------------------------------------------------------------------------------
/Splay Tree/Images/worst-case-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/worst-case-1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/worst-case-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/worst-case-2.png
--------------------------------------------------------------------------------
/Splay Tree/Images/worst-case-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/worst-case-3.png
--------------------------------------------------------------------------------
/Splay Tree/Images/worst-case-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/worst-case-4.png
--------------------------------------------------------------------------------
/Splay Tree/Images/worst-case-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/worst-case-5.png
--------------------------------------------------------------------------------
/Splay Tree/Images/worst-case-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/worst-case-6.png
--------------------------------------------------------------------------------
/Topological Sort/Images/Example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/Example.png
--------------------------------------------------------------------------------
/Tree/Images/ParentChildren.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Tree/Images/ParentChildren.graffle
--------------------------------------------------------------------------------
/AVL Tree/Images/BalanceNotOK.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/Images/BalanceNotOK.graffle
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/pi0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/pi0.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/pi1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/pi1.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/pi2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/pi2.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/pi3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/pi3.png
--------------------------------------------------------------------------------
/Binary Tree/Images/BinaryTree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Tree/Images/BinaryTree.graffle
--------------------------------------------------------------------------------
/Binary Tree/Images/Operations.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Tree/Images/Operations.graffle
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/Vertices.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/Vertices.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image1.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image2.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image3.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image4.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image5.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image6.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/image7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/image7.png
--------------------------------------------------------------------------------
/Egg Drop Problem/images/eggdrop2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Egg Drop Problem/images/eggdrop2.png
--------------------------------------------------------------------------------
/Fixed Size Array/Images/indexing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/indexing.png
--------------------------------------------------------------------------------
/Graph/Images/AdjacencyMatrix.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/AdjacencyMatrix.graffle
--------------------------------------------------------------------------------
/Graph/Images/FlightsDirected.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Images/FlightsDirected.graffle
--------------------------------------------------------------------------------
/Huffman Coding/Images/Compression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/Compression.png
--------------------------------------------------------------------------------
/Images/SwiftAlgorithm-410-transp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Images/SwiftAlgorithm-410-transp.png
--------------------------------------------------------------------------------
/Images/scheme-settings-for-travis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Images/scheme-settings-for-travis.png
--------------------------------------------------------------------------------
/Minimum Spanning Tree/Images/prim.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree/Images/prim.png
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/mean.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/mean.gif
--------------------------------------------------------------------------------
/Segment Tree/Images/EqualSegments.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/Images/EqualSegments.png
--------------------------------------------------------------------------------
/Segment Tree/Images/MixedSegment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/Images/MixedSegment.png
--------------------------------------------------------------------------------
/Segment Tree/Images/RightSegment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/Images/RightSegment.png
--------------------------------------------------------------------------------
/Sparse Table/Images/query_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/query_example.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example-zigzig-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example-zigzig-1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example-zigzig-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example-zigzig-2.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example-zigzig-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example-zigzig-3.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example-zigzig-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example-zigzig-4.png
--------------------------------------------------------------------------------
/Splay Tree/Images/example-zigzig-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/example-zigzig-5.png
--------------------------------------------------------------------------------
/Splay Tree/Images/examplezigzig1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/examplezigzig1.png
--------------------------------------------------------------------------------
/Splay Tree/Images/examplezigzig2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/examplezigzig2.png
--------------------------------------------------------------------------------
/Splay Tree/Images/examplezigzig3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/examplezigzig3.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Base.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Full.png
--------------------------------------------------------------------------------
/Topological Sort/Images/Algorithms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/Algorithms.png
--------------------------------------------------------------------------------
/Topological Sort/Images/Graph.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/Graph.graffle
--------------------------------------------------------------------------------
/Binary Search Tree/Images/DeleteLeaf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/DeleteLeaf.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Searching.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Searching.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Traversing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Traversing.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Tree1.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Tree1.graffle
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Tree2.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Tree2.graffle
--------------------------------------------------------------------------------
/Huffman Coding/Images/BuildTree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/BuildTree.graffle
--------------------------------------------------------------------------------
/Huffman Coding/Images/Decompression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/Decompression.png
--------------------------------------------------------------------------------
/Minimum Spanning Tree/Images/kruskal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree/Images/kruskal.png
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/bayes.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/bayes.gif
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Insert1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Insert1.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Insert2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Insert2.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Insert3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Insert3.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Partial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Partial.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Remove1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Remove1.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Remove2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Remove2.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Remove3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Remove3.png
--------------------------------------------------------------------------------
/Threaded Binary Tree/Images/Remove4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Threaded Binary Tree/Images/Remove4.png
--------------------------------------------------------------------------------
/Topological Sort/Images/Example.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/Example.graffle
--------------------------------------------------------------------------------
/Topological Sort/Images/GraphResult.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/GraphResult.png
--------------------------------------------------------------------------------
/Topological Sort/Images/InvalidSort.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/InvalidSort.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Searching.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Searching.graffle
--------------------------------------------------------------------------------
/Depth-First Search/Images/TraversalTree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Depth-First Search/Images/TraversalTree.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/DirectedGraph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/DirectedGraph.png
--------------------------------------------------------------------------------
/Fixed Size Array/Images/delete-no-copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/delete-no-copy.png
--------------------------------------------------------------------------------
/Huffman Coding/Images/Compression.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/Compression.graffle
--------------------------------------------------------------------------------
/Huffman Coding/Images/Decompression.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Huffman Coding/Images/Decompression.graffle
--------------------------------------------------------------------------------
/Shortest Path (Unweighted)/Images/Graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Shortest Path (Unweighted)/Images/Graph.png
--------------------------------------------------------------------------------
/Sparse Table/Images/recursion_examples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/recursion_examples.png
--------------------------------------------------------------------------------
/Sparse Table/Images/structure_examples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Sparse Table/Images/structure_examples.png
--------------------------------------------------------------------------------
/Splay Tree/Images/zigzig-wrongrotated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Splay Tree/Images/zigzig-wrongrotated.png
--------------------------------------------------------------------------------
/Topological Sort/Images/Algorithms.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/Algorithms.graffle
--------------------------------------------------------------------------------
/Topological Sort/Images/GraphResult.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/GraphResult.graffle
--------------------------------------------------------------------------------
/Topological Sort/Images/InvalidSort.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/InvalidSort.graffle
--------------------------------------------------------------------------------
/Topological Sort/Images/TopologicalSort.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/TopologicalSort.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/DeleteLeaf.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/DeleteLeaf.graffle
--------------------------------------------------------------------------------
/Binary Search Tree/Images/DeleteOneChild.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/DeleteOneChild.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/MinimumMaximum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/MinimumMaximum.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/Traversing.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/Traversing.graffle
--------------------------------------------------------------------------------
/Breadth-First Search/Images/TraversalTree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Breadth-First Search/Images/TraversalTree.png
--------------------------------------------------------------------------------
/Depth-First Search/Images/AnimatedExample.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Depth-First Search/Images/AnimatedExample.gif
--------------------------------------------------------------------------------
/Depth-First Search/Images/AnimatedExample.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Depth-First Search/Images/AnimatedExample.psd
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/multinomial.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/multinomial.gif
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/example_graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/example_graph.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/DeleteOneChild.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/DeleteOneChild.graffle
--------------------------------------------------------------------------------
/Binary Search Tree/Images/DeleteTwoChildren.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/DeleteTwoChildren.png
--------------------------------------------------------------------------------
/Binary Search Tree/Images/MinimumMaximum.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/MinimumMaximum.graffle
--------------------------------------------------------------------------------
/Breadth-First Search/Images/AnimatedExample.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Breadth-First Search/Images/AnimatedExample.gif
--------------------------------------------------------------------------------
/Breadth-First Search/Images/AnimatedExample.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Breadth-First Search/Images/AnimatedExample.psd
--------------------------------------------------------------------------------
/Depth-First Search/Images/TraversalTree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Depth-First Search/Images/TraversalTree.graffle
--------------------------------------------------------------------------------
/Fixed Size Array/Images/FixedSizeArrays.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/Images/FixedSizeArrays.graffle
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/code_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/code_example.png
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/tennis_dataset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/tennis_dataset.png
--------------------------------------------------------------------------------
/Rootish Array Stack/images/quadratic_formula.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Rootish Array Stack/images/quadratic_formula.jpg
--------------------------------------------------------------------------------
/Segment Tree/LazyPropagation/Images/pushUp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/LazyPropagation/Images/pushUp.png
--------------------------------------------------------------------------------
/Segment Tree/LazyPropagation/Images/pushdown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/LazyPropagation/Images/pushdown.png
--------------------------------------------------------------------------------
/Shortest Path (Unweighted)/Images/Graph.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Shortest Path (Unweighted)/Images/Graph.graffle
--------------------------------------------------------------------------------
/Topological Sort/Images/TopologicalSort.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Topological Sort/Images/TopologicalSort.graffle
--------------------------------------------------------------------------------
/Bit Set/BitSet.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
3 | var bits = BitSet(size: 140)
4 |
5 | //print(bits)
6 |
7 | print(~UInt64())
8 |
9 | (65 + 64)/64
10 |
--------------------------------------------------------------------------------
/Breadth-First Search/Images/TraversalTree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Breadth-First Search/Images/TraversalTree.graffle
--------------------------------------------------------------------------------
/Depth-First Search/Images/AnimatedExample.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Depth-First Search/Images/AnimatedExample.graffle
--------------------------------------------------------------------------------
/Miller-Rabin Primality Test/Images/img_pseudo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Miller-Rabin Primality Test/Images/img_pseudo.png
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/Images/Graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree(Unweighted)/Images/Graph.png
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/Images/Tree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree(Unweighted)/Images/Tree.png
--------------------------------------------------------------------------------
/Rootish Array Stack/images/quadratic_equation.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Rootish Array Stack/images/quadratic_equation.jpg
--------------------------------------------------------------------------------
/Binary Search Tree/Images/DeleteTwoChildren.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Images/DeleteTwoChildren.graffle
--------------------------------------------------------------------------------
/Breadth-First Search/Images/AnimatedExample.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Breadth-First Search/Images/AnimatedExample.graffle
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/WeightedDirectedGraph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/WeightedDirectedGraph.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/WeightedUndirectedGraph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/WeightedUndirectedGraph.png
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/Images/Graph.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree(Unweighted)/Images/Graph.sketch
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/Images/Tree.graffle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree(Unweighted)/Images/Tree.graffle
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/normal_distribution.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/normal_distribution.gif
--------------------------------------------------------------------------------
/Naive Bayes Classifier/images/standard_deviation.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Naive Bayes Classifier/images/standard_deviation.gif
--------------------------------------------------------------------------------
/Rootish Array Stack/images/RootishArrayStackIntro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Rootish Array Stack/images/RootishArrayStackIntro.png
--------------------------------------------------------------------------------
/Segment Tree/LazyPropagation/Images/Segment-tree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/LazyPropagation/Images/Segment-tree.png
--------------------------------------------------------------------------------
/Segment Tree/LazyPropagation/Images/lazy-sample-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Segment Tree/LazyPropagation/Images/lazy-sample-2.png
--------------------------------------------------------------------------------
/Rootish Array Stack/images/RootishArrayStackExample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Rootish Array Stack/images/RootishArrayStackExample.png
--------------------------------------------------------------------------------
/Union-Find/UnionFind.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/original_adjacency_matrix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/original_adjacency_matrix.png
--------------------------------------------------------------------------------
/All-Pairs Shortest Paths/img/weight_comparison_formula.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/All-Pairs Shortest Paths/img/weight_comparison_formula.png
--------------------------------------------------------------------------------
/Dijkstra Algorithm/Images/WeightedDirectedGraphFinal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Dijkstra Algorithm/Images/WeightedDirectedGraphFinal.png
--------------------------------------------------------------------------------
/Rootish Array Stack/images/RootishArrayStackExample2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Rootish Array Stack/images/RootishArrayStackExample2.png
--------------------------------------------------------------------------------
/Single-Source Shortest Paths (Weighted)/img/example_graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Single-Source Shortest Paths (Weighted)/img/example_graph.png
--------------------------------------------------------------------------------
/Skip-List/SkipList.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/Images/MinimumSpanningTree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree(Unweighted)/Images/MinimumSpanningTree.png
--------------------------------------------------------------------------------
/Union-Find/UnionFind.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Insertion Sort/Tests/InsertionSortTests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 |
3 | class InsertionSortTests: XCTestCase {
4 | func testInsertionSort() {
5 | checkSortAlgorithm(insertionSort)
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/Images/MinimumSpanningTree.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree(Unweighted)/Images/MinimumSpanningTree.sketch
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 1/BinarySearchTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree/MinimumSpanningTree.playground/Resources/mst.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree/MinimumSpanningTree.playground/Resources/mst.png
--------------------------------------------------------------------------------
/Single-Source Shortest Paths (Weighted)/img/negative_cycle_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Single-Source Shortest Paths (Weighted)/img/negative_cycle_example.png
--------------------------------------------------------------------------------
/Selection Sampling/SelectionSampling.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/GCD/GCD.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/B-Tree/BTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Octree/OcTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Queue/Queue.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Stack/Stack.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Hash Set/HashSet.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Multiset/Multiset.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/QuadTree/QuadTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Deque/Deque.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Merge Sort/MergeSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Ordered Set/OrderedSet.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Queue/Queue.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Ring Buffer/RingBuffer.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Splay Tree/SplayTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Stack/Stack.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AVL Tree/AVLTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Binary Search/BinarySearch.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Bit Set/BitSet.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Bloom Filter/BloomFilter.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Insertion Sort/InsertionSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Linear Search/LinearSearch.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Red-Black Tree/RedBlackTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Segment Tree/SegmentTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Selection Sort/SelectionSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Hash Table/HashTable.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Merge Sort/MergeSort.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/QuadTree/QuadTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Quicksort/Quicksort.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Shell Sort/Shell Sort.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Skip-List/SkipList.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Binary Tree/BinaryTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Bloom Filter/BloomFilter.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Depth-First Search/DepthFirstSearch.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Linear Search/LinearSearch.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Linked List/LinkedList.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Ordered Array/OrderedArray.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Ring Buffer/RingBuffer.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Bounded Priority Queue/BoundedPriorityQueue.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Boyer-Moore-Horspool/BoyerMooreHorspool.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Breadth-First Search/BreadthFirstSearch.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Deque/Deque.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Fixed Size Array/FixedSizeArray.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Insertion Sort/InsertionSort.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Kth Largest Element/kthLargest.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Priority Queue/PriorityQueue.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Queue/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Red-Black Tree/RedBlackTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Shortest Path (Unweighted)/ShortestPath.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Stack/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Threaded Binary Tree/ThreadedBinaryTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Tree/Tree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AVL Tree/AVLTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Array2D/Array2D.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 1/BinarySearchTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Bit Set/BitSet.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Count Occurrences/CountOccurrences.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Knuth-Morris-Pratt/KnuthMorrisPratt.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Selection Sampling/SelectionSampling.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Binary Tree/BinaryTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Boyer-Moore-Horspool/BoyerMooreHorspool.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Bubble Sort/BubbleSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Hash Table/HashTable.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Heap Sort/HeapSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Insertion Sort/Tests/Tests.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Linked List/LinkedList.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree/MinimumSpanningTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Quicksort/Quicksort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Radix Sort/RadixSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Rootish Array Stack/RootishArrayStack.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Shell Sort/Shell Sort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Skip-List/SkipList.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Union-Find/UnionFind.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 2/BinarySearchTree.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Bounded Priority Queue/BoundedPriorityQueue.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Counting Sort/CountingSort.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Ordered Array/OrderedArray.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Brute-Force String Search/BruteForceStringSearch.playground/playground.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Fixed Size Array/FixedSizeArray.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Kth Largest Element/kthLargest.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Priority Queue/PriorityQueue.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Count Occurrences/CountOccurrences.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/HaversineDistance/HaversineDistance.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Knuth-Morris-Pratt/KnuthMorrisPratt.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/MinimumSpanningTree(unweighted).playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree/MinimumSpanningTree.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Selection Sampling/SelectionSampling.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Deque/Deque.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Deque/Deque.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/Sources/Randomize.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | public func randomize(n: Int) -> [Int] {
4 | var unsorted = [Int]()
5 | for _ in 0..
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Bit Set/BitSet.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Bit Set/BitSet.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Graph/Graph/Graph.xcodeproj/project.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Graph/Graph/Graph.xcodeproj/project.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Select Minimum Maximum/SelectMinimumMaximum.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Stack/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Stack/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/AVL Tree/AVLTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/AVL Tree/AVLTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Brute-Force String Search/BruteForceStringSearch.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/QuadTree/QuadTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/QuadTree/QuadTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Introsort/Introsort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Quicksort/Quicksort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Quicksort/Quicksort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Rootish Array Stack/RootishArrayStack.playground/contents.xcplayground:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Skip-List/SkipList.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Skip-List/SkipList.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Binary Tree/BinaryTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Tree/BinaryTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Hash Table/HashTable.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Hash Table/HashTable.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Insertion Sort/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Insertion Sort/Tests/Tests.xcodeproj/project.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Linked List/LinkedList.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Linked List/LinkedList.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Merge Sort/MergeSort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Merge Sort/MergeSort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Ring Buffer/RingBuffer.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Ring Buffer/RingBuffer.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Shell Sort/Shell Sort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Shell Sort/Shell Sort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Bloom Filter/BloomFilter.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Bloom Filter/BloomFilter.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Linear Search/LinearSearch.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Linear Search/LinearSearch.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Ordered Array/OrderedArray.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Ordered Array/OrderedArray.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Red-Black Tree/RedBlackTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Red-Black Tree/RedBlackTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Insertion Sort/InsertionSort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Insertion Sort/InsertionSort.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Priority Queue/PriorityQueue.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Priority Queue/PriorityQueue.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Fixed Size Array/FixedSizeArray.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Fixed Size Array/FixedSizeArray.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Kth Largest Element/kthLargest.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Kth Largest Element/kthLargest.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Count Occurrences/CountOccurrences.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Count Occurrences/CountOccurrences.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Knuth-Morris-Pratt/KnuthMorrisPratt.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Knuth-Morris-Pratt/KnuthMorrisPratt.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Rootish Array Stack/RootishArrayStack.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Rootish Array Stack/RootishArrayStack.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Selection Sampling/SelectionSampling.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Selection Sampling/SelectionSampling.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Boyer-Moore-Horspool/BoyerMooreHorspool.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Boyer-Moore-Horspool/BoyerMooreHorspool.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Depth-First Search/DepthFirstSearch.playground/Sources/Edge.swift:
--------------------------------------------------------------------------------
1 | public class Edge: Equatable {
2 | public var neighbor: Node
3 |
4 | public init(_ neighbor: Node) {
5 | self.neighbor = neighbor
6 | }
7 | }
8 |
9 | public func == (_ lhs: Edge, rhs: Edge) -> Bool {
10 | return lhs.neighbor == rhs.neighbor
11 | }
12 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree/MinimumSpanningTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Minimum Spanning Tree/MinimumSpanningTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Bounded Priority Queue/BoundedPriorityQueue.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Bounded Priority Queue/BoundedPriorityQueue.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Breadth-First Search/BreadthFirstSearch.playground/Sources/Edge.swift:
--------------------------------------------------------------------------------
1 | public class Edge: Equatable {
2 | public var neighbor: Node
3 |
4 | public init(_ neighbor: Node) {
5 | self.neighbor = neighbor
6 | }
7 | }
8 |
9 | public func == (_ lhs: Edge, rhs: Edge) -> Bool {
10 | return lhs.neighbor == rhs.neighbor
11 | }
12 |
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 1/BinarySearchTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Solution 1/BinarySearchTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 2/BinarySearchTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Binary Search Tree/Solution 2/BinarySearchTree.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Deque/Deque.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Queue/Queue.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Shortest Path (Unweighted)/ShortestPath.playground/Sources/Edge.swift:
--------------------------------------------------------------------------------
1 | public class Edge: Equatable {
2 | public var neighbor: Node
3 |
4 | public init(neighbor: Node) {
5 | self.neighbor = neighbor
6 | }
7 | }
8 |
9 | public func == (lhs: Edge, rhs: Edge) -> Bool {
10 | return lhs.neighbor == rhs.neighbor
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/Stack/Stack.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/AVL Tree/AVLTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Bit Set/BitSet.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Brute-Force String Search/BruteForceStringSearch.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andyRon/swift-algorithm-club-cn/HEAD/Brute-Force String Search/BruteForceStringSearch.playground/playground.xcworkspace/xcuserdata/andyron.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Graph/Graph/Graph.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Stack/Tests/Tests.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Hash Table/HashTable.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Merge Sort/MergeSort.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/QuadTree/QuadTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Quicksort/Quicksort.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Shell Sort/Shell Sort.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Skip-List/SkipList.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Binary Tree/BinaryTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Bloom Filter/BloomFilter.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Insertion Sort/Tests/Tests.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Linear Search/LinearSearch.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Linked List/LinkedList.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Ordered Array/OrderedArray.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Ring Buffer/RingBuffer.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Fixed Size Array/FixedSizeArray.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Insertion Sort/InsertionSort.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Kth Largest Element/kthLargest.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/MinimumSpanningTree(unweighted).playground/Sources/Edge.swift:
--------------------------------------------------------------------------------
1 | public class Edge: Equatable {
2 | public var neighbor: Node
3 |
4 | public init(neighbor: Node) {
5 | self.neighbor = neighbor
6 | }
7 | }
8 |
9 | public func == (lhs: Edge, rhs: Edge) -> Bool {
10 | return lhs.neighbor == rhs.neighbor
11 | }
12 |
--------------------------------------------------------------------------------
/Priority Queue/PriorityQueue.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Red-Black Tree/RedBlackTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Count Occurrences/CountOccurrences.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Knuth-Morris-Pratt/KnuthMorrisPratt.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Linear Search/LinearSearch.swift:
--------------------------------------------------------------------------------
1 | func linearSearch(_ array: [T], _ object: T) -> Int? {
2 | for (index, obj) in array.enumerated() where obj == object {
3 | return index
4 | }
5 | return nil
6 | }
7 |
8 | func linearSearch1(_ array: [T], _ object: T) -> Array.Index? {
9 | return array.index { $0 == object }
10 | }
11 |
--------------------------------------------------------------------------------
/Selection Sampling/SelectionSampling.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Boyer-Moore-Horspool/BoyerMooreHorspool.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree/MinimumSpanningTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Rootish Array Stack/RootishArrayStack.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 1/BinarySearchTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 2/BinarySearchTree.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Bounded Priority Queue/BoundedPriorityQueue.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Brute-Force String Search/BruteForceStringSearch.playground/playground.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph/Graph.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SUMMARY.md:
--------------------------------------------------------------------------------
1 |
2 | # Swift 算法俱乐部
3 |
4 | * [双端队列](Deque/README.md)
5 | * [二维数组](Array2D/README.md)
6 | * [图](Graph/README.md)
7 |
8 | ## 数据结构
9 |
10 | ### 数组变体
11 | - [二维数组](Array2D/)
12 | - [固定大小数组](Fixed%20Size%20Array/)
13 |
14 | ### 队列
15 | - [栈](Stack/)
16 | - [队列](Queue/)
17 |
18 | ## 算法列表
19 |
20 |
21 | ### 搜索算法
22 | - [线性搜索](Linear%20Search/)
23 | - [二分搜索](Binary%20Search/README.md)
24 |
--------------------------------------------------------------------------------
/Bubble Sort/BubbleSort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | func bubbleSort(_ numbers: [Int]) -> [Int]{
3 |
4 | var nums = numbers
5 | let n = nums.count
6 | for i in 0.. nums[j + 1] {
9 | nums.swapAt(j, j + 1)
10 | }
11 | }
12 | }
13 | return nums
14 | }
15 |
16 | let nums = [3,42,1,5,34,20,9]
17 | bubbleSort(nums)
18 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph.xcodeproj/xcuserdata/andyron.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Graph.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/B-Tree/BTree.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | // last checked with Xcode 10.0
4 |
5 | let bTree = BTree(order: 1)!
6 |
7 | bTree.insert(1, for: 1)
8 | bTree.insert(2, for: 2)
9 | bTree.insert(3, for: 3)
10 | bTree.insert(4, for: 4)
11 |
12 | bTree.value(for: 3)
13 | bTree[3]
14 |
15 | bTree.remove(2)
16 |
17 | bTree.traverseKeysInOrder { key in
18 | print(key)
19 | }
20 |
21 | bTree.numberOfKeys
22 |
23 | bTree.order
24 |
25 | bTree.inorderArrayFromKeys
26 |
--------------------------------------------------------------------------------
/Insertion Sort/Tests/Tests.xcodeproj/xcuserdata/andyron.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Tests.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 11
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Linear Search/LinearSearch.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
3 | func linearSearch(_ array: [T], _ object: T) -> Int? {
4 | for (index, obj) in array.enumerated() where obj == object {
5 | return index
6 | }
7 | return nil
8 | }
9 | /*
10 | 使用尾随闭包简写
11 | */
12 | func linearSearch1(_ array: [T], _ object: T) -> Int? {
13 | return array.index { $0 == object }
14 | }
15 |
16 | linearSearch([2,5,3,12,7,8], 12)
17 |
18 | linearSearch1([2,5,3,12,7,8], 7)
19 |
--------------------------------------------------------------------------------
/QuadTree/QuadTree.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | let tree = QuadTree(rect: Rect(origin: Point(0, 0), size: Size(xLength: 10, yLength: 10)))
4 |
5 | for _ in 0..<40 {
6 | let randomX = Double(arc4random_uniform(100)) / 10
7 | let randomY = Double(arc4random_uniform(100)) / 10
8 | let point = Point(randomX, randomY)
9 | tree.add(point: point)
10 | }
11 |
12 | print(tree)
13 | print(tree.points(inRect: Rect(origin: Point(1, 1), size: Size(xLength: 5, yLength: 5))))
14 |
--------------------------------------------------------------------------------
/What are Algorithms.markdown:
--------------------------------------------------------------------------------
1 | # 什么是算法和数据结构?
2 |
3 | 一个算法就像一张教计算机“烹饪”的“食谱”。如果你了解做菜的过程,你就能理解算法的定义。
4 |
5 | 下面有一张关于[制作薄饼的食谱](http://allrecipes.com/recipe/21014/good-old-fashioned-pancakes/):
6 |
7 | 1. 在一个大碗里,将面粉,发酵粉,盐和糖过筛。
8 | 2. 加入牛奶、鸡蛋和融化了的奶油。
9 | 3. 搅拌混合直至丝柔顺滑。
10 | 4. 中火加热平底锅。
11 | 5. 将搅拌好的面糊缓慢倒入锅中,每个薄饼大概用1/4杯的面糊即可。
12 | 6. 薄饼两面都呈黄褐色即可出锅享用了。
13 |
14 | 这张食谱由一系列的步骤组成,你只需一步接一步按照指令来就可以了。算法也是如此,只不过它的指令是交给计算机去执行的,而不是厨师。
15 |
16 | 这些原料(面粉、牛奶、鸡蛋、黄油等)相当于算法中的待处理数据。这些原始数据(各种不同的原料)作为算法的输入,输出的数据(好吃的薄饼)即是结果。
17 |
18 | 那么数据结构是什么?它们是在算法运行时保存数据的容器。例如,在煎饼配方中,数据结构是用于盛放面粉的袋子,是用于将所有东西组合在一起的搅拌碗,是用于煎饼的煎锅,是最后用于盛放成品煎饼的盘子。
--------------------------------------------------------------------------------
/Heap Sort/HeapSort.swift:
--------------------------------------------------------------------------------
1 | /// Heap 见 https://github.com/andyRon/swift-algorithm-club-cn/blob/master/Heap/Heap.swift
2 | extension Heap {
3 | public mutating func sort() -> [T] {
4 | for i in stride(from: (nodes.count - 1), through: 1, by: -1) {
5 | nodes.swaptAt(0, i)
6 | shiftDown(from: 0, until: i)
7 | }
8 | return nodes
9 | }
10 | }
11 |
12 | public func heapsort(_ a: [T], _ sort: @escaping (T, T) -> Bool) -> [T] {
13 | let reverseOrder = {i1, i2 in sort(i2, i1) }
14 | var h = Heap(array: a, sort: reverseOrder)
15 | return h.sort()
16 | }
17 |
--------------------------------------------------------------------------------
/Insertion Sort/InsertionSort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | /*
2 | 插入排序
3 | */
4 | public func insertionSort(_ array: [T], _ isOrderedBefore: (T, T) -> Bool) -> [T] {
5 | var a = array
6 | for x in 1.. 0 && isOrderedBefore(temp, a[y-1]) {
10 | a[y] = a[y-1]
11 | y -= 1
12 | }
13 | a[y] = temp
14 | }
15 | return a
16 | }
17 |
18 |
19 | let numbers = [ 10, -1, 3, 9, 2, 27, 8, 5, 1, 3, 0, 26 ]
20 | insertionSort(numbers, <)
21 | insertionSort(numbers, >)
22 |
23 | let strings = [ "b", "a", "d", "c", "e" ]
24 | insertionSort(strings, <)
25 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Splay Tree/SplayTree.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | let splayTree = SplayTree(value: 1)
3 | splayTree.insert(value: 2)
4 | splayTree.insert(value: 10)
5 | splayTree.insert(value: 6)
6 |
7 | splayTree.remove(value: 10)
8 | splayTree.remove(value: 6)
9 |
10 | splayTree.insert(value: 55)
11 | splayTree.insert(value: 559)
12 | splayTree.remove(value: 2)
13 | splayTree.remove(value: 1)
14 | splayTree.remove(value: 55)
15 | splayTree.remove(value: 559)
16 |
17 | splayTree.insert(value: 1843000)
18 | splayTree.insert(value: 1238)
19 | splayTree.insert(value: -1)
20 | splayTree.insert(value: 87)
21 |
22 | splayTree.minimum()
23 | splayTree.maximum()
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Shortest Path (Unweighted)/ShortestPath.playground/Sources/Queue.swift:
--------------------------------------------------------------------------------
1 | public struct Queue {
2 | private var array: [T]
3 |
4 | public init() {
5 | array = []
6 | }
7 |
8 | public var isEmpty: Bool {
9 | return array.isEmpty
10 | }
11 |
12 | public var count: Int {
13 | return array.count
14 | }
15 |
16 | public mutating func enqueue(element: T) {
17 | array.append(element)
18 | }
19 |
20 | public mutating func dequeue() -> T? {
21 | if isEmpty {
22 | return nil
23 | } else {
24 | return array.removeFirst()
25 | }
26 | }
27 |
28 | public func peek() -> T? {
29 | return array.first
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Red-Black Tree/RedBlackTree.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Breadth-First Search/BreadthFirstSearch.playground/Sources/Queue.swift:
--------------------------------------------------------------------------------
1 | public struct Queue {
2 | private var array: [T]
3 |
4 | public init() {
5 | array = []
6 | }
7 |
8 | public var isEmpty: Bool {
9 | return array.isEmpty
10 | }
11 |
12 | public var count: Int {
13 | return array.count
14 | }
15 |
16 | public mutating func enqueue(_ element: T) {
17 | array.append(element)
18 | }
19 |
20 | public mutating func dequeue() -> T? {
21 | if isEmpty {
22 | return nil
23 | } else {
24 | return array.removeFirst()
25 | }
26 | }
27 |
28 | public func peek() -> T? {
29 | return array.first
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/MinimumSpanningTree(unweighted).playground/Sources/Queue.swift:
--------------------------------------------------------------------------------
1 | public struct Queue {
2 | private var array: [T]
3 |
4 | public init() {
5 | array = []
6 | }
7 |
8 | public var isEmpty: Bool {
9 | return array.isEmpty
10 | }
11 |
12 | public var count: Int {
13 | return array.count
14 | }
15 |
16 | public mutating func enqueue(_ element: T) {
17 | array.append(element)
18 | }
19 |
20 | public mutating func dequeue() -> T? {
21 | if isEmpty {
22 | return nil
23 | } else {
24 | return array.removeFirst()
25 | }
26 | }
27 |
28 | public func peek() -> T? {
29 | return array.first
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Selection Sort/SelectionSort.swift:
--------------------------------------------------------------------------------
1 |
2 | public func selectionSort(_ array: [T], _ isOrderedBefore: (T, T) -> Bool) -> [T] {
3 | guard array.count > 1 else { return array }
4 |
5 | var a = array
6 | for x in 0 ..< a.count - 1 {
7 |
8 | // Find the lowest value in the rest of the array.
9 | var lowest = x
10 | for y in x + 1 ..< a.count {
11 | if isOrderedBefore(a[y], a[lowest]) {
12 | lowest = y
13 | }
14 | }
15 |
16 | // Swap the lowest value with the current array index.
17 | if x != lowest {
18 | a.swapAt(x, lowest)
19 | }
20 | }
21 | return a
22 | }
23 |
--------------------------------------------------------------------------------
/Select Minimum Maximum/SelectMinimumMaximum.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Binary Search Tree/Solution 1/BinarySearchTree.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Selection Sort/SelectionSort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | func selectionSort(_ array: [Int]) -> [Int] {
3 | guard array.count > 1 else {
4 | return array
5 | }
6 |
7 | var a = array
8 |
9 | for x in 0 ..< a.count - 1 {
10 | var lowest = x
11 | for y in x+1 ..< a.count {
12 | if a[y] < a[lowest] {
13 | lowest = y
14 | }
15 | }
16 |
17 | if x != lowest {
18 | a.swapAt(x, lowest)
19 | }
20 | }
21 | return a
22 | }
23 |
24 | let list = [ 10, -1, 3, 9, 2, 27, 8, 5, 1, 3, 0, 26 ]
25 | selectionSort(list)
26 |
27 | var l = [ 10, -1, 3, 9, 2, 27, 8, 5, 1, 3, 0, 26 ]
28 | l.swapAt(1, 1)
29 |
30 |
31 |
--------------------------------------------------------------------------------
/GCD/GCD.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | gcd(52, 39) // 13
2 | gcd(228, 36) // 12
3 | gcd(51357, 3819) // 57
4 | gcd(841, 299) // 1
5 |
6 | gcd(52, 39, using: gcdRecursiveEuklid) // 13
7 | gcd(228, 36, using: gcdRecursiveEuklid) // 12
8 | gcd(51357, 3819, using: gcdRecursiveEuklid) // 57
9 | gcd(841, 299, using: gcdRecursiveEuklid) // 1
10 |
11 | gcd(52, 39, using: gcdBinaryRecursiveStein) // 13
12 | gcd(228, 36, using: gcdBinaryRecursiveStein) // 12
13 | gcd(51357, 3819, using: gcdBinaryRecursiveStein) // 57
14 | gcd(841, 299, using: gcdBinaryRecursiveStein) // 1
15 |
16 | do {
17 | try lcm(2, 3) // 6
18 | try lcm(10, 8, using: gcdRecursiveEuklid) // 40
19 | } catch {
20 | dump(error)
21 | }
22 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/Sources/Sort3.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | public func sort3(in array: inout [T], a: Int, b: Int, c: Int, by areInIncreasingOrder: (T, T) -> Bool) {
4 | switch (areInIncreasingOrder(array[b], array[a]),
5 | areInIncreasingOrder(array[c], array[b])) {
6 | case (false, false): break
7 | case (true, true): array.swapAt(a, c)
8 | case (true, false):
9 | array.swapAt(a, b)
10 |
11 | if areInIncreasingOrder(array[c], array[b]) {
12 | array.swapAt(b, c)
13 | }
14 | case (false, true):
15 | array.swapAt(b, c)
16 |
17 | if areInIncreasingOrder(array[b], array[a]) {
18 | array.swapAt(a, b)
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Red-Black Tree/RedBlackTree.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | let redBlackTree = RedBlackTree()
4 |
5 | let randomMax = Double(0x10000000)
6 | var values = [Double]()
7 | for i in 0..<1000 {
8 | let value = Double(arc4random()) / randomMax
9 | values.append(value)
10 | redBlackTree.insert(key: value)
11 |
12 | if i % 100 == 0 {
13 | redBlackTree.verify()
14 | }
15 | }
16 | redBlackTree.verify()
17 |
18 | for i in 0..<1000 {
19 | let rand = arc4random_uniform(UInt32(values.count))
20 | let index = Int(rand)
21 | let value = values.remove(at: index)
22 | redBlackTree.delete(key: value)
23 |
24 | if i % 100 == 0 {
25 | redBlackTree.verify()
26 | }
27 | }
28 | redBlackTree.verify()
29 |
--------------------------------------------------------------------------------
/Bubble Sort/README_en.markdown:
--------------------------------------------------------------------------------
1 | # Bubble Sort
2 |
3 | Bubble sort is a sorting algorithm that is implemented by starting in the beginning of the array and swapping the first two elements only if the first element is greater than the second element. This comparison is then moved onto the next pair and so on and so forth. This is done until the array is completely sorted. The smaller items slowly “bubble” up to the beginning of the array.
4 |
5 | ##### Runtime:
6 | - Average: O(N^2)
7 | - Worst: O(N^2)
8 |
9 | ##### Memory:
10 | - O(1)
11 |
12 | ### Implementation:
13 |
14 | The implementation will not be shown as the average and worst runtimes show that this is a very inefficient algorithm. However, having a grasp of the concept will help you understand the basics of simple sorting algorithms.
15 |
--------------------------------------------------------------------------------
/Queue/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Stack/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Insertion Sort/Tests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Brute-Force String Search/BruteForceStringSearch.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | extension String {
3 | func indexOf(_ pattern: String) -> String.Index? {
4 |
5 | for i in self.indices {
6 | var j = i
7 | var found = true
8 | for p in pattern.indices {
9 | if j == self.endIndex || self[j] != pattern[p] {
10 | found = false
11 | break
12 | } else {
13 | j = self.index(after: j)
14 | }
15 | }
16 | if found {
17 | return i
18 | }
19 | }
20 | return nil
21 | }
22 | }
23 |
24 |
25 | let s = "Hello, World"
26 | s.indexOf("orl")?.encodedOffset
27 |
28 | let animals = "🦍🐢🐡🐮🦖🐋🐶🐬🐠🐔🐷🐙🐮🦟🦂🦜🦢🐨🦇🐐🦓"
29 | animals.indexOf("🐮")?.encodedOffset
30 |
31 |
--------------------------------------------------------------------------------
/Shell Sort/Shell Sort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
3 | public func insertSort(_ list: inout[Int], start: Int, gap: Int) {
4 | for i in stride(from: (start + gap), to: list.count, by: gap) {
5 | let currentValue = list[i]
6 | var pos = i
7 | while pos >= gap && list[pos - gap] > currentValue {
8 | list[pos] = list[pos - gap]
9 | pos -= gap
10 | }
11 | list[pos] = currentValue
12 | }
13 | }
14 |
15 | public func shellSort(_ list: inout [Int]) {
16 | var sublistCount = list.count / 2
17 | while sublistCount > 0 {
18 | for pos in 0 ..< sublistCount {
19 | insertSort(&list, start: pos, gap: sublistCount)
20 | }
21 | sublistCount = sublistCount / 2
22 | }
23 | }
24 |
25 | var arr = [34, 32, 50, 23, 73, 2, -1, 42, 31, 5]
26 |
27 | shellSort(&arr)
28 |
29 | print(arr)
30 |
--------------------------------------------------------------------------------
/Queue/Queue-Simple.swift:
--------------------------------------------------------------------------------
1 | /*
2 | First-in first-out queue (FIFO)
3 |
4 | New elements are added to the end of the queue. Dequeuing pulls elements from
5 | the front of the queue.
6 |
7 | Enqueuing is an O(1) operation, dequeuing is O(n). Note: If the queue had been
8 | implemented with a linked list, then both would be O(1).
9 | */
10 | public struct Queue {
11 | fileprivate var array = [T]()
12 |
13 | public var count: Int {
14 | return array.count
15 | }
16 |
17 | public var isEmpty: Bool {
18 | return array.isEmpty
19 | }
20 |
21 | public mutating func enqueue(_ element: T) {
22 | array.append(element)
23 | }
24 |
25 | public mutating func dequeue() -> T? {
26 | if isEmpty {
27 | return nil
28 | } else {
29 | return array.removeFirst()
30 | }
31 | }
32 |
33 | public var front: T? {
34 | return array.first
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Bubble Sort/README.markdown:
--------------------------------------------------------------------------------
1 | # 冒泡排序(Bubble Sort)
2 |
3 |
4 | 冒泡排序是一种排序算法,它通过重复地走过过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来,这样做直到数组完全排序。 较小的项慢慢地“冒泡”到数组的开头。
5 |
6 |
7 | ##### Runtime:
8 |
9 | - 平均: O(N^2)
10 | - 最差: O(N^2)
11 |
12 | ##### 内存
13 |
14 | - O(1)
15 |
16 | ### 实现
17 |
18 | 平均和最差运行时间表明冒泡排序是一种非常低效的算法,因此不会显示实现。 但是,掌握这个概念将有助于您理解简单排序算法的基础知识。
19 |
20 | > 译注: [冒泡排序的动画](http://www.algomation.com/player?algorithm=5a1b2f0711aaf40400e46699)
21 | 原文没有对冒泡排序实现,处于学习的目的,我自己实现了一下:
22 |
23 | ```
24 |
25 | func bubbleSort(_ numbers: [Int]) -> [Int]{
26 |
27 | var nums = numbers
28 | let n = nums.count
29 | for i in 0.. nums[j + 1] {
32 | nums.swapAt(j, j + 1)
33 | }
34 | }
35 | }
36 | return nums
37 | }
38 |
39 | let nums = [3,42,1,5,34,20,9]
40 | bubbleSort(nums)
41 |
42 | ```
43 |
--------------------------------------------------------------------------------
/Multiset/Multiset.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | var set = Multiset()
3 |
4 | set.add("Foo")
5 | set.add("Foo")
6 | set.add("Bar")
7 | set.add("Baz")
8 |
9 | set.count
10 | set.count(for: "Foo")
11 |
12 | set.allItems
13 |
14 | var set2 = Multiset()
15 | set2.add("Foo")
16 | set2.add("Foo")
17 |
18 | set2.isSubSet(of: set) // true
19 | set.isSubSet(of: set2) // false
20 |
21 | // Convenience constructor: pass a Collection of Hashables to the constructor
22 | var cacti = Multiset("cacti")
23 | cacti.allItems
24 | var tactical = Multiset("tactical")
25 | cacti.isSubSet(of: tactical) // true
26 | tactical.isSubSet(of: cacti) // false
27 |
28 | // Test ExpressibleByArrayLiteral protocol
29 | let set3: Multiset = ["foo", "bar"]
30 | set3.count(for: "foo")
31 |
32 | // Test Equatable protocol
33 | let set4 = Multiset(set3.allItems)
34 | set4 == set3 // true
35 | set4 == set // false
36 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph/Vertex.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Vertex.swift
3 | // Graph
4 | //
5 | // Created by Andy Ron on 2018/11/9.
6 | // Copyright © 2018 Andy Ron. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | public struct Vertex: Equatable where T: Hashable {
12 |
13 | public var data: T
14 | public let index: Int
15 |
16 | }
17 |
18 | extension Vertex: CustomStringConvertible {
19 |
20 | public var description: String {
21 | return "\(index): \(data)"
22 | }
23 | }
24 |
25 | extension Vertex: Hashable {
26 |
27 | public var hashValue: Int {
28 | return "\(data)\(index)".hashValue
29 | }
30 | }
31 |
32 | public func ==(lhs: Vertex, rhs: Vertex) -> Bool {
33 | guard lhs.index == rhs.index else {
34 | return false
35 | }
36 |
37 | guard lhs.data == rhs.data else {
38 | return false
39 | }
40 |
41 | return true
42 | }
43 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph.xcodeproj/xcuserdata/andyron.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/Sources/InsertionSort.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 |
3 | public func insertionSort(for array: inout [T], range: Range, by areInIncreasingOrder: (T, T) -> Bool) {
4 | guard !range.isEmpty else { return }
5 |
6 | let start = range.lowerBound
7 | var sortedEnd = start
8 |
9 | array.formIndex(after: &sortedEnd)
10 | while sortedEnd != range.upperBound {
11 | let x = array[sortedEnd]
12 |
13 | var i = sortedEnd
14 | repeat {
15 | let predecessor = array[array.index(before: i)]
16 |
17 | guard areInIncreasingOrder(x, predecessor) else { break }
18 | array[i] = predecessor
19 | array.formIndex(before: &i)
20 | } while i != start
21 |
22 | if i != sortedEnd {
23 | array[i] = x
24 | }
25 | array.formIndex(after: &sortedEnd)
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/Algorithm Design.markdown:
--------------------------------------------------------------------------------
1 | # 算法设计技巧
2 |
3 | 当你遇到新问题的时候,需要寻找新的算法。
4 |
5 | ### 是否有类似的其它问题?
6 |
7 | 如果您可以根据另一个更普遍的问题来构建解决你目前需要解决问题,那么您可以使用现有算法。 为什么重新发明轮子?
8 |
9 | 我喜欢Steven Skiena的[算法设计手册](http://www.algorist.com),它包含了一系列可以尝试的问题和解决方案。(另见Steven Skiena的[算法库](http://www3.cs.stonybrook.edu/~algorith/))
10 |
11 | > 译注:豆瓣 [算法设计手册](https://book.douban.com/subject/4048566/)
12 |
13 | ### 可以从暴力方案开始
14 |
15 | 原始而暴力的解决方案通常对实际使用而言太慢,但它们是一个很好的起点。 通过编写暴力解决方案,您将学习如何理解问题的真正含义。
16 |
17 | 一旦你有一个暴力实施方案,就可以使用它来验证你提出的任何改进是否正确的。
18 |
19 | 如果您只使用小型数据集,那么暴力方法实际上可能足够好。 不要陷入过早优化的陷阱!
20 |
21 | ### 分而治之
22 |
23 | > “当你改变你看待事物的方式时,你看到的东西会发生变化。”
24 | > —— 马克斯·普朗克,量子物理学家和诺贝尔奖获得者
25 |
26 | 分而治之是一种处理大问题的方法,将其分解成碎片并逐步向解决方案迈进。
27 |
28 | 不是将整个问题看作一个单一,庞大而复杂的任务,而是将问题分成相对较小的问题,这样问题更容易理解和处理。
29 |
30 | 您可以解决较小的问题并聚合解决方案,直到您只使用解决方案。 在每个步骤中,手头的问题都会缩小,解决方案会变得成熟,直到您拥有最终正确的解决方案。
31 | 将问题分解为规模更小的子问题,将这些规模更小的子问题逐个击破,然后将已解决的子问题合并,最终得出“母”问题的解。
32 |
33 | 将相同的解决方案重复地(或经常递归地)应用于解决较小的任务,从而在更短的时间内获得结果。
34 |
--------------------------------------------------------------------------------
/Octree/README.md:
--------------------------------------------------------------------------------
1 | # 八叉树(Octree)
2 |
3 | 八叉树是[树](../Tree),其中每个内部(非叶节点)节点有八个子节点。 例如,通常用于游戏中的碰撞检测。
4 |
5 | ### 问题
6 |
7 |
8 | 考虑以下问题:您需要在3D空间中存储多个对象(每个对象在某个位置使用`X`,`Y`和`Z`坐标表示)然后您需要回答哪些对象位于某个3D区域。 一个天真的解决方案是将点存储在一个数组中,然后迭代这些点并分别检查每个点。 该解决方案花费O(n)。
9 |
10 | ### 更好的方法
11 |
12 | 八叉树最常用于通过递归地将其细分为8个区域来划分三维空间。 让我们看看我们如何使用八叉树来存储一些值。
13 |
14 | 树中的每个节点代表一个类似盒子的区域。 叶节点在该区域中存储单个点,并为该点分配一组对象。
15 |
16 | 一旦添加了同一区域内(但在不同点)的对象,叶节点就会变成一个内部节点,并向它添加8个子节点(叶节点)。 先前包含在节点中的所有点都将传递给其对应的子节点并进行存储。 因此,只有叶子包含实际的点和值。
17 |
18 | 为了找到位于给定区域中的点,我们现在可以从上到下遍历树并从节点收集合适的点。
19 |
20 | 在最坏的情况下,添加点和搜索仍然可以占用O(n),因为树不以任何方式平衡。 但是,平均而言,它的运行速度明显更快(与O(log n)相当)。
21 |
22 | ### 扩展阅读
23 |
24 | [八叉树的维基百科](https://en.wikipedia.org/wiki/Octree)
25 | 苹果公司的八叉树实现[GKOctree](https://developer.apple.com/documentation/gameplaykit/gkoctree)
26 |
27 |
28 | *作者:Jaap Wijnen*
29 | *灵感来自于Timur Galimov和苹果公司的八叉树实现*
30 | *翻译:[Andy Ron](https://github.com/andyRon)*
31 | *校对:[Andy Ron](https://github.com/andyRon)*
32 |
33 |
--------------------------------------------------------------------------------
/Depth-First Search/DepthFirstSearch.playground/Sources/Node.swift:
--------------------------------------------------------------------------------
1 | public class Node: CustomStringConvertible, Equatable {
2 | public var neighbors: [Edge]
3 |
4 | public private(set) var label: String
5 | public var distance: Int?
6 | public var visited: Bool
7 |
8 | public init(_ label: String) {
9 | self.label = label
10 | neighbors = []
11 | visited = false
12 | }
13 |
14 | public var description: String {
15 | if let distance = distance {
16 | return "Node(label: \(label), distance: \(distance))"
17 | }
18 | return "Node(label: \(label), distance: infinity)"
19 | }
20 |
21 | public var hasDistance: Bool {
22 | return distance != nil
23 | }
24 |
25 | public func remove(_ edge: Edge) {
26 | neighbors.remove(at: neighbors.index { $0 === edge }!)
27 | }
28 | }
29 |
30 | public func == (_ lhs: Node, rhs: Node) -> Bool {
31 | return lhs.label == rhs.label && lhs.neighbors == rhs.neighbors
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/Shortest Path (Unweighted)/ShortestPath.playground/Sources/Node.swift:
--------------------------------------------------------------------------------
1 | public class Node: CustomStringConvertible, Equatable {
2 | public var neighbors: [Edge]
3 |
4 | public private(set) var label: String
5 | public var distance: Int?
6 | public var visited: Bool
7 |
8 | public init(label: String) {
9 | self.label = label
10 | neighbors = []
11 | visited = false
12 | }
13 |
14 | public var description: String {
15 | if let distance = distance {
16 | return "Node(label: \(label), distance: \(distance))"
17 | }
18 | return "Node(label: \(label), distance: infinity)"
19 | }
20 |
21 | public var hasDistance: Bool {
22 | return distance != nil
23 | }
24 |
25 | public func remove(edge: Edge) {
26 | neighbors.remove(at: neighbors.index { $0 === edge }!)
27 | }
28 | }
29 |
30 | public func == (lhs: Node, rhs: Node) -> Bool {
31 | return lhs.label == rhs.label && lhs.neighbors == rhs.neighbors
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/Breadth-First Search/BreadthFirstSearch.playground/Sources/Node.swift:
--------------------------------------------------------------------------------
1 | public class Node: CustomStringConvertible, Equatable {
2 | public var neighbors: [Edge]
3 |
4 | public private(set) var label: String
5 | public var distance: Int?
6 | public var visited: Bool
7 |
8 | public init(_ label: String) {
9 | self.label = label
10 | neighbors = []
11 | visited = false
12 | }
13 |
14 | public var description: String {
15 | if let distance = distance {
16 | return "Node(label: \(label), distance: \(distance))"
17 | }
18 | return "Node(label: \(label), distance: infinity)"
19 | }
20 |
21 | public var hasDistance: Bool {
22 | return distance != nil
23 | }
24 |
25 | public func remove(_ edge: Edge) {
26 | neighbors.remove(at: neighbors.index { $0 === edge }!)
27 | }
28 | }
29 |
30 | public func == (_ lhs: Node, rhs: Node) -> Bool {
31 | return lhs.label == rhs.label && lhs.neighbors == rhs.neighbors
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/HaversineDistance/HaversineDistance.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 |
3 |
4 | func HaversineDistance(la1: Double, lo1: Double, la2: Double, lo2: Double, radius: Double = 6367444.7) -> Double {
5 |
6 | let haversine = { (angle: Double) -> Double in
7 | return (1 - cos(angle))/2
8 | }
9 |
10 | let ahaversin = { (angle: Double) -> Double in
11 | return 2*asin(sqrt(angle))
12 | }
13 |
14 | let dToR = { (angle: Double) -> Double in
15 | return (angle / 360) * 2 * .pi
16 | }
17 |
18 | let lat1 = dToR(la1)
19 | let lon1 = dToR(lo1)
20 | let lat2 = dToR(la2)
21 | let lon2 = dToR(lo2)
22 |
23 | return radius * ahaversin(haversine(lat2 - lat1) + cos(lat1) * cos(lat2) * haversine(lon2 - lon1))
24 | }
25 |
26 |
27 | let amsterdam = (52.3702, 4.8952)
28 | let newYork = (40.7128, -74.0059)
29 |
30 | HaversineDistance(la1: amsterdam.0, lo1: amsterdam.1, la2: newYork.0, lo2: newYork.1)
31 |
32 |
--------------------------------------------------------------------------------
/Minimum Spanning Tree(Unweighted)/MinimumSpanningTree(unweighted).playground/Sources/Node.swift:
--------------------------------------------------------------------------------
1 | public class Node: CustomStringConvertible, Equatable {
2 | public var neighbors: [Edge]
3 |
4 | public private(set) var label: String
5 | public var distance: Int?
6 | public var visited: Bool
7 |
8 | public init(label: String) {
9 | self.label = label
10 | neighbors = []
11 | visited = false
12 | }
13 |
14 | public var description: String {
15 | if let distance = distance {
16 | return "Node(label: \(label), distance: \(distance))"
17 | }
18 | return "Node(label: \(label), distance: infinity)"
19 | }
20 |
21 | public var hasDistance: Bool {
22 | return distance != nil
23 | }
24 |
25 | public func remove(_ edge: Edge) {
26 | neighbors.remove(at: neighbors.index { $0 === edge }!)
27 | }
28 | }
29 |
30 | public func == (lhs: Node, rhs: Node) -> Bool {
31 | return lhs.label == rhs.label && lhs.neighbors == rhs.neighbors
32 | }
33 |
--------------------------------------------------------------------------------
/Hash Set/HashSet.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | var set = HashSet()
2 |
3 | set.insert("one")
4 | set.insert("two")
5 | set.insert("three")
6 | set.allElements()
7 |
8 | set.insert("two")
9 | set.allElements()
10 |
11 | set.contains("one")
12 | set.remove("one")
13 | set.allElements()
14 | set.contains("one")
15 |
16 | /* Union */
17 |
18 | var setA = HashSet()
19 | setA.insert(1)
20 | setA.insert(2)
21 | setA.insert(3)
22 | setA.insert(4)
23 |
24 | var setB = HashSet()
25 | setB.insert(3)
26 | setB.insert(4)
27 | setB.insert(5)
28 | setB.insert(6)
29 |
30 | let union = setA.union(setB)
31 | union.allElements() // [5, 6, 2, 3, 1, 4]
32 |
33 | /* Intersection */
34 |
35 | let intersection = setA.intersect(setB)
36 | intersection.allElements() // [3, 4]
37 |
38 | /* Difference */
39 |
40 | let difference1 = setA.difference(setB)
41 | difference1.allElements() // [2, 1]
42 |
43 | let difference2 = setB.difference(setA)
44 | difference2.allElements() // [5, 6]
45 |
--------------------------------------------------------------------------------
/Priority Queue/PriorityQueue.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
3 | public struct PriorityQueue {
4 | fileprivate var heap: Heap
5 |
6 | public init(sort: @escaping (T, T) -> Bool) {
7 | heap = Heap(sort: sort)
8 | }
9 |
10 | public var isEmpty: Bool {
11 | return heap.isEmpty
12 | }
13 |
14 | public var count: Int {
15 | return heap.count
16 | }
17 |
18 | public func peak() -> T? {
19 | return heap.peek()
20 | }
21 |
22 | public mutating func enqueue(_ element: T) {
23 | heap.insert(element)
24 | }
25 |
26 | public mutating func dequeue() -> T? {
27 | return heap.remove()
28 | }
29 |
30 | public mutating func changePriority(index i: Int, value: T) {
31 | return heap.replace(index: i, value: value)
32 | }
33 | }
34 |
35 | extension PriorityQueue where T: Equatable {
36 | public func index(of element: T) -> Int? {
37 | return heap.index(of: element)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Introsort/Introsort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
3 | func introsort(_ array: inout [T], by areInIncreasingOrder: (T, T) -> Bool) {
4 |
5 | }
6 |
7 | private func introSortImplementation(for array: inout [T], range: Range, depthLimit: Int, by areInIncreasingOrder: (T, T) -> Bool) {
8 |
9 | if array.distance(from: range.lowerBound, to: range.upperBound) < 20 {
10 |
11 | insertionSort(for: &array, range: range, by: areInIncreasingOrder)
12 | } else if depthLimit == 0 {
13 |
14 | heapsort(for: &array, range: range, by: areInIncreasingOrder)
15 | } else {
16 |
17 | let partIdx = partitionIndex(for: &array, subRange: range, by: areInIncreasingOrder)
18 |
19 | introSortImplementation(for: &array, range: range.lowerBound..(boundingBox: box, minimumCellSize: 5.0)
8 | var five = octree.add(5, at: vector_double3(3,4,8))
9 | octree.add(8, at: vector_double3(3,4,8.2))
10 | octree.add(10, at: vector_double3(3,4,8.2))
11 | octree.add(7, at: vector_double3(2,5,8))
12 | octree.add(2, at: vector_double3(1,6,7))
13 |
14 | var cont = octree.elements(at: vector_double3(3,4,8.2))
15 | octree.remove(8)
16 | octree.elements(at: vector_double3(3,4,8))
17 |
18 | let boxMin2 = vector_double3(1,3,7)
19 | let boxMax2 = vector_double3(4,9,8)
20 | let box2 = Box(boxMin: boxMin2, boxMax: boxMax2)
21 | box.isContained(in: box2)
22 | box.intersects(box2)
23 |
24 | let boxMin3 = vector_double3(3,8,8)
25 | let boxMax3 = vector_double3(10,12,20)
26 | let box3 = Box(boxMin: boxMin3, boxMax: boxMax3)
27 | box3.intersects(box3)
28 |
29 | octree.elements(in: box)
30 | octree.elements(in: box2)
31 | print(octree)
32 |
--------------------------------------------------------------------------------
/Deque/Deque-Simple.swift:
--------------------------------------------------------------------------------
1 |
2 | /**
3 | * 简单的双端队列
4 | */
5 | public struct Deque {
6 | private var array = [T]()
7 |
8 | public var isEmpty: Bool {
9 | return array.isEmpty
10 | }
11 |
12 | public var count: Int {
13 | return array.count
14 | }
15 |
16 | public mutating func enqueue(_ element: T) {
17 | array.append(element)
18 | }
19 |
20 | public mutating func enqueueFront(_ element: T) {
21 | array.insert(element, at: 0)
22 | }
23 |
24 | public mutating func dequeue() -> T? {
25 | if isEmpty {
26 | return nil
27 | } else {
28 | return array.removeFirst()
29 | }
30 | }
31 |
32 | public mutating func dequeueBack() -> T? {
33 | if isEmpty {
34 | return nil
35 | } else {
36 | return array.removeLast()
37 | }
38 | }
39 |
40 | public func peekFront() -> T? {
41 | return array.first
42 | }
43 |
44 | public func peakBack() -> T? {
45 | return array.last
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Under Construction.markdown:
--------------------------------------------------------------------------------
1 | # Under Construction :construction:
2 |
3 | Here you'll find algorithms that are currently under construction. Suggestions and feedback is welcome!
4 |
5 | ### Sorting
6 |
7 | Special-purpose sorts:
8 | - [Radix Sort](Radix%20Sort/)
9 |
10 | ### Special-purpose sorts:
11 |
12 | - [Bucket Sort](Bucket%20Sort/)
13 |
14 | ### Queues
15 |
16 | - [Bounded Priority Queue](Bounded%20Priority%20Queue). A queue that is bounded to have a limited number of elements.
17 |
18 | ### Trees
19 |
20 | - [AVL Tree](AVL%20Tree/). A binary search tree that balances itself using rotations.
21 | - [Red-Black Tree](Red-Black%20Tree/)
22 | - [Threaded Binary Tree](Threaded%20Binary%20Tree/)
23 | - [Ternary Search Tree](Ternary%20Search%20Tree/)
24 | - [Trie](Trie/)
25 | - [Radix Tree](Radix%20Tree/)
26 |
27 | ### Miscellaneous
28 |
29 | - [Minimum Edit Distance](Minimum%20Edit%20Distance/). Measure the similarity of two strings by counting the number of operations required to transform one string into the other.
30 | - [Treap](Treap/)
31 | - [Set Cover (Unweighted)](Set%20Cover%20(Unweighted)/)
32 |
--------------------------------------------------------------------------------
/Count Occurrences/CountOccurrences.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | /*
2 | 用二分搜索分别查找左右边界(事先已经排过序)
3 | */
4 | func countOccurrencesOfKey(_ key: Int, inArray a: [Int]) -> Int {
5 | func leftBoundary() -> Int {
6 | var low = 0
7 | var high = a.count
8 | while low < high {
9 | let midIndex = low + (high - low)/2
10 | if a[midIndex] < key {
11 | low = midIndex + 1
12 | } else {
13 | high = midIndex
14 | }
15 | }
16 | return low
17 | }
18 |
19 | func rightBoundary() -> Int {
20 | var low = 0
21 | var high = a.count
22 | while low < high {
23 | let midIndex = low + (high - low)/2
24 | if a[midIndex] > key {
25 | high = midIndex
26 | } else {
27 | low = midIndex + 1
28 | }
29 | }
30 | return low
31 | }
32 |
33 | return rightBoundary() - leftBoundary()
34 | }
35 |
36 | let a = [ 0, 1, 1, 3, 3, 3, 3, 6, 8, 10, 11, 11 ]
37 |
38 | countOccurrencesOfKey(11, inArray: a)
39 |
--------------------------------------------------------------------------------
/Queue/Queue-Optimized.swift:
--------------------------------------------------------------------------------
1 | /*
2 | First-in first-out queue (FIFO)
3 |
4 | New elements are added to the end of the queue. Dequeuing pulls elements from
5 | the front of the queue.
6 |
7 | Enqueuing and dequeuing are O(1) operations.
8 | */
9 | public struct Queue {
10 | fileprivate var array = [T?]()
11 | fileprivate var head = 0
12 |
13 | public var isEmpty: Bool {
14 | return count == 0
15 | }
16 |
17 | public var count: Int {
18 | return array.count - head
19 | }
20 |
21 | public mutating func enqueue(_ element: T) {
22 | array.append(element)
23 | }
24 |
25 | public mutating func dequeue() -> T? {
26 | guard head < array.count, let element = array[head] else { return nil }
27 |
28 | array[head] = nil
29 | head += 1
30 |
31 | let percentage = Double(head)/Double(array.count)
32 | if array.count > 50 && percentage > 0.25 {
33 | array.removeFirst(head)
34 | head = 0
35 | }
36 |
37 | return element
38 | }
39 |
40 | public var front: T? {
41 | if isEmpty {
42 | return nil
43 | } else {
44 | return array[head]
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Slow Sort/README.markdown:
--------------------------------------------------------------------------------
1 | # 慢排序(Slow Sort)
2 |
3 |
4 | 目标:将数字数组从低到高(或从高到低)排序。
5 |
6 | 您将获得一系列数字,需要按正确的顺序排列。 插入排序算法【??】的工作原理如下:
7 |
8 | 我们可以分解按升序排序n个数字的问题
9 |
10 | 1. 找到最大数字
11 | 1. 找到前n/2个元素的最大值
12 | 2. 找到剩余n/2个元素的最大值
13 | 3. 找到这两个最大值中的最大值
14 | 2. 对其余的进行排序
15 |
16 | ## 代码
17 |
18 | 这是慢速排序在Swift中的实现:
19 |
20 | ```swift
21 | public func slowsort(_ i: Int, _ j: Int) {
22 | if i>=j {
23 | return
24 | }
25 | let m = (i+j)/2
26 | slowsort(i,m)
27 | slowsort(m+1,j)
28 | if numberList[j] < numberList[m] {
29 | let temp = numberList[j]
30 | numberList[j] = numberList[m]
31 | numberList[m] = temp
32 | }
33 | slowsort(i,j-1)
34 | }
35 | ```
36 |
37 | ## 性能
38 |
39 | | Case | 性能 |
40 | |:-------------: |:---------------:|
41 | | 最差 | slow |
42 | | 最好 | O(n^(log(n)/(2+e)))) |
43 | | 平均 | O(n^(log(n)/2)) |
44 |
45 | ## 扩展阅读
46 |
47 | [慢排序的详细说明](http://c2.com/cgi/wiki?SlowSort)
48 |
49 |
50 | *作者:Lukas Schramm*
51 | *翻译:[Andy Ron](https://github.com/andyRon)*
52 | *校对:[Andy Ron](https://github.com/andyRon)*
53 |
54 | (used the Insertion Sort Readme as template)
55 |
--------------------------------------------------------------------------------
/Counting Sort/CountingSort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | enum CountingSortError: Error {
3 | case arrayEmpty
4 | }
5 |
6 | func countingSort(array: [Int]) throws -> [Int] {
7 | guard array.count > 0 else {
8 | throw CountingSortError.arrayEmpty
9 | }
10 |
11 | // Step 1 创建一个数组来存储每个元素的计数
12 | let maxElement = array.max() ?? 0
13 |
14 | var countArray = [Int](repeating: 0, count: Int(maxElement + 1))
15 | for elemnt in array {
16 | countArray[elemnt] += 1
17 | }
18 |
19 | print(countArray)
20 |
21 | // Step 2 将每个值设置为前两个值的总和
22 | for index in 1 ..< countArray.count {
23 | let sum = countArray[index] + countArray[index - 1]
24 | countArray[index] = sum
25 | }
26 |
27 | print(countArray)
28 |
29 | // Step 3 根据元素前面的元素数将元素放在最终数组中
30 | var sortedArray = [Int](repeating: 0, count: array.count)
31 | for element in array {
32 | countArray[element] -= 1
33 | sortedArray[countArray[element]] = element
34 | }
35 | return sortedArray
36 | }
37 |
38 | let sortedArray = try countingSort(array: [ 10, 9, 8, 7, 1, 2, 7, 3 ])
39 |
40 | print(sortedArray)
41 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | Copyright © 2018 Andy Ron. All rights reserved.
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Graph/Graph/Graph/other/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/Brute-Force String Search/BruteForceStringSearch.playground/timeline.xctimeline:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Depth-First Search/DepthFirstSearch.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | // last checked with Xcode 10.1
2 |
3 | func depthFirstSearch(_ graph: Graph, source: Node) -> [String] {
4 | var nodesExplored = [source.label]
5 | source.visited = true
6 |
7 | for edge in source.neighbors {
8 | if !edge.neighbor.visited {
9 | nodesExplored += depthFirstSearch(graph, source: edge.neighbor)
10 | }
11 | }
12 | return nodesExplored
13 | }
14 |
15 | let graph = Graph()
16 |
17 | let nodeA = graph.addNode("a")
18 | let nodeB = graph.addNode("b")
19 | let nodeC = graph.addNode("c")
20 | let nodeD = graph.addNode("d")
21 | let nodeE = graph.addNode("e")
22 | let nodeF = graph.addNode("f")
23 | let nodeG = graph.addNode("g")
24 | let nodeH = graph.addNode("h")
25 |
26 | graph.addEdge(nodeA, neighbor: nodeB)
27 | graph.addEdge(nodeA, neighbor: nodeC)
28 | graph.addEdge(nodeB, neighbor: nodeD)
29 | graph.addEdge(nodeB, neighbor: nodeE)
30 | graph.addEdge(nodeC, neighbor: nodeF)
31 | graph.addEdge(nodeC, neighbor: nodeG)
32 | graph.addEdge(nodeE, neighbor: nodeH)
33 | graph.addEdge(nodeE, neighbor: nodeF)
34 | graph.addEdge(nodeF, neighbor: nodeG)
35 |
36 | let nodesExplored = depthFirstSearch(graph, source: nodeA)
37 | print(nodesExplored)
38 |
39 |
--------------------------------------------------------------------------------
/Linear Search/README.markdown:
--------------------------------------------------------------------------------
1 | # 线性搜索(Linear Search)
2 |
3 | 目标:在数组中查找特定值。
4 |
5 |
6 | 我们有一组通用对象。 通过线性搜索,我们迭代数组中的所有对象,并将每个对象与我们正在寻找的对象进行比较。 如果两个对象相等,我们停止并返回当前对象在数组中的索引。 如果不相等,只要数组中还有对象,我们就会继续寻找下一个。
7 |
8 | ## 一个例子
9 |
10 | 假设我们有一个数组`[5,2,4,7]`,我们想检查数组是否包含数字`2`。
11 |
12 | 我们首先将数组中的第一个数字`5`与我们正在寻找的数字`2`进行比较。 它们显然不一样,所以我们继续比较下一个数组元素。
13 |
14 | 我们将数组中的数字`2`与数字`2`进行比较,注意到它们是相等的。 现在我们可以停止迭代并返回1,这是数组中数字`2`的索引。
15 |
16 | ## 代码
17 |
18 | 这是Swift线性搜索的简单实现:
19 |
20 | ```swift
21 | func linearSearch(_ array: [T], _ object: T) -> Int? {
22 | for (index, obj) in array.enumerated() where obj == object {
23 | return index
24 | }
25 | return nil
26 | }
27 | ```
28 |
29 | 将此代码放在playground里测试:
30 |
31 | ```swift
32 | let array = [5, 2, 4, 7]
33 | linearSearch(array, 2) // This will return 1
34 | ```
35 |
36 | ## 性能
37 |
38 | 线性搜索性能是**O(n)** 。它将我们要查找的对象与数组中的每个对象进行比较,因此它所花费的时间与数组长度成正比。在最坏的情况下,我们需要查看数组中的所有元素。
39 |
40 | 最好的情况是 **O(1)**,但这种情况很少见,因为我们要查找的对象必须位于数组的开头才能立即找到。你可能会很幸运,但大部分时间你都不会。平均而言,线性搜索需要查看数组中对象的一半。
41 |
42 | ## 扩展阅读
43 |
44 | [线性搜索的维基百科](https://en.wikipedia.org/wiki/Linear_search)
45 |
46 | *作者:[Patrick Balestra](http://www.github.com/BalestraPatrick)*
47 | *翻译:[Andy Ron](https://github.com/andyRon)*
48 | *校对:[Andy Ron](https://github.com/andyRon)*
49 |
50 |
--------------------------------------------------------------------------------
/HaversineDistance/README_en.md:
--------------------------------------------------------------------------------
1 | # Haversine Distance
2 |
3 | Calculates the distance on a sphere between two points given in latitude and longitude using the haversine formula.
4 |
5 | The haversine formula can be found on [Wikipedia](https://en.wikipedia.org/wiki/Haversine_formula)
6 |
7 | The Haversine Distance is implemented as a function as a class would be kind of overkill.
8 |
9 | `haversineDinstance(la1: Double, lo1: Double, la2: Double, lo2: Double, radius: Double = 6367444.7) -> Double`
10 |
11 | - `la1` is the latitude of point 1 in degrees.
12 | - `lo1` is the longitude of point 1 in degrees.
13 | - `la2` is the latitude of point 2 in degrees.
14 | - `lo2` is the longitude of point 2 in degrees.
15 | - `radius` is the radius of the sphere considered in meters, which defaults to the mean radius of the earth (from [WolframAlpha](http://www.wolframalpha.com/input/?i=earth+radius)).
16 |
17 | The function contains 3 closures in order to make the code more readable and comparable to the Haversine formula given by the Wikipedia page mentioned above.
18 |
19 | 1. `haversine` implements the haversine, a trigonometric function.
20 | 2. `ahaversine` the inverse function of the haversine.
21 | 3. `dToR` a closure converting degrees to radians.
22 |
23 | The result of `haversineDistance` is returned in meters.
24 |
25 | *Written for Swift Algorithm Club by Jaap Wijnen.*
26 |
--------------------------------------------------------------------------------
/Fixed Size Array/FixedSizeArray.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | /**
2 | * 固定长度数组
3 | */
4 | struct FixedSizeArray {
5 | /// 数组最大存储元素数量
6 | private var maxSize: Int
7 | private var defaultValue: T
8 | private var array: [T]
9 | /// 数组当前包含的元素数量
10 | private(set) var count = 0
11 |
12 | init(maxSize: Int, defaultValue: T) {
13 | self.maxSize = maxSize
14 | self.defaultValue = defaultValue
15 | self.array = [T](repeating: defaultValue, count: maxSize)
16 | }
17 |
18 | subscript(index: Int) -> T {
19 | assert(index >= 0)
20 | assert(index < count)
21 | return array[index]
22 | }
23 |
24 | mutating func append(_ newElement: T) {
25 | assert(count < maxSize)
26 | array[count] = newElement
27 | count += 1
28 | }
29 |
30 | mutating func removeAt(index: Int) -> T {
31 | assert(index >= 0)
32 | assert(index < count)
33 | count -= 1
34 | let result = array[index]
35 | array[index] = array[count]
36 | array[count] = defaultValue
37 | return result
38 | }
39 |
40 | mutating func removeAll() {
41 | for i in 0..: Equatable where T: Hashable {
12 |
13 | public let from: Vertex
14 | public let to: Vertex
15 |
16 | public let weight: Double?
17 |
18 | }
19 |
20 | extension Edge: CustomStringConvertible {
21 |
22 | public var description: String {
23 | guard let unwrappedWeight = weight else {
24 | return "\(from.description) -> \(to.description)"
25 | }
26 | return "\(from.description) -(\(unwrappedWeight))-> \(to.description)"
27 | }
28 | }
29 |
30 | extension Edge: Hashable {
31 |
32 | public var hashValue: Int {
33 | var string = "\(from.description)\(to.description)"
34 | if weight != nil {
35 | string.append("\(weight!)")
36 | }
37 | return string.hashValue
38 | }
39 | }
40 |
41 | public func ==(lhs: Edge, rhs: Edge) -> Bool {
42 | guard lhs.from == rhs.from else {
43 | return false
44 | }
45 |
46 | guard lhs.to == rhs.to else {
47 | return false
48 | }
49 |
50 | guard lhs.weight == rhs.weight else {
51 | return false
52 | }
53 |
54 | return true
55 | }
56 |
--------------------------------------------------------------------------------
/Radix Sort/RadixSort.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | import Foundation
3 |
4 | // 不能处理负数
5 | public func radixSort(_ array: inout [Int]) {
6 | let radix = 10
7 | var done = false
8 | var index: Int
9 | var digit = 1
10 |
11 | while !done {
12 | done = true
13 |
14 | var buckets: [[Int]] = [] // 我们的排序子程序是桶排序,所以让我们预定义我们的桶
15 |
16 | for _ in 1...radix {
17 | buckets.append([])
18 | }
19 |
20 | for number in array {
21 | index = number / digit
22 | buckets[index % radix].append(number)
23 | if done && index > 0 {
24 | done = false
25 | }
26 | }
27 |
28 | var i = 0
29 |
30 | for j in 0.. {
10 | fileprivate var array = [T]()
11 |
12 | public var count: Int {
13 | return array.count
14 | }
15 |
16 | public var isEmpty: Bool {
17 | return array.isEmpty
18 | }
19 |
20 | public mutating func push(_ element: T) {
21 | array.append(element)
22 | }
23 |
24 | public mutating func pop() -> T? {
25 | return array.popLast()
26 | }
27 |
28 | public var top: T? {
29 | return array.last
30 | }
31 | }
32 | // 让Stack可以遍历
33 | extension Stack: Sequence {
34 | public func makeIterator() -> AnyIterator {
35 | var curr = self
36 | return AnyIterator {
37 | return curr.pop()
38 | }
39 | }
40 | }
41 |
42 | // 创建一个栈
43 | var stackOfNames = Stack(array: ["小明", "小强", "小戎", "张三", "李四"])
44 |
45 | // 想栈顶部添加一个元素
46 | stackOfNames.push("王麻子")
47 | stackOfNames.push("李狗子")
48 |
49 | print(stackOfNames.array)
50 |
51 | // 移除栈顶部的第一个元素
52 | stackOfNames.pop()
53 |
54 | stackOfNames.top
55 |
56 | stackOfNames.isEmpty
57 |
58 | // 遍历,从顶部开始遍历
59 | for name in stackOfNames {
60 | print(name)
61 | }
62 |
--------------------------------------------------------------------------------
/Binary Search/BinarySearch.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | 递归实现二分搜索
4 | */
5 | func binarySearch(_ a: [T], key: T, range: Range) -> Int? {
6 | if range.lowerBound >= range.upperBound {
7 | return nil
8 | } else {
9 | let midIndex = range.lowerBound + (range.upperBound - range.lowerBound)/2
10 |
11 | if a[midIndex] > key {
12 | return binarySearch(a, key: key, range: range.lowerBound ..< midIndex)
13 | } else if a[midIndex] < key {
14 | return binarySearch(a, key: key, range: midIndex + 1 ..< range.upperBound)
15 | } else {
16 | return midIndex
17 | }
18 | }
19 | }
20 |
21 | let numbers = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
22 |
23 | binarySearch(numbers, key: 67, range: 0 ..< numbers.count)
24 |
25 | /*
26 | 迭代实现二分搜索
27 | */
28 | func binarySearch(_ a: [T], key: T) -> Int? {
29 | var lowerBound = 0
30 | var upperBound = a.count
31 | while lowerBound < upperBound {
32 | let midIndex = lowerBound + (upperBound - lowerBound)/2
33 | if a[midIndex] == key {
34 | return midIndex
35 | } else if a[midIndex] < key {
36 | lowerBound = midIndex + 1
37 | } else {
38 | upperBound = midIndex
39 | }
40 | }
41 | return nil
42 | }
43 |
44 |
45 | binarySearch(numbers, key: 5)
46 |
--------------------------------------------------------------------------------
/Breadth-First Search/BreadthFirstSearch.playground/Contents.swift:
--------------------------------------------------------------------------------
1 | func breadthFirstSearch(_ graph: Graph, source: Node) -> [String] {
2 | var queue = Queue()
3 | queue.enqueue(source)
4 |
5 | var nodesExplored = [source.label]
6 | source.visited = true
7 |
8 | while let node = queue.dequeue() {
9 | for edge in node.neighbors {
10 | let neighborNode = edge.neighbor
11 | if !neighborNode.visited {
12 | queue.enqueue(neighborNode)
13 | neighborNode.visited = true
14 | nodesExplored.append(neighborNode.label)
15 | }
16 | }
17 | }
18 |
19 | return nodesExplored
20 | }
21 |
22 |
23 |
24 | let graph = Graph()
25 |
26 | let nodeA = graph.addNode("a")
27 | let nodeB = graph.addNode("b")
28 | let nodeC = graph.addNode("c")
29 | let nodeD = graph.addNode("d")
30 | let nodeE = graph.addNode("e")
31 | let nodeF = graph.addNode("f")
32 | let nodeG = graph.addNode("g")
33 | let nodeH = graph.addNode("h")
34 |
35 | graph.addEdge(nodeA, neighbor: nodeB)
36 | graph.addEdge(nodeA, neighbor: nodeC)
37 | graph.addEdge(nodeB, neighbor: nodeD)
38 | graph.addEdge(nodeB, neighbor: nodeE)
39 | graph.addEdge(nodeC, neighbor: nodeF)
40 | graph.addEdge(nodeC, neighbor: nodeG)
41 | graph.addEdge(nodeE, neighbor: nodeH)
42 | graph.addEdge(nodeE, neighbor: nodeF)
43 | graph.addEdge(nodeF, neighbor: nodeG)
44 |
45 | let nodesExplored = breadthFirstSearch(graph, source: nodeA)
46 | print(nodesExplored)
47 |
--------------------------------------------------------------------------------
/Slow Sort/README_en.markdown:
--------------------------------------------------------------------------------
1 | # Slow Sort
2 |
3 | Goal: Sort an array of numbers from low to high (or high to low).
4 |
5 | You are given an array of numbers and need to put them in the right order. The insertion sort algorithm works as follows:
6 |
7 | We can decompose the problem of sorting n numbers in ascending order into
8 |
9 | 1. find the maximum of the numbers
10 | 1. find the maximum of the first n/2 elements
11 | 2. find the maximum of the remaining n/2 elements
12 | 3. find the largest of those two maxima
13 | 2. sorting the remaining ones
14 |
15 | ## The code
16 |
17 | Here is an implementation of slow sort in Swift:
18 |
19 | ```swift
20 | public func slowsort(_ i: Int, _ j: Int) {
21 | if i>=j {
22 | return
23 | }
24 | let m = (i+j)/2
25 | slowsort(i,m)
26 | slowsort(m+1,j)
27 | if numberList[j] < numberList[m] {
28 | let temp = numberList[j]
29 | numberList[j] = numberList[m]
30 | numberList[m] = temp
31 | }
32 | slowsort(i,j-1)
33 | }
34 | ```
35 |
36 | ## Performance
37 |
38 | | Case | Performance |
39 | |:-------------: |:---------------:|
40 | | Worst | slow |
41 | | Best | O(n^(log(n)/(2+e)))) |
42 | | Average | O(n^(log(n)/2)) |
43 |
44 | ## See also
45 |
46 | [Slow Sort explanation in the Internet](http://c2.com/cgi/wiki?SlowSort)
47 |
48 | *Written for Swift Algorithm Club by Lukas Schramm*
49 |
50 | (used the Insertion Sort Readme as template)
--------------------------------------------------------------------------------
/Array2D/Array2D.playground/Contents.swift:
--------------------------------------------------------------------------------
1 |
2 |
3 | public struct Array2D {
4 | public let columns: Int
5 | public let rows: Int
6 | fileprivate var array: [T]
7 |
8 | public init(columns: Int, rows: Int, initialValue: T) {
9 | self.columns = columns
10 | self.rows = rows
11 | array = .init(repeating: initialValue, count: rows*columns)
12 | }
13 |
14 | public subscript(column: Int, row: Int) -> T {
15 | get {
16 | // `precondition(_:_:file:line:)`函数类似`assert`,满足条件会造成程序的提前终止并抛出错误信息,详细查看[官方文档](https://developer.apple.com/documentation/swift/1540960-precondition)。
17 | precondition(column < columns, "Column \(column) Index is out of range. Array(columns: \(columns), rows:\(rows))")
18 | precondition(row < rows, "Row \(row) Index is out of range. Array(columns: \(columns), rows:\(rows))")
19 | return array[row*columns + column]
20 | }
21 | set {
22 | precondition(column < columns, "Column \(column) Index is out of range. Array(columns: \(columns), rows:\(rows))")
23 | precondition(row < rows, "Row \(row) Index is out of range. Array(columns: \(columns), rows:\(rows))")
24 | array[row*columns + column] = newValue
25 | }
26 | }
27 | }
28 |
29 |
30 | var cookies = Array2D(columns: 10, rows: 7, initialValue: 0)
31 | cookies[5, 2]
32 | cookies[5, 2] = 1587
33 | cookies[5, 2]
34 |
35 | //cookies[11, 2]
36 |
--------------------------------------------------------------------------------