Skip to content

Instantly share code, notes, and snippets.

View thexande's full-sized avatar

Alexander Murphy thexande

  • Denver, CO, USA, Planet Earth
View GitHub Profile

Privacy Policy

built the Bitcoin Maps app as a Free app. This SERVICE is provided by at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Bitcoin Maps unless otherwise defined in this Privacy Policy.

Privacy Policy

Alexander Murphy built the Block Viewer app as a Free app. This SERVICE is provided by Alexander Murphy at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Block Viewer unless otherwise defined in this Privacy Policy.

Privacy Policy

Alexander Murphy built the Algorithms and Data Structures app as an Open Source app. This SERVICE is provided by Alexander Murphy at no cost and is intended for use as is.

This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service.

If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy.

The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Algorithms and Data Structures unless otherwise defined in this Privacy Policy.

@thexande
thexande / SuperEnumerator.swift
Created September 23, 2018 21:36
A recursive data structure conforming to IteratorProtocol
final public class SuperEnumerator: IteratorProtocol {
public typealias Element = Any
private var item: Element?
private var hasReturnedLowestDimension = false
@thexande
thexande / moveZerosToFront.swift
Created September 4, 2018 02:28
Given an array, without using extra space, move all zeros to the end and no-zeros to the beginning.
//Given an array, without using extra space, move all zeros to the end and no-zeros to the beginning. The function should return the number of non-zeros.
/// move all zeros in the list to the front without using extra space or new arrays.
///
/// - Parameter list: list of Int
/// - Returns: number of zeros
public func moveZerosToFront(list: inout [Int]) -> (Int, [Int]) { //O(n)
var numOfZeros = 0
for i in 0..<list.count {
@thexande
thexande / RecursiveTreeTraversal.swift
Created September 4, 2018 02:23
A Recursive in order Binary Tree Traversal implementation
/// BinaryTree data structure for a recursive tree
///
/// - node: the root node
/// - empty: empty node
/// - value: The underlying data within the node
indirect enum BinaryTree<T> {
case node(BinaryTree<T>, T, BinaryTree<T>)
case empty
@thexande
thexande / FrequencyElements.swift
Created September 3, 2018 22:35
Element Frequency: Find the values in an array with a given frequency
/// Find the values in an array with a given frequency
///
/// - Parameters:
/// - array: the array to search through
/// - k: the frequency value
/// - Returns: an array of values with the corresponding frequency
func frequency(for array: [Int], k: Int) -> [Int] {
var bucket: [[Int]] = []
var frequency: [Int:Int] = [:]
@thexande
thexande / IntegerArrayIntersection.swift
Created September 3, 2018 22:32
Array Intersection: Find the intersection of a given set of 3 sorted arrays
/// Array Intersection: Find the intersection of a given set of 3 sorted arrays
///
/// - Parameters:
/// - arrayOne: the first sorted array of Integers
/// - arrayTwo: the second sorted array of Integers
/// - arrayThree: the third sorted array of Integers
/// - Returns: an array of intersection points within the given 3 arrays
func findIntersection(arrayOne: [Int], arrayTwo: [Int], arrayThree: [Int]) -> [Int] {
var results: [Int] = []
enum Trend {
case ascending
case decending
}
func trend(for sequence: [Int]) -> Trend? {
var trend: Trend?
@thexande
thexande / MergeSort.swift
Last active August 15, 2018 21:06
Merge Sort in Swift
func sort(_ array: [Int]) -> [Int] {
guard array.count > 1 else {
return array
}
let left = Array(array[0..<array.count / 2])
let right = Array(array[array.count/2..<array.count])
return merge(sort(left), sort(right))
}