Skip to main content
Code Review

Return to Question

Added update for Swift 4. (This does not invalidate the existing answer.)
Source Link
Martin R
  • 24.2k
  • 2
  • 37
  • 95

Remark: To make this code compile with Swift 4 (or later), just replace the line

swap(&a[pivotIndex], &a[i])

with

a.swapAt(pivotIndex, i)

Remark: To make this code compile with Swift 4 (or later), just replace the line

swap(&a[pivotIndex], &a[i])

with

a.swapAt(pivotIndex, i)
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I recently answered a question answered a question on Stack Overflow about finding the k-largest element in an array, and present my implementation of the Quickselect algorithm in Swift for review.

I recently answered a question on Stack Overflow about finding the k-largest element in an array, and present my implementation of the Quickselect algorithm in Swift for review.

I recently answered a question on Stack Overflow about finding the k-largest element in an array, and present my implementation of the Quickselect algorithm in Swift for review.

Bumped by Community user
Notice removed Draw attention by Community Bot
Bounty Ended with no winning answer by Community Bot
edited tags
Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238
Notice added Draw attention by Martin R
Bounty Started worth 100 reputation by Martin R
Tweeted twitter.com/StackCodeReview/status/793605440651292672
Source Link
Martin R
  • 24.2k
  • 2
  • 37
  • 95
Loading
default

AltStyle によって変換されたページ (->オリジナル) /