Skip to content

Commit

Permalink
Removed Extra Spaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsimranjot committed Jan 8, 2017
1 parent f941293 commit f1dd6b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Merge Sort/MergeSort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func merge<T: Comparable>(leftPile: [T], rightPile: [T]) -> [T] {
var leftIndex = 0
var rightIndex = 0
var orderedPile = [T]()

while leftIndex < leftPile.count && rightIndex < rightPile.count {
if leftPile[leftIndex] < rightPile[rightIndex] {
orderedPile.append(leftPile[leftIndex])
Expand All @@ -33,17 +33,17 @@ func merge<T: Comparable>(leftPile: [T], rightPile: [T]) -> [T] {
rightIndex += 1
}
}

while leftIndex < leftPile.count {
orderedPile.append(leftPile[leftIndex])
leftIndex += 1
}

while rightIndex < rightPile.count {
orderedPile.append(rightPile[rightIndex])
rightIndex += 1
}

return orderedPile
}

Expand Down

0 comments on commit f1dd6b6

Please sign in to comment.