diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..047dd97 Binary files /dev/null and b/.DS_Store differ diff --git a/FileFinder/FileFinder.xcodeproj/project.pbxproj b/FileFinder/FileFinder.xcodeproj/project.pbxproj new file mode 100644 index 0000000..218573d --- /dev/null +++ b/FileFinder/FileFinder.xcodeproj/project.pbxproj @@ -0,0 +1,246 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 5D5011331C583C3700681B1E /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D5011321C583C3700681B1E /* main.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 5D50112D1C583C3600681B1E /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 5D50112F1C583C3700681B1E /* FileFinder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = FileFinder; sourceTree = BUILT_PRODUCTS_DIR; }; + 5D5011321C583C3700681B1E /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 5D50112C1C583C3600681B1E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 5D5011261C583C3600681B1E = { + isa = PBXGroup; + children = ( + 5D5011311C583C3700681B1E /* FileFinder */, + 5D5011301C583C3700681B1E /* Products */, + ); + sourceTree = ""; + }; + 5D5011301C583C3700681B1E /* Products */ = { + isa = PBXGroup; + children = ( + 5D50112F1C583C3700681B1E /* FileFinder */, + ); + name = Products; + sourceTree = ""; + }; + 5D5011311C583C3700681B1E /* FileFinder */ = { + isa = PBXGroup; + children = ( + 5D5011321C583C3700681B1E /* main.swift */, + ); + path = FileFinder; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 5D50112E1C583C3600681B1E /* FileFinder */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5D5011361C583C3700681B1E /* Build configuration list for PBXNativeTarget "FileFinder" */; + buildPhases = ( + 5D50112B1C583C3600681B1E /* Sources */, + 5D50112C1C583C3600681B1E /* Frameworks */, + 5D50112D1C583C3600681B1E /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FileFinder; + productName = FileFinder; + productReference = 5D50112F1C583C3700681B1E /* FileFinder */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 5D5011271C583C3600681B1E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 0720; + ORGANIZATIONNAME = "Jackie Meggesto"; + TargetAttributes = { + 5D50112E1C583C3600681B1E = { + CreatedOnToolsVersion = 7.2; + }; + }; + }; + buildConfigurationList = 5D50112A1C583C3600681B1E /* Build configuration list for PBXProject "FileFinder" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 5D5011261C583C3600681B1E; + productRefGroup = 5D5011301C583C3700681B1E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 5D50112E1C583C3600681B1E /* FileFinder */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 5D50112B1C583C3600681B1E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5D5011331C583C3700681B1E /* main.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 5D5011341C583C3700681B1E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 5D5011351C583C3700681B1E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + 5D5011371C583C3700681B1E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 5D5011381C583C3700681B1E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 5D50112A1C583C3600681B1E /* Build configuration list for PBXProject "FileFinder" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5D5011341C583C3700681B1E /* Debug */, + 5D5011351C583C3700681B1E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5D5011361C583C3700681B1E /* Build configuration list for PBXNativeTarget "FileFinder" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5D5011371C583C3700681B1E /* Debug */, + 5D5011381C583C3700681B1E /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 5D5011271C583C3600681B1E /* Project object */; +} diff --git a/FileFinder/FileFinder.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/FileFinder/FileFinder.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..14e2c2f --- /dev/null +++ b/FileFinder/FileFinder.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/FileFinder/FileFinder/main.swift b/FileFinder/FileFinder/main.swift new file mode 100644 index 0000000..9ce479b --- /dev/null +++ b/FileFinder/FileFinder/main.swift @@ -0,0 +1,38 @@ +// +// main.swift +// FileFinder +// +// Created by Jackie Meggesto on 1/26/16. +// Copyright © 2016 Jackie Meggesto. All rights reserved. +// + +import Foundation + +import Foundation + +func findFile(name: String, atPath: String) -> String { + let fileManager = NSFileManager.defaultManager() + let contents = + try! fileManager.contentsOfDirectoryAtPath(atPath) + for fileOrDir in contents { + var isDir = ObjCBool(false); + let fullPath = atPath + "/" + fileOrDir + let exists = fileManager.fileExistsAtPath(fullPath, isDirectory: &isDir) + if exists && Bool(isDir) { + // YOUR CODE HERE + print("DIR: " + fileOrDir) + } else if exists { + // YOUR CODE HERE + print("FILE: " + fileOrDir) + } else { + print("NEITHER: " + fileOrDir) + } + } + return "NOT FOUND" +} + +// print(findFile("APITest.py", atPath: "/Users/jackiemeggesto/Documents")) + +print(UINT64_MAX) + + diff --git a/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift b/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift index 13cc14e..45109f1 100644 --- a/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift +++ b/HWFrom1-17-16(Lists and Sorts).playground/Contents.swift @@ -13,14 +13,141 @@ Link: https://docs.google.com/document/d/1INvOynuggw69yLRNg3y-TPwBiYb3lQZQiFUOxZ 1) +Given a partially filled in Sudoku board and a set of coordinates in that board pointing to an empty square, write a function that returns a list containing all numbers that the empty square could be. +Input: sudokuBoard:[[Int?]]. (Each location on the board will be either be an Int from 1-9 or nil(empty cell)) +row: Int +col: Int -2) +func getValidNumbers(sudokuBoard:[[Int?]], row:Int, col:Int) -> [Int] { +return [Int]() +} + +*/ +var sudoku = + [[2,7,1,9,5,4,6,8,3], + [5,9,3,6,2,8,1,4,7], + [4,6,8,1,3,7,2,5,9], + [7,3,6,4,1,5,8,9,2], + [1,5,9,8,6,2,3,7,4], + [8,4,2,3,7,9,5,6,1], + [9,8,5,2,4,1,7,3,6], + [6,1,7,5,9,3,4,2,8], + [3,2,4,7,8,6,9,1,5]] + +var incompleteSudoku = + + [[5,0,8,0,7,3,1,9,0], + [9,0,0,6,0,0,4,0,8], + [0,0,0,9,0,8,0,3,5], + [0,7,0,0,1,0,0,6,0], + [0,0,2,0,0,0,9,0,0], + [0,1,0,0,0,0,0,8,0], + [1,9,0,3,0,6,0,0,0], + [2,0,3,0,0,7,0,0,9], + [0,8,7,1,9,0,3,0,4]] + + +func getValidNumbers(sudokuBoard: [[Int]], row: Int, col: Int) -> [Int] { + + let topleftX = row - (row % 3) + let topleftY = col - (col % 3) + var grid = [Int]() + + for i in Range(start: topleftX, end: topleftX+3) { + + for j in Range(start: topleftY, end: topleftY+3) { + grid.append(sudokuBoard[i][j]) + } + + } + let complete = Set([1, 2, 3, 4, 5, 6, 7, 8, 9]) + + let column = sudokuBoard[col] + var rows = [Int]() + for cell in 0.. [[Int]] { + + + var temparr = [[Int]](count: 4, repeatedValue: []) + + for var i = 0; i < matrix.count; i++ { + + for var j = matrix.count - 1; j >= 0; j-- { + + temparr[i].append(matrix[j][i]) + print(j, i) + + } + + } + + + return temparr +} +print(rotateMatrix([ + [1,2,3,4], + [5,6,7,8], + [9,0,1,2], + [3,4,5,6]] +)) + + + +// 3) + +func mySort(values: [Int]) -> [Int] { + + + var left = values[0...1] + if left[0] > left[1] { + let t = left[0] + left[0] = left[1] + left[1] = t + } + var right = values[2...4] + if right[0] > right[1] { + let t = right[0] + right[0] = right[1] + right[1] = t + } + + + +} + +// split ABCD into two groups, AB and CD and compare those which will be fewer steps than checking all of them, then merge the two groups + + + diff --git a/HWFrom1-24(Recursion).playground/Contents.swift b/HWFrom1-24(Recursion).playground/Contents.swift index 1c44504..e620946 100644 --- a/HWFrom1-24(Recursion).playground/Contents.swift +++ b/HWFrom1-24(Recursion).playground/Contents.swift @@ -9,17 +9,65 @@ Homework link: https://docs.google.com/document/d/1INvOynuggw69yLRNg3y-TPwBiYb3l -//Question 1 - - - - - - -//Question 2 - - - +/* Question 1 +Write an iterative (not recursive) fibonacci function that calculates the nth fibonacci number. How does its performance compare with the non-memoized recursive one (see Appendix A below), based on the number of iterations that Swift says it takes in the right margin? +*/ +func fib(n: Int) -> Int { + if (n == 0 || n == 1) { + return 1 + } + return fib(n - 1) + fib(n - 2) +} + +func iter_fib(n: Int) -> Int { + + var fibarr = [1, 1] + if n == 1 || n == 2 { + return fibarr[n-1] + } + while fibarr.count != n { + + fibarr.append(fibarr[fibarr.count - 1] + fibarr[fibarr.count - 2]) + + + + } + print(fibarr) + return fibarr[n-1] + + +} + + +//The iterative fibonacci sequence generator is much more efficient than the non-memoized recursive method. To generate the 50th Fibonacci number, the iterative method requires only 48 iterations, whereas the non-memoized function loops hundreds of thousands of times. + + +/* Question 2 +The engineers have been hard at work on the clumsy robot project, and have released a new API with a new tryStep method (see Appendix B). Now it returns an Int, which is -1 if the robot fell down a step, 0 if the robot stayed on the same step, or 1 if the robot went to the next step. Write a new stepUp method using this new tryStep method that works the same as before. +*/ -//Question 3 \ No newline at end of file +import Foundation + +var stepNum = 0 +func tryStep() -> Int { + let stepCount = Int(arc4random_uniform(3)) - 1 + stepNum += stepCount; + switch(stepCount) { + case -1: print("Ouch \(stepNum)") + case 1: print("Yay \(stepNum)") + default: print("Beep \(stepNum)") + } + return stepCount +} + +func stepUp() { + if tryStep() == 1 { + // We’re done! + return + } + // Now we’re two steps below where we want to be :-( + stepUp() + +} +//Question 3 diff --git a/HWfrom1-09-16(SwiftIntro).playground/Contents.swift b/HWfrom1-09-16(SwiftIntro).playground/Contents.swift index 488e9ed..dc89ddc 100644 --- a/HWfrom1-09-16(SwiftIntro).playground/Contents.swift +++ b/HWfrom1-09-16(SwiftIntro).playground/Contents.swift @@ -4,20 +4,68 @@ import UIKit var str = "Hello, playground" -/* -Use the link here to get the questions. Then code your solutions below. If it does not require code, just write your answer in comments. -https://docs.google.com/document/d/1DQ2aCJ_yUZtazzCfb0PaS81bg61V2ZOSxpABh981xSo/edit +// Use the link here to get the questions. Then code your solutions below. If it does not require code, just write your answer in comments. +// https://docs.google.com/document/d/1DQ2aCJ_yUZtazzCfb0PaS81bg61V2ZOSxpABh981xSo/edit -1) -2) +// 1) -3) +func integer_algorithm(numbers: [Int]) -> Int { + + let complete: Set = Set(Range(start: 1, end: numbers.count + 1)) + let incomplete = Set(numbers) + + return Array(complete.subtract(incomplete))[0] + + +} -4) -*/ + +// 2) + +func contains_duplicates_easyway(list: [Int]) -> Bool { + + + return list.count > Set(list).count + +} + + + +// 3) + +func smallest_value(list:[Int], other_list: [Int]) -> Int? { + + return Set(list).intersect(Set(other_list)).minElement() + + + +} + + +// 4) + +func number_is_palindrome(number: Int) -> Bool { + + var array = Array() + var reversearray = Array() + var numcopy = number + + while numcopy > 0 { + + array.append(numcopy % 10) + reversearray.insert(numcopy % 10, atIndex: 0) + numcopy = numcopy / 10 + + } + + return array == reversearray + +} + + diff --git a/HWfrom1-10-016(BigO).playground/Contents.swift b/HWfrom1-10-016(BigO).playground/Contents.swift index 2040d38..4bc607f 100644 --- a/HWfrom1-10-016(BigO).playground/Contents.swift +++ b/HWfrom1-10-016(BigO).playground/Contents.swift @@ -4,27 +4,151 @@ import UIKit var str = "Hello, playground" -/* -Use the link here to get the questions. Then code your solutions below. If it does not require code, just write your answer in comments. -https://docs.google.com/document/d/1aF1imJUVahCSJAuN1OEm5lQXwpSFaAmVmAETKMM6PLQ/edit#heading=h.za36ai6n5fth +// Use the link here to get the questions. Then code your solutions below. If it does not require code, just write your answer in comments. +// https://docs.google.com/document/d/1aF1imJUVahCSJAuN1OEm5lQXwpSFaAmVmAETKMM6PLQ/edit#heading=h.za36ai6n5fth -1) -2) +// 1) +func AwesomeFilter(array: [Int], width: Int, height: Int) -> Int { + + var time = 10 //init i, store in memory + + for (var i = 0; i < width; i++) { + + time += 10 // init j each iteration of loop, store in memory + time += 3 // math operation i < width + time += 1 // access memory of i + time += 10 // write to memory + time += 3 //math operation + + for (var j = 0; j < height; j++) { + + time += 3 // math operation i < width + time += 1 // access memory of i + time += 10 // write to memory + time += 3 //math operation + time += 201 // 200 picosecond function, plus 1 psecond of memory access + } + + } + + + return time + +} +let answer = 436027010 // time in picoseconds + +let time_complexity_answer1 = "O(nm)" +let time_complexity_answer2 = "O(nm(n^2))" + -3) -4) +//2) -5) +//2a) O(n^2) -6) +//2b) -7) +func frobnicate(ys: [Int], m: Int) -> Int { + + if m == 0 { + + return 0 + } + return ys[m] + frobnicate(ys, m: m - 1) + + + +} + +//O(log(n)) + +//2c) O(n^2) + + + + +//3) + +//4) + + +func factorial(number: Int) -> Int { + + var product = 1 + for num in 1...number { + + product *= num + + } + + return product +} + +//complexity: O(n) + +//5) + +func multip(number: Int, byNumber: Int) -> Int { + + + var sum = 0 + for _ in 1...byNumber { + + sum += number + + + } + + return sum + + +} + + + +//Complexity: Wholly determined by byNumber. Linear time. + +//6) + +func peasant_mult(var number: Int, var byNumber: Int) -> Int { + + + + var sum = 0 + while byNumber != 0 { + + + if byNumber % 2 != 0 { + + sum += number + + } + + number *= 2 + byNumber = byNumber / 2 + + + } + //compexity: O(log(n)) + return sum +} + +peasant_mult(10, byNumber: 10) + + +//time complexity: + +let y = true +let x = false + + + + +//7) -*/ diff --git a/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift b/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift index bc0df91..bc1dab9 100644 --- a/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift +++ b/HWfrom1-14-16(Logic+Discrete_Math).playground/Contents.swift @@ -9,21 +9,69 @@ var str = "Hello, playground" Question 1: https://www.hackerrank.com/challenges/minimum-draws +in Python: + +import sys + +line = 1 +for lines in sys.stdin: + if line == 1: + line += 1 + continue + line += 1 + print(int(lines) +1) +constant time, after all we are only reading the int value of the line, the formula is number of pairs + 1 to determine worst-case for pairs of socks + +I did it in Python because I can't figure out how to read newlines in Swift, even with your example Ben + + Copy and paste your code: What is the big O runtime of your code?: Question 2: https://www.hackerrank.com/challenges/handshake + Copy and paste your code: -What is the big O runtime of your code?: +*/ + + +func factorial(num: Int) -> Int { + + + var product = 1 + for number in 1...num { + product *= number + } + + return product +} + +func combination(n: Int, r: Int) -> Int { + + + return factorial(n) / (factorial(r) * factorial(n-r)) + + +} + +print(combination(5, r: 2)) + +//it's a combination algorithm, only two people can shake hands at a time so n will be the number of people, and r will be 2 because two handshakers. + + +/* + +What is the big O runtime of your code?: IIRC my solution will be O(n) Question 3: https://www.hackerrank.com/challenges/connecting-towns Copy and paste your code: -What is the big O runtime of your code?: +//okay I didn't understand the format of this AT ALL, that site is barely readable, but you just multiply all the numbers of routes together + +What is the big O runtime of your code?: */ diff --git a/binarysearch.swift b/binarysearch.swift new file mode 100644 index 0000000..e5e132f --- /dev/null +++ b/binarysearch.swift @@ -0,0 +1,29 @@ +func AwesomeFilter(width: Int, height: Int) -> Int { + + var time = 10 //init i, store in memory + + for (var i = 0; i < width; i++) { + + time += 10 // init j each iteration of loop, store in memory + time += 3 // math operation i < width + time += 1 // access memory of i + time += 10 // write to memory + time += 3 //math operation + + for (var j = 0; j < height; j++) { + + time += 3 // math operation i < width + time += 1 // access memory of i + time += 10 // write to memory + time += 3 //math operation + time += 201 // 200 picosecond function, plus 1 psecond of memory access + } + + } + + + return time + +} + +print(AwesomeFilter(1000, height: 2000)) \ No newline at end of file