This is just great! Especially because you did not show just a regular algorithm but a real application of an algorithm in a real application. Thank you very much Brian, You are just Awesome!
Thanks guys, you'll notice this theme of real application programming most of my videos. I try not to present things unless there is a good context in which you can understand the topic. Hope you guys enjoy another algorithms video next week.
Please. I wish I could learn that nice dragging up menu from the master. So smooth interaction. And please consider putting it up on your website after Kindle Basic Training. It’s too good a skill to be handed out free.
Impressed by your video. I have a question Can someone explain how when you add ‘ || playlist.count > 0 ‘ an “e” gets appended to playlist variable ? Doesn’t an if statement check its conditions first before it executes what’s inside the bracket ? How does swift allow this ? What am I missing ?
Super late, but playlist.count will begin at 0, so that condition will be false until the first condition “track == selectedTrack” is true. When that first condition is true, then “playlist” will append, and the count is now 1. So now, that second condition will always be true, appending every track.
Hi, Brian! How are you doing? Very interesting video! I like swift algorithms series very much. It is very helpful when you go to the next stage from view representation to program logic. Thank you!
You can break this into separate lines, of course, but it is possible to make a one-line function to handle this task. import UIKit func wrappedArray(array: [Any], beginningIndex: Int) -> [Any] { return [Any](array.suffix(array.count - beginningIndex)) + array.prefix(beginningIndex) } let ogTracks = ["a", "b", "c", "d", "e"] print(ogTracks) print(wrappedArray(array: ogTracks, beginningIndex: ogTracks.index(of: "d")!)) print(wrappedArray(array: ogTracks, beginningIndex: 0)) print(wrappedArray(array: ogTracks, beginningIndex: ogTracks.count - 1))
Hello imherelul, for the basic course you need to know how to open up Xcode and run the simulator. I walk you through each line of code starting from the first episode so you should be able to follow along if these youtube videos are ok for you.
Hi Brian, I had a question about appending array elements, For example in an app where we get data from the web and append the data into an empty array to display for the user, is this bad for the memory? Because if elements keep getting added then the size of the array will become too large. What is the best way to do this?
Great videos, Brian! I watch them every morning with my coffee, before work :) Regarding the algorithm. What if I keep the index of the current track and just increment it as the new track starts playing. If the index == tracks.count -1 then index = 0. Would that work the same way?
What if we had an array of elements where the same element could show up 2 (or more) times, would a solution be to store the index of the last occurrence of the element and then wrap back around to the beginning of the array up to the index of that element? Just a thought experiment. I love these kinds of problems. BTW, I recently found your channel and am really enjoying the content! Cheers.
Good question, I didn't run into this scenario when building out my audio app. Depending on how the UI works, you might be able to attain the element index from the UI and you wouldn't have to worry about duplicates.
Hi Brian how about doing a video on how to design code that are ARC memory friendly? Cause right now I'm having problems memory not releasing after dismissing or pop, especially on image slideshow/carousel.. Btw thanks to your video I'm now able to develop VCs in code not using storyboard at all 🙂
more complex algorithms... i have ask for how offline and online works i.e.. i have registered but no network but I should store the value and move next and when I come online ,automatically, upload datas.... so user will not feel distracted for registration purpose..😍 pls tell me how to solve that .. hope you will ans
I think theres a framework that can help you, its called Reachability. It keeps listening for network availability and then you can upload data whenever the user gets online.
How do you come up with that! That s amazing, I dont know how I could come up with such solution. Do you find it by trying out for hours or these are things your learn from experience? Thanks, Seb
Hey Brian! Can you make a tutorial on how to make an algorythm to summarize text? I am searching so long for something like that! It would really help me out. Lars,
I mean a function that summarizes a text automatically by its paragraphs and sentences. This is an example: github.com/hyharryhuang/SwiftSummary Thanks!
This is just great! Especially because you did not show just a regular algorithm but a real application of an algorithm in a real application.
Thank you very much Brian,
You are just Awesome!
I totally agree, especially in a real application.
Thanks guys, you'll notice this theme of real application programming most of my videos. I try not to present things unless there is a good context in which you can understand the topic. Hope you guys enjoy another algorithms video next week.
This is awesome. That would be sweet if you made a Spotify remake tutorial, I've always been intrigued by that app
Thanks, I'll try to put up a Spotify series sometime in February or March.
Please. I wish I could learn that nice dragging up menu from the master. So smooth interaction.
And please consider putting it up on your website after Kindle Basic Training. It’s too good a skill to be handed out free.
I just came from school very tired, but seeing you posted another video made my day man, thank you so much, Cheers!
Glad I could brighten up your day from the misery that is school. Hope you make it through, as I had tough times in college myself.
These swift algorithm videos are pure fire!
Your tutorials are always the BEST!! Thank you so very much!!
Thanks a bunch Joyce, always glad to see you poking in to check out the videos.
Always enjoy these algorithm videos! Also would love to see you do one on binary tree data structure. Looking forward to next week!
Thanks Fabian, I'm considering doing a Binary Search algorithm next week. Stay tuned.
Sir you are a simply a legend, keep up the good work.
Hey Phil, thanks a lot. More algorithms next week.
#1 Fan I watch every video keep the amazing work!!!! Can't wait to finish the twitter app!
Thanks Matthew, hopefully next tuesday I'll be able to put up another twitter episode.
Impressed by your video. I have a question
Can someone explain how when you add ‘ || playlist.count > 0 ‘ an “e” gets appended to playlist variable ? Doesn’t an if statement check its conditions first before it executes what’s inside the bracket ? How does swift allow this ? What am I missing ?
Super late, but playlist.count will begin at 0, so that condition will be false until the first condition “track == selectedTrack” is true.
When that first condition is true, then “playlist” will append, and the count is now 1.
So now, that second condition will always be true, appending every track.
That “playlist.count > 0” is genius!
You need to bring the algorithm series back Brian.
Hi, Brian! How are you doing? Very interesting video! I like swift algorithms series very much. It is very helpful when you go to the next stage from view representation to program logic. Thank you!
+Andrey Chirkov great to know these videos are helping a lot of people out there, more to come this Friday
Maaan I love your videos, keep up
You can break this into separate lines, of course, but it is possible to make a one-line function to handle this task.
import UIKit
func wrappedArray(array: [Any], beginningIndex: Int) -> [Any] {
return [Any](array.suffix(array.count - beginningIndex)) + array.prefix(beginningIndex)
}
let ogTracks = ["a", "b", "c", "d", "e"]
print(ogTracks)
print(wrappedArray(array: ogTracks, beginningIndex: ogTracks.index(of: "d")!))
print(wrappedArray(array: ogTracks, beginningIndex: 0))
print(wrappedArray(array: ogTracks, beginningIndex: ogTracks.count - 1))
Can we get more algorithm videos please!
could you do a video on how you keep your code clean? best practices and things of that sort?
Hi Jonah, I'd like to do more of these high level coding videos but its difficult to find good examples.
+LetsBuildThatApp Under what condition do you use a guard statement?
To safely unwrap an optional, I would use an "if let" or "guard let" statement. I would use guards 95% of the time to avoid the pyramid of braces.
hey brian, for the iOS basic course on your website is their any presumed programming knowledge required?
Hello imherelul, for the basic course you need to know how to open up Xcode and run the simulator. I walk you through each line of code starting from the first episode so you should be able to follow along if these youtube videos are ok for you.
Hi Brian, I had a question about appending array elements, For example in an app where we get data from the web and append the data into an empty array to display for the user, is this bad for the memory? Because if elements keep getting added then the size of the array will become too large. What is the best way to do this?
If you're just starting out, you don't need to worry about the complexities of memory management. Just have fun.
Great videos, Brian! I watch them every morning with my coffee, before work :)
Regarding the algorithm. What if I keep the index of the current track and just increment it as the new track starts playing. If the index == tracks.count -1 then index = 0. Would that work the same way?
Seems like resetting the index should work that way, or you can use modular math to convert the index.
Great video!
Why is calling suffix method includes the track "d" while prefix does not?
Suffix works by omitting the from index element.
xcellent Brian ! you are super guy !
What if we had an array of elements where the same element could show up 2 (or more) times, would a solution be to store the index of the last occurrence of the element and then wrap back around to the beginning of the array up to the index of that element? Just a thought experiment. I love these kinds of problems.
BTW, I recently found your channel and am really enjoying the content! Cheers.
Good question, I didn't run into this scenario when building out my audio app. Depending on how the UI works, you might be able to attain the element index from the UI and you wouldn't have to worry about duplicates.
oh okay and also do I need to learn c++ before java
are they related in anyway
Hi Brian how about doing a video on how to design code that are ARC memory friendly? Cause right now I'm having problems memory not releasing after dismissing or pop, especially on image slideshow/carousel..
Btw thanks to your video I'm now able to develop VCs in code not using storyboard at all 🙂
As long as you are careful of retain cycles and use weak references when possible, you should be ok.
more complex algorithms... i have ask for how offline and online works i.e.. i have registered but no network but I should store the value and move next and when I come online ,automatically, upload datas.... so user will not feel distracted for registration purpose..😍 pls tell me how to solve that .. hope you will ans
I think theres a framework that can help you, its called Reachability. It keeps listening for network availability and then you can upload data whenever the user gets online.
Gabriel den Hartog name of the frame work....😊
Anybody know if the time complexity of getting prefix and suffix is O(1)?
Dude this was awesome =)
How do you come up with that! That s amazing, I dont know how I could come up with such solution. Do you find it by trying out for hours or these are things your learn from experience? Thanks, Seb
Usually these exercises come from projects that I've worked on and because I find them interesting I provide a small exercise based on it.
Hey would you say its important today to learn obj-c and swift? Or there is no real need to learn obj-c anymore?
I think you can learn Swift to land a junior iOS job, and then you might need to learn ObjC syntax on the job.
Hey Brian!
Can you make a tutorial on how to make an algorythm to summarize text? I am searching so long for something like that!
It would really help me out.
Lars,
If you can give me a clear example, I can put up a video on this.
I mean a function that summarizes a text automatically by its paragraphs and sentences. This is an example: github.com/hyharryhuang/SwiftSummary
Thanks!
hey @lets build that app
where do you work right now ?!
Hello disco, I currently do not work full time. All my time is occupied with contracting and keeping this youtube channel alive along with my website.
Very helpful
import UIKit
var array = ["1","2","3","4","5","6"]
var newArray = [String]()
let selectedItem = "5"
let selectedIndex = array.index(of: selectedItem)
var newIndex = selectedIndex
for index in 1...array.count {
newArray.append(array[newIndex!])
if newIndex == array.count - 1 {
newIndex = 0
} else {
newIndex! += 1
}
}
awesome bro
Thanks waseem, more algorithms next week.
Lets Build That App i am waiting 😍😍
func wrapArray(array: [String], splitAtIndex: Int) -> [String] {
if splitAtIndex >= 0 && splitAtIndex
python is my language
Thats great, I'd like to get better at python myself.
Do you like Taylor Swift?
She's great, tay tay.