Swift: Merge Sort Algorithm (iOS Interview Prep) 2022

Sdílet
Vložit
  • čas přidán 27. 08. 2024
  • In this video we will learn how to implement the popular sorting algorithm known as Merge Sort. Popular in interview questions, merge sort is based on the concept of divide and conquer. We will split input arrays by two and re-build merged sorted arrays for the final result. We will walk through the algorithm together and implement it in Swift 5 and Xcode 13.
    💻 Source Code: / iosacademy
    🎥 Subscribe for more: www.youtube.co...
    😎 Like my teaching style? Check out some of my most popular courses! courses.iosaca...
    ** Popular Series
    Building Instagram: courses.iosaca...
    Building TikTok: / @iosacademy
    SwiftUI for Beginners: ios-academy.te...
    ** Get Skillshare free for 2 Months and learn iOS
    www.skillshare...
    ** Manage all your investments from app earnings on Betterment!
    bit.ly/3eBwlI9
    ** Grow your own CZcams tech channel with TubeBuddy:
    www.tubebuddy....
    #swift #algorithms #mergeSort

Komentáře • 39

  • @talalbadreddine3978
    @talalbadreddine3978 Před 2 lety +21

    Don't stop making swift Algorithm , Full Support :)

  • @thejask2765
    @thejask2765 Před 2 lety +2

    Without any bull shit, every second in this video is informative. This is how an informative video should be. Keep up the great work. 👍

  • @vinrbi8080
    @vinrbi8080 Před 2 lety +3

    Great stuff. Thank you for all your videos. Keep up the great work

  • @asadgillani5540
    @asadgillani5540 Před 2 lety +2

    Please make more videos on swift logical thing

  • @bbuyooo
    @bbuyooo Před 2 lety +1

    I'm pleasure you are making swift algorithm! thanks!

  • @alexandergavrilov8019
    @alexandergavrilov8019 Před 2 lety

    thx for video!

  • @luyuanqiang
    @luyuanqiang Před 2 lety +1

    Nice to look at that

  • @asadgillani5540
    @asadgillani5540 Před 2 lety +1

    I love your content bro

  • @keithtalbot9504
    @keithtalbot9504 Před 2 lety +1

    I hope this will be a new series

  • @asadgillani5540
    @asadgillani5540 Před 2 lety +1

    Great content bro

  • @MuhammadSultan6
    @MuhammadSultan6 Před 2 lety +1

    Please make more 😍

  • @brxntrxn
    @brxntrxn Před 2 lety +2

    Will interview prep all be on the YT channel, or will plus members get content too?

    • @iOSAcademy
      @iOSAcademy  Před 2 lety +1

      YT will have some content. Plus members will get all premium content & coding questions

    • @brxntrxn
      @brxntrxn Před 2 lety +1

      @@iOSAcademy Sweet. Since a lot of iOS interviews have leetcode rounds, there’s definitely plenty of content you can make, like Data Structures and Algorithms in Swift (very few resources for this), as well as solving leetcode questions in a Swifty way 🤓

  • @laurapotter6321
    @laurapotter6321 Před 2 lety +1

    You probably forgot to mention the time/space

    • @iOSAcademy
      @iOSAcademy  Před 2 lety

      Yep, disnt want it to get too confusing

    • @aricks
      @aricks Před 2 lety

      @@iOSAcademy Hi) Thanks for great video! But it would be really convenient to watch one video with algorithms and with theirs complexities

  • @FG.Trickster
    @FG.Trickster Před 2 lety +1

    Awesome 👏

  • @VlasiosSokorelosTheDarkwavist

    Thank you for the video ! I would like to ask you, could you give me directions how to set up a basic CRUD application ( books and other material ) ? Also, could a timer that fires every second be implemented in terminal window ( such as a real time clock ) without the buttons of UI ? I have the code from another source, but I’m missing something to make it work in the terminal :/

  • @mallikarjunhanagandi4976

    Hi Sir,
    Is there any video available for multiple schemas in xcode ( within one source code how to maintain more than clients projects/app - white label application I can say)
    It will change app name, launch screen, app logo and some content and alert messages based on schema selection while building/running project.

  • @ssaai
    @ssaai Před 2 lety +2

    Wow 🤩

  • @HazardOfExistance
    @HazardOfExistance Před 2 lety

    How much time do you lose or gain by using this method as opposed to just .sort() on the array?

    • @MrDkk277
      @MrDkk277 Před 2 lety

      The goal of this exercise is to create the mechanics of what .sort() does. It's probable that apple uses this algorithm, or similar, in Swift for the .sort() function.

  • @manishah92
    @manishah92 Před 2 lety +1

    🙏 thanks

    • @iOSAcademy
      @iOSAcademy  Před 2 lety

      Youre welcome

    • @manishah92
      @manishah92 Před 2 lety

      @@iOSAcademy if possible show us roadmap from beginner to advance..
      What kind of things should i know if im ready for mid-senior role

  • @user-jl8xe2df4d
    @user-jl8xe2df4d Před rokem

    class Program {
    func mergeSort(_ array: [Int]) -> [Int] {
    guard array.count > 1 else {
    return array
    }
    let midIndex = array.count / 2
    var leftArray = mergeSort(Array(array[0.. rightElement {
    result.append(rightElement)
    rightIndex += 1
    } else {
    result.append(leftElement)
    leftIndex += 1
    result.append(rightElement)
    rightIndex += 1
    }
    }
    while leftIndex < leftArray.count {
    result.append(leftArray[leftIndex])
    leftIndex += 1
    }
    while rightIndex < rightArray.count {
    result.append(rightArray[rightIndex])
    rightIndex += 1
    }
    return result
    }
    }
    let program = Program()
    let sortedArray = program.mergeSort([7,2,3,4,5,5,6,7,8,9,0,3,4,5,6,7])
    print(sortedArray)