[User] Please transcribe this text

[Assistant] I mean, look, there's a lot of factors going into the decision tonight. You have to consider loyalty. Yeah, and people you've been playing with.


[User] Please transcribe this text

[Assistant] Because those are really critical votes.


[User] Please transcribe this text

[Assistant] I don't think I'm out of the woods tonight yet either. I think there's a pretty big chance that I'll be catching, uh, at least a vote.


[User] Please transcribe this text

[Assistant] Because I think I still have a lot to offer the tribe. Especially if somebody needs to beat Brook.


[User] Please transcribe this text

[Assistant] But I don't think her plan will work tonight.


[User] Please transcribe this text

[Assistant] I've devoted a full year of my life to be out here. It's a long time to not win.


[User] Please transcribe this text

[Assistant] I think when you first mentioned it, people thought it was going to be good for their resume.


[User] Please transcribe this text

[Assistant] And then when they had sort of 24 hours to think about it, it was sort of like, no I don't want to go.


[User] Please transcribe this text

[Assistant] Yeah, look, going to exile, it's a bit like one foot out the door, as I see it. But we don't have a lot of choice here tonight. I think sometimes you gotta take one for the team.


[User] Please transcribe this text

[Assistant] Who have they got to choose from? We can't vote for Sharn. Tarzan's gonna stay.


[User] Please transcribe this text

[Assistant] I've come this far with a very strong alliance that I'm loyal to, and I hope that they're loyal to me, and if my number's up tomorrow...


[User] Please transcribe this text

[Assistant] I hope the people that I've had their back, I hope they've got mine. But uhm, I don't plan to lose. Fingers crossed I come out in top tomorrow.


[User] Please transcribe this text

[Assistant] Guys, they're burning. They're burning so hard. You're doing so well.


[User] Please transcribe this text

[Assistant] Wow guys, that's amazing. Well done, hang in there.


[User] Please transcribe this text

[Assistant] Tonight we go to tribal council and somebody has to go home. I want to surround myself with strong people. Michelle, for me, it's a very simple vote.


[User] Please transcribe this text

[Assistant] We just need one of them to go. One. And then they would dance.


[User] Please transcribe this text

[Assistant] Being an AFLW footballer, I am a competitive beast. Like, I've got white line fever. As soon as the whistle goes, I'm ready to go.


[User] Please transcribe this text

[Assistant] That digs into our real strength. Michelle, for me, it's a very simple vote tonight.


[User] Please transcribe this text

[Assistant] Nick is running absolute rampage through the jungle, pitching that Henry must go. Which is crazy. I don't want to keep coming back.


[User] Please transcribe this text

[Assistant] I value loyalty probably the most out of everything in this game.


[User] Please transcribe this text

[Assistant] But looking at the other tribe, they're very strong.


[User] Please transcribe this text

[Assistant] They've got a number of big boys on their side, um, you know, their girls are incredibly strong as well.


[User] Please transcribe this text

[Assistant] So, you know, strength does play a factor in my vote tonight as well. But not all the challenges are just strength. No, no, no, no, no. There's so many aspects of it.


[User] Please transcribe this text

[Assistant] So. But you take all of that into consideration. I'm not just saying that somebody who drops out first is my vote.


[User] Please transcribe this text

[Assistant] Just saying that every kind of, every component of these challenges is taken into consideration.


[User] Please transcribe this text

[Assistant] I think we're a tribe and we have to work together as a tribe. We never know what the challenge is going to be.


[User] Please transcribe this text

[Assistant] Some may play to shorter people in one, or stronger people in another, or more agile people in another.


[User] Please transcribe this text

[Assistant] We all bring different things in different ways, so I think the tribe has to remember that.


[User] Please transcribe this text

[Assistant] Well done guys. The Godfather is no more.


[User] Please transcribe this text

[Assistant] I have an SMG. I have medical. I have some mid caliber rounds. I have some small caliber rounds. I have some tacticals. I have some valuables. I need a ride over here. I need a weapon.


[User] Please transcribe this text

[Assistant] I need plates. I need rockets. I need shotgun shells. I need small cow mags. I need small cow rounds. I need some cash. I need support here. I need that. I owe you one. I fancy some mid cow rounds. I'll fly it. I'll fly the bird. I'll fly this bird. I love that. I love that. I love that armour. I love that dog tag. I love that dosh. I love that key. I love that valuable.


[User] Please transcribe this text

[Assistant] I'll take the gas mask. I'll hop in. I'll never waste ammo. I'll nick that weapon. I'll take gunner. I'll take point. I'll take point. I'll take that armour satchel. I'll take that medical. I'll take that oxygen. I'll take that weapon. I'll take that weapon case. I'll take the armour. I'll take the buzzsaw.


[User] Please transcribe this text

[Assistant] Hold tight! I've got your sex! I've recovered! JLTV here! Just leave me! Go!


[User] Please transcribe this text

[Assistant] Let's grab the elimination contract. Let's grab the stronghold contract. Let's have the hunt contract, yeah? Let's nick that bounty contract. Let's nick that cargo contract, yeah? Let's nick that recon contract. Let's regroup here. Let's take out that gun, yeah? Let's take that most wanted contract.


[User] Please transcribe this text

[Assistant] Let's take the job. Lift here. LMG marked. Loading. Loading. Loading AP rounds. Loading AP rounds. Loadout crate here. Loadout drop here. Loadout inbound. Loadout inbound. Located a bomb drone. Located a cluster mine.


[User] Please transcribe this text

[Assistant] Marking enemy fighter. Marking enemy infantry. Marking enemy mortar team. Marking enemy special forces. Marking enemy special mission unit. Marking leafels. Marking target area. Marksman rifle here. Mask up!


[User] Please transcribe this text

[Assistant] What's in coming? Med supplies here. Melee weapon marked. Marked one. Merked that totter. Mood caliber rounds here. Mind if I join you? Meet!


[User] Please transcribe this text

[Assistant] NEED TO HEAL! NEGATIVE! NO THANKS! NO DEAR! NO COMBAT IN HERE! NOPE! NORTH! NORTH! NORTH EAST! NORTH EAST! NORTH WEST! NORTH WEST! NEVER GOING DOWN!


[User] Please transcribe this text

[Assistant] Last rockets! Oi! That wreck's gonna burn, innit? Oi! That's a good place to land! On me. On me. On my location. On my location. On my mark. Open door here. Our air support is on station. Our portable radar is active. Patching up!


[User] Please transcribe this text

[Assistant] Radio Tower here. Rally here. Recon contract marked. Recon drone located. Recon drone online. Recon drone online. Recon here. Recon tablet here. Reloading. Reloading. Requesting buyback. Ready to redeploy. Requesting airstrike.


[User] Please transcribe this text

[Assistant] Requesting smoke wall at this location. Return the bomb. Return the device. Return the flag. Return the HBT. Return the package. Return with the objective. Revive pistol here. Riot shield enemy here. Rog. Rog!


[User] Please transcribe this text

[Assistant] Secure hotel. Secure the bomb. Secure the device. Secure the flag. Secure the HBT. Secure the juggernaut. Secure the objective. Secure the package. See you later. See you later. Self-revive kit here. Semtex! Semtex here. Semtex incoming!


[User] Please transcribe this text

[Assistant] Someone's nicked the whole shop. Stay alert. Someone's nicked the whole shop. Stay alert. South. South. South-East. South-East. South-West. South-West. Special forces marked. Spit it, you tosser! Where are your mates?


[User] Please transcribe this text

[Assistant] Coming. Suppression mine here. Suppression mindset. Suppression mindset. Sure. Sure. Sure. Why not? Switching mags. TAC camera here. TAC insert here. Tactical equipment marked. Tactical grenade here. Tactical rope here. Tacticals here. Tacticals on my mark.


[User] Please transcribe this text

[Assistant] Tear gas grenade here. Tell me where they are. Thank you. Thanks for that. That game was mint. That proximity mine's ours. That self-revive's mine. That took the piss! That's an enemy airstrike!


[User] Please transcribe this text

[Assistant] They're gonna regret letting me get this. They're gunning for me! They got me pinned! This door's closed. This is Nova. I'm back in the AO. This is Nova! I'm back in the AO! This is Nova.


[User] Please transcribe this text

[Assistant] Request an MGB payload. This one's cold. This one's lost their teeth. This one's on ice. This vehicle's been neutralised. This'll get me sorted. This'll make you better. Threats in the area. Throw in a snapshot!


[User] Please transcribe this text

[Assistant] Too close, that one. Took care of that enemy, Hilo. Took out the mime! Took out their APC! Took out their vi-


[User] Please transcribe this text

[Assistant] Visual on an x-ray. Visual on enemy air support. Visual on the bomb. Visual on the device. Visual on the enemy. Visual on the flag. Visual on the HBT. Visual on the objective. Visual on the package.


[User] Please transcribe this text

[Assistant] Visual on x-rays! Wanna roll together? Watch out! That vehicle could blow! We control the sand site!


[User] Please transcribe this text

[Assistant] We have a recon orbit in the AO. We threw a shot stick here. We threw tear gas here. West! West! We've got an advanced UAV here. Wilson out! Oh! Used and revived!


[User] Please transcribe this text

[Assistant] Active friendly kill street here. Active friendly recon up here. Advanced enemy infantry spotted. Advanced infantry sighted. Affirmative. Affirm. Ah, sod off, you tosser. Air drop marked. Airstrike tablet here. Airstrike up for grabs.


[User] Please transcribe this text

[Assistant] Armor here. Armor here. Armor pouch marked. Assault rifle marked.


[User] Please transcribe this text

[Assistant] Copy. Good LZ. Copy, I see the low dark crate. Copy.


[User] Please transcribe this text

[Assistant] I see the vehicle. Copy. I'm moving your way. Copy. I'm moving your way. Copy. I'm moving your way. Copy. Let's grab the Geiger contract. Copy. Let's secure that intel. Copy that.


[User] Please transcribe this text

[Assistant] Copy, visual on a CV. Copy, visual on the area. Copy, visual on the hostage. Copy, visual on the loot cache. Copy, visual on the safe. Copy, visual on the SAM site. Copy, visual on the target. Copy, visual on the UAV tower. Copy, visual on the weapon case. God blimey! God blimey, I'm down!


[User] Please transcribe this text

[Assistant] Defend Objective Hotel. Defend the bomb. Defend the carrier. Defend the device. Defend the flag. Defend the HVT. Defend the objective. Defend the package. Defending here. Diffuse Objective Alpha.


[User] Please transcribe this text

[Assistant] Diffuse Objective Hotel. Diffuse the bomb. Diffuse the charge. Diffuse the device.


[User] Please transcribe this text

[Assistant] Diffuse the HVT. Diffuse the objective. Diffuse the package. Deploying Pocahontas here. Deploying Wilson. Destroy target Alpha. Destroy target Bravo. Destroy target Charlie. Destroy target Delta. Destroy target Echo. Destroy target Foxtrot. Destroy target Golf.


[User] Please transcribe this text

[Assistant] Destroy Target Hotel. Destroy that target. Destroy the bomb. Destroy the device. Destroy the flag. Destroy the HVT. Destroy the package. Destroy the target. Destroy their ammo box.


[User] Please transcribe this text

[Assistant] DESTROYED THEIR DRONE! DESTROYED THEIR MOTORBIKE! DISREGARD THAT! DON'T WORRY!


[User] Please transcribe this text

[Assistant] Enemy killstreak marked. Enemy killstreak marked. Enemy lethal equipment here. Enemy lethal here. Watch yourself. Enemy loadout drop marked. Enemy marked. Enemy mortar team here.


[User] Please transcribe this text

[Assistant] Watch Hilo marked! Enemy proximity mine here! Enemy recon drone is down! Enemy recon drone is down! Enemy recon drone marked! Enemy recon marked! Enemy rover destroyed! Enemy sentry destroyed! Enemy sentry marked!


[User] Please transcribe this text

[Assistant] Enemy tank cams down! Enemy tactical equipment here! Enemy tactical equipment marked! Enemy tactical insertion destroyed! Enemy tactical insertion destroyed! Enemy tank marked!


[User] Please transcribe this text

[Assistant] Enemy Wilson disabled. Enemy Wilson marked. Enemies close. Enemies nearby. Engage the device. Engage the HVT. Engage in here. Exfil bird marked. Extract point marked. Extraction balloon here. Eyes up. This area's hot. Fancy joining up?


[User] Please transcribe this text

[Assistant] Flash out, flash bang grenade here, for Queen and Country! Found a care package, found a cargo contract.


[User] Please transcribe this text

[Assistant] Friendly drill charge here. Friendly emergency airdrop here. Friendly fast movers here. Friendly gun trip in the airspace. Friendly juggernaut crate here. Friendly kill streak here. Friendly lethal here. Friendly stealth bomber in the airspace. Friendly suppression mine here. Friendly tag camera here. Friendly tacticals here.


[User] Please transcribe this text

[Assistant] Good loot here. Good to be back on the battlefield. Got a boat here. Got a buy station here. Got a contract here. Got a cruise missile here. Got a friendly here. Got a gun safe contract here.


[User] Please transcribe this text

[Assistant] Woah, woah, woah, woah, woah, woah, woah, woah, woah. Split it with them. Cook in the land.


[User] Please transcribe this text

[Assistant] Now somebody has an advantage and I want to find who it is.


[User] Please transcribe this text

[Assistant] All out my magnifying glass, like trying to pull all the information together to see who I could find out. Has he got Pandora's box? Could be Jackie.


[User] Please transcribe this text

[Assistant] I don't know, I mean I think it just kinda came down to who would flip to new alliances and where collateral damage would land. And I think Abby seemed like a pretty good choice.


[User] Please transcribe this text

[Assistant] What do you want me to do? Since the tribe swap, have you ever been to a tribal council?


[User] Please transcribe this text

[Assistant] There's a lot of unknown untested alliances being floated.


[User] Please transcribe this text

[Assistant] The way you vote will set up the rest of the game going towards merge. And I got big plans for this tribal tonight.


[User] Please transcribe this text

[Assistant] The way I see it, Nick is the original snake. The pioneer, if you will. He's a threat to me, so he's gotta go. The plan tonight, I'll get everyone voting to blindside Nick.


[User] Please transcribe this text

[Assistant] But to make sure I have the numbers tonight, I know that I need to get the old Vekama members, Tarzan, Moe, and Jackie on my side.


[User] Please transcribe this text

[Assistant] Previously, Moe and I have been pitted against each other because I want everyone to think that Matt and I have pitted against each other.


[User] Please transcribe this text

[Assistant] So tonight's a double tribal council. Both tribes are going to war tonight.


[User] Please transcribe this text

[Assistant] You wanna impress the other tribe, so I'm hoping they see it a big blind side on Nick tonight. And they know we're for real.


[User] Please transcribe this text

[Assistant] Yeah, sure. I think, uhm, we haven't really had a chance to test alliances and so people are kind of wondering if those new lines that have been drawn are going to stay true.


[User] Please transcribe this text

[Assistant] I think it's all-stars, I think tribal lines are blurred immediately, and especially with these new tribes, uhm, it's about forging lasting alliances that'll take you further in the game.


[User] Please transcribe this text

[Assistant] No, I mean, I, I trust in the people that I, I talked to today. I think we had some really good conversations and, um, came to a good agreement and a good name. And, um, that's what I plan to stick to.


[User] Please transcribe this text

[Assistant] Oh my god, this is amazing.


[User] Please transcribe this text

[Assistant] Lockie and his majority alliance. Everything that I want to happen is happening. Have knocked off their enemies.


[User] Please transcribe this text

[Assistant] When Makuta lost the last immunity challenge, they led the charge to get rid of Nick.


[User] Please transcribe this text

[Assistant] At Tribal Council, Nick made a last ditch effort.


[User] Please transcribe this text

[Assistant] 12 of the lefts. Who will be voted out tonight?


[User] Please transcribe this text

[Assistant] Welcome to getting their first look at the new Makuta Tribe. Nick, voted out last night's Trump Council.


[User] Please transcribe this text

[Assistant] Moana, making merch gets you one step closer to that half mil. What would that money do for you?


[User] Please transcribe this text

[Assistant] David, you still have to beat 11 others to win. So what do you want to say to these players standing here right now?


[User] Please transcribe this text

[Assistant] Once again, this game has reset. And now the people you have to beat are not on the other tribe. They're standing right next to you.


[User] Please transcribe this text

[Assistant] With 12 of you left and 21 days to go, may the best all-star win.


[User] Please transcribe this text

[Assistant] For today's challenge, you're gonna hold onto a clay pot tethered to a bean.


[User] Please transcribe this text

[Assistant] If at any point you let it go, it'll smash on the rail. You're out of the challenge. Last person left standing wins reward. Wanna know what you're playing for?


[User] Please transcribe this text

[Assistant] It will be a leg up in the challenge that could be the difference between staying in the game and going home. Worth playing for?


[User] Please transcribe this text

[Assistant] Alright, here we go. Everyone's in position. For a reward, this challenge is now on.


[User] Please transcribe this text

[Assistant] It's not easy holding that awkward position.


[User] Please transcribe this text

[Assistant] I feel so heavy. I'm being called right after this. First challenge after Merge. First opportunity to size up your competition.


[User] Please transcribe this text

[Assistant] The truth is Merge also brings with it a new level of uncertainty. I'm about to let go.


[User] Please transcribe this text

[Assistant] Just like that, not even a minute into the challenge. AK is out. No shot at that reward. That's interesting.


[User] Please transcribe this text

[Assistant] You guys have been out there fifteen minutes. I'm not torture.


[User] Please transcribe this text

[Assistant] Sean ain't trying to reposition. Trying to get a grip on that pot.


[User] Please transcribe this text

[Assistant] That's it! Shawnee is out of the challenge.


[User] Please transcribe this text

[Assistant] You guys have been out there for 40 minutes. How much more you got in you there?


[User] Please transcribe this text

[Assistant] We're down to six. Jackie, Lee, Moana, Lockie, Sean, and Zach. Still in it.


[User] Please transcribe this text

[Assistant] In a moment, I'm gonna count you in. You're gonna go to one hand.


[User] Please transcribe this text

[Assistant] But you need to choose which hand that's going to be because you're going to stay with that hand for the rest of the challenge. Alright guys, here we go. Three, two, one.


[User] Please transcribe this text

[Assistant] Sean really starting to struggle. Starting to shake.


[User] Please transcribe this text

[Assistant] That's it. She loses a pot, she's out of the challenge.


[User] Please transcribe this text

[Assistant] Lockie continues to move around trying to find something comfortable.


[User] Please transcribe this text

[Assistant] Moana drops her pot, she's out of the challenge.


[User] Please transcribe this text

[Assistant] Sided out 12, we're down to 4. Jacky, Lee, Zack, and Locky, the only one still on the running for Vakama.


[User] Please transcribe this text

[Assistant] Walkie's had enough. He's out of the challenge.


[User] Please transcribe this text

[Assistant] Jackie, Lee, and Zack, battling it out for that reward.


[User] Please transcribe this text

[Assistant] And just like that, Zach drops. He is out of the challenge.


[User] Please transcribe this text

[Assistant] One lapse in concentration, give up that very nice reward.


[User] Please transcribe this text

[Assistant] Congratulations. You will start favorite in tomorrow's immunity challenge. You'll find out what the advantage is then. And as for the rest of you.


[User] Please transcribe this text

[Assistant] Sean, do you guys decide on a new tribe name?


[User] Please transcribe this text

[Assistant] So, AK, how's everyone settling in over at ColoColo? I think...


[User] Please transcribe this text

[Assistant] With this around your neck, you are safe. You cannot be voted out. Without it, you're vulnerable.


[User] Please transcribe this text

[Assistant] While balancing on a seesaw, you're gonna take blocks from one side and attempt to stack them on the other side.


[User] Please transcribe this text

[Assistant] First person to stack all nine blocks. Wins immunity, safer in the boat.


[User] Please transcribe this text

[Assistant] As for the rest of Tribal Council tonight, where one of you will become the 13th All-Star voted out of this game. Lee.


[User] Please transcribe this text

[Assistant] You're gonna need really good balance and a steady hand.


[User] Please transcribe this text

[Assistant] First tribal after merge. Potentially the most dangerous.


[User] Please transcribe this text

[Assistant] Everyone's coming together for the first time and you don't really know where everyone stands. And then the tribe of all-stars, you are swimming with the sharks.


[User] Please transcribe this text

[Assistant] Be nice to have that necklace around your neck. Guarantee yourself another day in the game.


[User] Please transcribe this text

[Assistant] Wow, Shoni is a machine on this challenge. Just stacking block after block after block. Placing her sixth. Nine blocks for the win. Many to stay up for three seconds.


[User] Please transcribe this text

[Assistant] Trying to steady that stack. One wrong move. He's gonna have to restart.


[User] Please transcribe this text

[Assistant] Book drops. Jackie, everyone's dropping quickly in this challenge. Anyone can drop at any moment. That's why you need to keep fighting.


[User] Please transcribe this text

[Assistant] Harry has five. Chase and Shawnee. Laser focused.


[User] Please transcribe this text

[Assistant] He drops. Locky really struggling. His locks wobbling all over the place.


[User] Please transcribe this text

[Assistant] Lee has three. Because of his advantage yesterday, he only has to stack eight today.


[User] Please transcribe this text

[Assistant] That could be the difference in a challenge like this.


[User] Please transcribe this text

[Assistant] Shani getting very close. She has eight blocks stacked. Going for her ninth. But that ninth is incredibly difficult. And it drops! Opening the door for Harry. He's in the lead now. He has six blocks.


[User] Please transcribe this text

[Assistant] Harry drops. Here we go again. Everyone continues to drop their stacks. Brooke has five now. Had five. It speaks to the difficulty of this challenge. AK struggling. Slipping all over the place.


[User] Please transcribe this text

[Assistant] Shani quickly rebuilding again. Lacing her sixth. Everyone chasing Shani.


[User] Please transcribe this text

[Assistant] This is your first post-merge tribal. Correct. So how do you think tonight's tribal is different from all the others that you've been to?


[User] Please transcribe this text

[Assistant] Wow, Blocky, that's just, like, he's just laying it all out there right out of the gate.


[User] Please transcribe this text

[Assistant] On the surface, it would seem that you guys are in the minority.


[User] Please transcribe this text

[Assistant] Harry, Lockie seems to think that there are cracks over there to be exploited.


[User] Please transcribe this text

[Assistant] Do you think there's gonna be a consequence to tonight's vote when you go back to camp?


[User] Please transcribe this text

[Assistant] Well, Harry, I mean, to that point, you know, this game awards the brave. Do you think anyone here is brave enough to make that first move?


[User] Please transcribe this text

[Assistant] Think you have a handle on where the loyalties are in this tribe?


[User] Please transcribe this text

[Assistant] So Lockie, how confident are you you're gonna end up on the right side of the numbers tonight?


[User] Please transcribe this text

[Assistant] Okay, once the votes are read, the decision is final. The person voted out will be asked to leave the tribal council area immediately. I'll read the votes.


[User] Please transcribe this text

[Assistant] Tomorrow night on Australian Survivor.


[User] Please transcribe this text

[Assistant] Are about to blow this game apart.


[User] Please transcribe this text

[Assistant] But, it's the final challenge of last season.


[User] Please transcribe this text

[Assistant] When the most brutal challenge in Australian survivor history returns to haunt him.


[User] Please transcribe this text

[Assistant] Well Harry, buckle under the pressure.


[User] Please transcribe this text

[Assistant] Okay, okay, I'll make it fun. I'll take her to that crab place. All the crabs you can smash.


[User] Please transcribe this text

[Assistant] She might marry someone like me? You think that would be bad?


[User] Please transcribe this text

[Assistant] Yo, what's going on guys? Tanmayar for Simple Snippets and welcome back to another video tutorial on data structures and algorithms. And in this video tutorial, we are going to be implementing the binary search algorithm using C++ programming language.


[User] Please transcribe this text

[Assistant] And in the previous video tutorial that is part 1 of binary search, we discussed the algorithm, we discussed the working, we also saw diagrammatic representation.


[User] Please transcribe this text

[Assistant] And we went through the algorithm step by step to understand its working. So if you have missed that video, do check it out. It will give you a very clear idea about how exactly binary search works. If you already know that, and if you're just interested for the programming part, that is the implementation part, this video is just for you. Make sure you watch this video till the end.


[User] Please transcribe this text

[Assistant] And we're gonna be using C++ programming, you can use any other general purpose programming language like Java, Python, C sharp or anything you're comfortable with.


[User] Please transcribe this text

[Assistant] I'm using C++, so with that being said, let's get started.


[User] Please transcribe this text

[Assistant] So I've already opened up my DaveC++ ID. I'm using this ID for C++ programming. And as you can see, I've already created a little bit of


[User] Please transcribe this text

[Assistant] C++ code that is the main function. Now inside this main function what we'll do is we'll just take the input from the user. So we'll create int x or int num.


[User] Please transcribe this text

[Assistant] So this is the number that we will take from the user and search it in our array. So we'll just create an array.


[User] Please transcribe this text

[Assistant] For simplicity purpose, I'm hard coding the size. You can also do the dynamic memory allocation part and take the size from the user.


[User] Please transcribe this text

[Assistant] If you don't know what dynamic memory allocation is or if you are struggling with C++ programming, I have a complete C++ programming tutorials playlist. I will drop that link in the video description or you can also see a card.


[User] Please transcribe this text

[Assistant] So now that we've created the array of size 10, one last thing that we have to do is we have to take the output. So what we'll do is we'll create a function, a user defined function, let's say int


[User] Please transcribe this text

[Assistant] And x value that we want to search. Okay. So I hope you know how binary search algorithm works. Basically binary search algorithm divides the sorted array. So we have to have a sorted data structure. So it divides the sorted array into halves. We find the midpoint and the value that we want to find out, which is this index. So this is index. If this value


[User] Please transcribe this text

[Assistant] So we divide the array into two parts by finding out the midpoint and every time we check the midpoint value with this x value that we want to find out and once we get a match we just return the index position.


[User] Please transcribe this text

[Assistant] I'll also drop the entire algorithm on the right so you can see the algorithm or the pseudo code for this binary search algorithm which we saw in the previous video. We'll just go step by step and convert that algorithm into C++ code. Okay.


[User] Please transcribe this text

[Assistant] So this is going to be our binary search function. It is going to take four values, the array.


[User] Please transcribe this text

[Assistant] Left interval, right interval and the value that you want to find out. So in the main function, we'll just first


[User] Please transcribe this text

[Assistant] In ascending order, remember that binary search algorithm only works on sorted arrays or sorted data structures that is list data structure and any other linear data structure because the main idea of binary search is to divide the array into two halves and it is important that the array or the data structure has to be in a sorted way, especially in ascending order in our case. Okay, so now here I'm saying enter 10 integers in ascending order.


[User] Please transcribe this text

[Assistant] Since our main function has a return type of int, that's why we have to return a value. Anyways, we'll use the for loop. I'll say int i equals to zero, i less than 10 and i plus plus. So we know we have


[User] Please transcribe this text

[Assistant] 10 values to take, so we are running the loop from 0 to 10. And I'm gonna say arr of i. So we'll say c in arr of i. Okay, this is how you take input in C++. Let's rename this to myArray.


[User] Please transcribe this text

[Assistant] Okay, my ARR and over here also I'll make that change.


[User] Please transcribe this text

[Assistant] So we will pass our my array over here, my arr. This is how you pass an array. Just use the array name and not the square brackets. The left would be zero. So left is actually the leftmost index position.


[User] Please transcribe this text

[Assistant] In this array is just taken over here. So we will pass this num over here. So initially when we start off obviously the interval.


[User] Please transcribe this text

[Assistant] Is gonna be 0 and 9 that is the leftmost end of the entire array and the rightmost end of the entire array and then we will divide this array into shorter or smaller chunks. So that we will do in the binary search function. Okay, and lastly we will say if output equal equal to minus 1. We will just print a message of cout


[User] Please transcribe this text

[Assistant] If it is not equal to minus one, it will mean that we have found the match and the output this variable will be holding the index position. So this is output and not output. I made a typo.


[User] Please transcribe this text

[Assistant] Fair enough. Even if you are not really understanding everything, we still have to make this main binary function.


[User] Please transcribe this text

[Assistant] So let's go step by step. You have the algorithm on the right. So step number one is to take input, take all these inputs. So we have passed those inputs in this function over here. So basically step number one is already done. We pass these values as arguments in this function.


[User] Please transcribe this text

[Assistant] So step number two is where we start the loop, right? So we will say while. Now in the while loop, what is the condition? Left is less than equal to right, right?


[User] Please transcribe this text

[Assistant] So if you watch the previous video, obviously you will understand it very well. But what we're doing is initially the interval is 0 and 9. So we are searching through the entire array for the first iteration. However, once we find the midpoint, we will check


[User] Please transcribe this text

[Assistant] So this left value and right value will slowly come closer to each other and there will be a point where left value will no longer be less than equal to right and that is when the while loop will exit.


[User] Please transcribe this text

[Assistant] And when left value will not be less than equal to right, it will mean that we have completely exhausted the interval and now there is no values to search. So if we did not find a match, we can simply return minus 1. Okay, so that's the minus 1 condition. But let's just go step by step. Let's do step number 2.1, which is finding out the midpoint. So I'm going to say int mid equals to left plus right minus left divided by 2. Now,


[User] Please transcribe this text

[Assistant] So we just found out midpoint over here. Now we are checking if


[User] Please transcribe this text

[Assistant] The value at this midpoint is it equal equal to the value that we want to find out. So we passed num over here.


[User] Please transcribe this text

[Assistant] This num is becoming x over here. So these are just placeholders, right? I hope you know how to pass arguments in a function. We've already discussed that in C++ programming tutorials. So I'm just trying to check if the midpoint that we just found out is the value at the mid index equal equal to the value that we want to search. If yes, then we simply have to say return.


[User] Please transcribe this text

[Assistant] Mid, that is return the index position where the value is matching. That's it. So this complete function will exit out because when we use the return function, the control is transferred from the called function to the calling function.


[User] Please transcribe this text

[Assistant] Mid value that is the mid index position will be returned from this binary search function.


[User] Please transcribe this text

[Assistant] And it will be stored in the output variable. So we are calling the function over here. So the control is transferred to the binary search function. And once you use the return statement, the control is again transferred back to the calling function that is inside the int main and the value stored in the output variable. This is an integer variable.


[User] Please transcribe this text

[Assistant] And our return type is also int. So that mid index position is stored over here. Okay. Now if there is no match.


[User] Please transcribe this text

[Assistant] Then we have another elsif condition over here. You can see in the algorithm also. So that is 2.3. We are saying elsif arr of mid.


[User] Please transcribe this text

[Assistant] If it is less than x, it will mean that our x value that is the value that you want to find out lies in the second half of the array, right? So in that case, we will say left equals to mid plus one.


[User] Please transcribe this text

[Assistant] So now we are reducing the interval and now the interval will be only between the second half of the array.


[User] Please transcribe this text

[Assistant] So if the mid value is less than the value that we want to find out, it means that the value that we want to find out lies in the second half and this is because the array is sorted already and hence binary search algorithm only works on sorted arrays or sorted data structures. Okay, so I hope you are understanding.


[User] Please transcribe this text

[Assistant] Now if error of mid is not less than x, if let's say it is greater than or equal to x, in that case,


[User] Please transcribe this text

[Assistant] Rx value will be in the left most side right of the array.


[User] Please transcribe this text

[Assistant] So we have divided the array at the midpoint and we have two halves, the left half and the right half. If arr of mid, that is the midpoint value.


[User] Please transcribe this text

[Assistant] The value at the midpoint is greater than the value that we want to find out, then our value will be residing in the leftmost side, right, because it is a sorted array. So in that case, we will reduce the interval from the right hand side. So now I'm going to say right equals to mid minus one.


[User] Please transcribe this text

[Assistant] So now we are only interested in the first half or the left half of the array. So obviously this while loop will keep on executing till we find a match wherein the midpoint or the value at the midpoint will match the x and once we match it, we just return it.


[User] Please transcribe this text

[Assistant] And if we do not find a match, there will be a time when the interval will get exhausted and this statement will be false. So we will come out of the while loop.


[User] Please transcribe this text

[Assistant] And if we basically come out of the while loop without any return mid statement, it would mean that we did not find any match, right? So in that case, we will say return minus one.


[User] Please transcribe this text

[Assistant] So we'll say return minus one. And minus one is not a valid index, right? We do not have minus one as index in arrays. The index position always starts from zero. So we can use it as an indicator to say that we did not find any match.


[User] Please transcribe this text

[Assistant] So this is basically our complete binary search function. So you converted the entire algorithm into binary search function in C++ code. You can use this same algorithm.


[User] Please transcribe this text

[Assistant] And you can implement it in Java or Python also, only the syntax will change here and there. But pretty much everything will be


[User] Please transcribe this text

[Assistant] The same when it comes to the algorithm. So yeah, this was our


[User] Please transcribe this text

[Assistant] Program, let's see if this works. I'm going to save this. I'm going to say execute compile and run.


[User] Please transcribe this text

[Assistant] And then for simplicity purpose hit enter. Now it is asking enter one number that you want to search in the array. So let's enter it.


[User] Please transcribe this text

[Assistant] And there you can see match found at index position 7. So index position starts from 0, right? So 0, 1, 2, 3, 4, 5, 6, and 7. So that's why we've returned the index position 7. The actual position is actually 8th position, right? So you can say index plus 1 if you want the actual position.


[User] Please transcribe this text

[Assistant] But this is the index position because index starts from 0 that's why it is 1 less than the actual position. So let's try to run this one more time. I'm again gonna enter 10 numbers.


[User] Please transcribe this text

[Assistant] And return minus one is stored in the output. And we're checking if output is equal equal to minus one, we have to print no match form.


[User] Please transcribe this text

[Assistant] So yeah, this is our binary search algorithm implemented in the form of C++ code in the form of a binary search function. Now, before we conclude, I just want to say that binary search can also be implemented in the form of a recursive function.


[User] Please transcribe this text

[Assistant] Now in this case, in our case, we are using a while loop. So it's a simpler way. However, you can also use a concept of recursive function over here. And if you don't know what recursive function is, I have a separate video on recursive functions. I'll drop the link in the video description. If you want to see binary search being implemented using recursive functions, let me know in the comments below. I'll try to.


[User] Please transcribe this text

[Assistant] Make one more video wherein we use recursive functions. And yeaah, that's it for this video guys. This is our binary search algorithm using C++ programming. I hope you've understood the program part, the implementation phase. And that's it for this video guys. If you like this video, please give it a thumbs up. Let me know in the comments how this video was and I'll see you guys in the next one. Peace.


[User] Please transcribe this text

[Assistant] This tastes so juicy.


[User] Please transcribe this text

[Assistant] This tastes so sweet.


[User] Please transcribe this text

[Assistant] This tastes so spicy.


[User] Please transcribe this text

[Assistant] This tastes so bitter.


[User] Please transcribe this text

[Assistant] This tastes so yummy.


[User] Please transcribe this text

[Assistant] I have served before, but I'm probably not very good.


[User] Please transcribe this text

[Assistant] Vengeance. I'm ready to break that alliance apart.


[User] Please transcribe this text

[Assistant] Once intoxicated, we had a great idea. Hey swings!


[User] Please transcribe this text

[Assistant] Oh, am I gonna die in a playground like some uncoordinated child?


[User] Please transcribe this text

[Assistant] But I did learn something from all this. The sprinklers in this park come on at 3 a.m.


[User] Please transcribe this text

[Assistant] Oh, are the kids with you? Hi dad. Homer. Hey guys, why are you ducked down like that?


[User] Please transcribe this text

[Assistant] Andres Kontor, you know that is incorrect usage? You know that is incorrect usage?


[User] Please transcribe this text

[Assistant] I would like to congratulate you on your fine officiating today.


[User] Please transcribe this text

[Assistant] Social studies. Create a list of different kinds of homes with your class.


[User] Please transcribe this text

[Assistant] I am eight. I am two blocks wide by four blocks tall. I am two by four. I am a rectangle. Up, up, and away!


[User] Please transcribe this text

[Assistant] There's your shampers, Jack. Love it. So, Jackie, big question. Yeah? This might sting a little bit for Zack. But, last travel.


[User] Please transcribe this text

[Assistant] I love that. But you making that move got a lot more respect for you for doing that. We loved it. Absolutely loved it.


[User] Please transcribe this text

[Assistant] They've come this far and I'm not ready to give it up for anything.


[User] Please transcribe this text

[Assistant] I planned to come in here and play a quiet, strategic game because I knew there was going to be loud game players and I just didn't want to be another loud game player. I wanted to be me.


[User] Please transcribe this text

[Assistant] While everyone was strategising early, I was focused on building strong and loyal relationships. People came to me with information while I called the shots. People wanted to protect me and work with me because they wanted the safety of the loyal alliance that I built.


[User] Please transcribe this text

[Assistant] I didn't come back just to give it a shot. I'm back to win. I've sacrificed more than you can possibly imagine to be here.


[User] Please transcribe this text

[Assistant] I look after my entire family. I take care of my mum who's very ill and I'm full time care of my beautiful disabled sister Vinnie.


[User] Please transcribe this text

[Assistant] The last 49 days, I could be at home taking care of everybody. But I know that they want me to give this everything.


[User] Please transcribe this text

[Assistant] I think I've barely kissed her, Jonathan, since I got married, so.


[User] Please transcribe this text

[Assistant] Sorry much, Jonathan. Like, our family, my family, Belle's family, you know, to be able to have that kind of money would be unbelievable and what it could do for us could change our lives.


[User] Please transcribe this text

[Assistant] Uh, Dave won. And now he has to choose between me and Sean.


[User] Please transcribe this text

[Assistant] Since David and I have formed an alliance, I've stuck by him through thick and thin. And I feel like I've had his back, uhm, more than almost anybody in this game.


[User] Please transcribe this text

[Assistant] Dave now needs to make a decision. It's a tough decision, but he has to make a decision what's best for his game, but he also has to factor in the jury.


[User] Please transcribe this text

[Assistant] And then you've got Sean, who addresses a jury for a living. And she's been here before. She's addressed them before. She knows what that's about. Imagine what she'll do to you if she went to talk to you.


[User] Please transcribe this text

[Assistant] But I want that opportunity. I've laid my ass off. It's no fluke that I'm still sitting here at top three. It ain't a fluke. I've got a story to tell and I want to tell my story. Sean's had her chance. I want my chance.


[User] Please transcribe this text

[Assistant] Prove it to the jury that you're the best that's ever played the game and beat me.


[User] Please transcribe this text

[Assistant] So you, you wanted to risk my game to test Tarzan's trust.


[User] Please transcribe this text

[Assistant] If you want to make a move, you have to own it. This is all-stars. Like, own your moves.


[User] Please transcribe this text

[Assistant] Just to clarify, you're saying your biggest move in this game is a move that you did nothing on.


[User] Please transcribe this text

[Assistant] You know, you sat next to me, travel in, travel out saying, I wanna be with the best.


[User] Please transcribe this text

[Assistant] I need to know exactly why you need my vote and that half a million dollars that we all wanted.


[User] Please transcribe this text

[Assistant] David, if Brooke's assessment is correct, and you don't win, then you're not going to the final two.


[User] Please transcribe this text

[Assistant] Losing today's immunity challenge was so rough because I knew as soon as that was done, my game was pretty much done.


[User] Please transcribe this text

[Assistant] So nice to hear from her. Oh, I need to get clean now.


[User] Please transcribe this text

[Assistant] Being out here and playing from the bottom, that's just made me realise that I'm even stronger than I thought. When I was first asked to be in All-Stars, you know, I did question if I deserved it, and I think I've very well proven that I do.


[User] Please transcribe this text

[Assistant] He runs to the plane.


[User] Please transcribe this text

[Assistant] What I Like. Written by W.E. Strauss. Illustrated by Rebecca Thornburg.


[User] Please transcribe this text

[Assistant] Uh, today we're gonna be discussing more irregular plurals. So this is the irregular plural part two, the tuning.


[User] Please transcribe this text

[Assistant] Because we really want to focus on this N particle. I'll explain in a minute. So, previously we discussed the idea that there's, you know, one regular plural.


[User] Please transcribe this text

[Assistant] And then there are a couple of different kinds of irregular plurals.


[User] Please transcribe this text

[Assistant] I'd like to introduce something else to the word child.


[User] Please transcribe this text

[Assistant] Like I said, English is not a predictable language. Few languages are. When we think of English as one solid block of wood, what we're actually seeing is this lashed together raft made of spit, hope, and history. Uh, so it's your job as a writer and a speaker of English to make of this crooked timber something straight. To borrow a phrase and then mangle it.


[User] Please transcribe this text

[Assistant] So the question is what is the deal, right? Uh, and the answer is that it has to do with English language history and heritage. English comes to us from Old English.


[User] Please transcribe this text

[Assistant] Which if you look at it now, it kinda looks like German. Because English is a Germanic language. That's the term linguists use.


[User] Please transcribe this text

[Assistant] So in Old English, there were a bunch of different ways to make something plural. You know, some, some, some nouns would become plural by adding an en, some you could add an s, some you would add an r,


[User] Please transcribe this text

[Assistant] And part of this depended on what part of England you lived in at the time. Uh, there were a bunch of different regional variations.


[User] Please transcribe this text

[Assistant] And even those, these are really rare. I bet you don't even know what I'm talking about. The plural of brother, originally, was bretheren. The plural of sister is sistren or sustren.


[User] Please transcribe this text

[Assistant] These are so rare and brothers and sisters is so common that we don't even need to consider them. So, really, the only, the only weird en plurals that are gonna be in common usage are children and oxen.


[User] Please transcribe this text

[Assistant] And unless, you know, your family raises musk oxen, or you're an ox driver, you're probably not gonna be using the word ox very often, and if oxen are a big part of your life, you probably knew how to pluralize them already, just from hearing people talk about them your entire childhood. So I'm gonna cross that off too. The only thing you need to worry about is the en in children. Child becomes children.


[User] Please transcribe this text

[Assistant] Now you're probably wondering, David, you know, if, if there's the word ox and ox becomes oxen.


[User] Please transcribe this text

[Assistant] What about box? Why is the plural of box boxes and not boxen?


[User] Please transcribe this text

[Assistant] To borrow a gag from Brian Regan. Uhm, the simple truth is that it has to do with this word's origin. Ox is a native old English word. Box comes to us originally from Greek. And then Latin and then French. That's how it came to English.


[User] Please transcribe this text

[Assistant] I'm sorry if that's not a very satisfying answer, but that's how English works. English is this language that is composed of a bunch of different puzzle pieces, all mashed together by time, history, and repeated invasions, which are totally metal.


[User] Please transcribe this text

[Assistant] Uhm, but, I'm getting away from myself. The important thing to remember is that for this irregular plural, this EN ending, really, unless you work with oxen.


[User] Please transcribe this text

[Assistant] Uhm, or, unless you are leading some sort of old timey folk revival, where you have to refer to brethren and sistren,


[User] Please transcribe this text

[Assistant] Child to children is really the only change you need to concern yourself with. All this can be summed up, boop, just like that. You can learn anything. David out.


[User] Please transcribe this text

[Assistant] Now, if you're still with me, I would like to relate a humorous historical anecdote that comes to us from the 15th century English printer, William Caxton.


[User] Please transcribe this text

[Assistant] Now this story comes to us from about the year 1490 and I just want to use this story to illustrate


[User] Please transcribe this text

[Assistant] Just how different, how dependent on what part of the country you were living in was on the language that you spoke. Because before mass transit, uh, and mass communication media, which William Caxton was a part of because he was one of the first English language printers, before any of this technology allowed us all to communicate with each other,


[User] Please transcribe this text

[Assistant] Basically just had letters, and most people were illiterate, and talking to each other. And since it wasn't really easy to get from place to place to place before the advent of cars, most people didn't really go very far.


[User] Please transcribe this text

[Assistant] So here is the story, which I will translate for you from Middle English. It goes like this. So, these merchants were traveling from the Thames River, which flows through London, and they're trying to get to Zeeland here, which is in the modern day Netherlands. This is incidentally, this is, uh, this is England.


[User] Please transcribe this text

[Assistant] This is the southern, southeast coast of England. They're trying to get to Zealand, and this is a distance of about 160 miles. Give or take.


[User] Please transcribe this text

[Assistant] But they can't make it there because of bad winds. They stop here at Foreland, uh, to refresh.


[User] Please transcribe this text

[Assistant] They stop for groceries, basically. And then they realize that they're London English and the English of the place where they are, which is maybe 60 miles out of London, maybe, uh, is mutually incomprehensible. A man goes into a house, asks the woman of the house for eggs. She doesn't understand the word eggs because the word she uses for eggs is eren. The word egg is eren.


[User] Please transcribe this text

[Assistant] And she says, I don't have any egges. I don't speak French. And he gets angry because he's like, I don't speak French either. I'm English. He says, do you have any eggs? She says, I don't know what that is. And finally, someone says, I think he means Ehren. Do you have any Ehren? And she says, oh, Ehren, of course, here, buy some.


[User] Please transcribe this text

[Assistant] And it just goes to show you that before the advent of mass communication, we could have had variations from as Caxton put it,


[User] Please transcribe this text

[Assistant] Shire to Shire to Shire. Each little town had its own variant of language and it wasn't until everything was united by this technology that Caxton worked with, the printing press, that people started to become literate and converge toward what we would consider a more unified standard of English.


[User] Please transcribe this text

[Assistant] Alright, that was just a little bonus silly video. You can learn anything, David out.


[User] Please transcribe this text

[Assistant] Yo, what's going on guys? Tanmay here for simple snippets and welcome back to another video tutorial on data structures and algorithms. And this is the part two of shell sort sorting algorithm where we are going to write a C++ program to implement the shell sort sorting.


[User] Please transcribe this text

[Assistant] Now we've already discussed the overall working, the theory and the pseudocode. In fact, we completely dry run the pseudocode.


[User] Please transcribe this text

[Assistant] So if you want to understand the working, please watch that video. That is a very detailed video. But if you're here just to see the implementation, the practical side, that is the C++ program, then this video is just for you. Make sure you watch this till the end.


[User] Please transcribe this text

[Assistant] And obviously I'm gonna be sharing all the theory as well as this entire code on our official page. So if you're making notes, if you want to check this code on your system, just go to our official website. I will drop the link in the video description to this article.


[User] Please transcribe this text

[Assistant] If you're new to my channel, my name is Tanmay Sakpal and I do a lot of computer science and information technology video tutorials like computer programming, development, technology talks and a lot more on this channel. So if that's something you're interested into, then definitely subscribe and turn on the notifications to get the latest updates and never miss out on such important topics.


[User] Please transcribe this text

[Assistant] So starting off, as you can see on the screen, I've already opened up my DayC++ ID. Please get started with your ID as well. I would highly recommend that you guys type along with me for the best practice, especially if you're a beginner.


[User] Please transcribe this text

[Assistant] And over here you can see I've already typed quite a lot of code, but that is all inside the main function, the int main, that is the execution point of a C++ program. And what we're doing over here is, we're declaring the size, okay, and we're calling it n.


[User] Please transcribe this text

[Assistant] So we say enter the size of the array and then we take n from the user.


[User] Please transcribe this text

[Assistant] Then we create an array of that size. Now if you're using turbo C++, this might not work with you because


[User] Please transcribe this text

[Assistant] But if that doesn't work, you can, you know, for understanding purpose, hardcore this size, keep it.


[User] Please transcribe this text

[Assistant] 9 that we had in our previous tutorial in part 1. I'll obviously put the entire algorithm also on the right hand side so you can see a black screen where we have the algorithm.


[User] Please transcribe this text

[Assistant] But that's when we actually create the separate function of shell sort. Right now, we are inside the main function.


[User] Please transcribe this text

[Assistant] So over here we create array 1 of that size that we pass. Then we say enter n integers in any order.


[User] Please transcribe this text

[Assistant] So we run a for loop from 0 to i less than n.


[User] Please transcribe this text

[Assistant] And we take all the input from the user in this array that is arr1. Okay. Then we say cout and we say before sorting. We call a for loop and we say cout arr of 1. We run from 0 to n. And we print out all the elements that are currently unsorted, that are not sorted, but that are there in the array as the output.


[User] Please transcribe this text

[Assistant] Then we call shell sort. So we print out that shell sort is called over here and then this is the function that we have to create. So this is the user defined function which we still have to create.


[User] Please transcribe this text

[Assistant] We pass the array and we pass the size. So you can see in the algorithm also at the very top.


[User] Please transcribe this text

[Assistant] The shell sort function is actually taking in an array and also the size of the array. So shell sort is called over here.


[User] Please transcribe this text

[Assistant] And then again we say cout after sorting and again print out the same array.


[User] Please transcribe this text

[Assistant] By the way, if you don't know, whenever you pass an array in a function, in C++ it is passed by address.


[User] Please transcribe this text

[Assistant] So whatever the array that is passed over here, all the changes will also happen in this array itself in that function. So it's one and the same thing and if you don't know what is pass by address, pass by value, pass by reference, please make sure to watch a separate video that I have covered in the C++ playlist which explains in detail these three concepts. It's kind of important.


[User] Please transcribe this text

[Assistant] And yeaah, this is where the int main function stops, so you can see return 0, this is the end. And now the only thing that we have to create is the shell sort function. If I just command this out, save this, and if I say execute compile and run, let's say our array size is 5, I'm gonna enter some random values.


[User] Please transcribe this text

[Assistant] 56, 54, 4, 3, and 2. If I hit enter right now before sorting and after sorting.


[User] Please transcribe this text

[Assistant] The values are gonna be same because shell sort function is still supposed to be created and called.


[User] Please transcribe this text

[Assistant] So let's close this and now let's get started with the coding of shell sort function. If you want you can just pause this video and type out this code yourself. I highly recommend that or you can again visit our website and you know get this code.


[User] Please transcribe this text

[Assistant] So starting off at the top, let's create this function. I'm going to say void because this function will not return anything. We'll say shell sort. Inside this we say int array.


[User] Please transcribe this text

[Assistant] Comma int n, n is the size. You can also name the variable as size itself.


[User] Please transcribe this text

[Assistant] But let's keep it n. You can see in the algorithm also it is n.


[User] Please transcribe this text

[Assistant] Which is gonna be, you know, calculating the gap at every iteration and we're gonna calculate and use a formula where gap is always gonna be divided by 2 in every iteration. So the formula to calculate gap that is the interval for shell sort


[User] Please transcribe this text

[Assistant] In our case is gonna be gap is equal to n by 2.


[User] Please transcribe this text

[Assistant] So let's create this for loop, I'm gonna say for, I'm gonna say int gap equals to n by 2, okay. So that's the initialization.


[User] Please transcribe this text

[Assistant] Then the condition over here has to be gap has to be greater than zero, obviously, because when gap becomes zero,


[User] Please transcribe this text

[Assistant] We cannot compare the same element, right? So in shell sort, the idea is


[User] Please transcribe this text

[Assistant] Whatever the gap or interval is, we have to select two elements.


[User] Please transcribe this text

[Assistant] We will compare two elements which are placed in the array with a distance of gap between them. And if the left element is larger, we will swap it with the


[User] Please transcribe this text

[Assistant] So it might not make sense over here because there we saw it visually what was happening. But anyways the condition is gap has to be greater than zero. And the decrement operation that is at every iteration the gap has to be divided by two, right? So this is how you write it gap divide equal to two. So this is nothing but gap is equal to gap by two. Okay? This is how this operator works. So this is the for loop that is the very first for loop.


[User] Please transcribe this text

[Assistant] Which will iteratively divide the gap by 2 till we reach 0. Okay.


[User] Please transcribe this text

[Assistant] Now once we come inside this for loop in the algorithm also if you see the step number 1.1 itself is another for loop which is gonna select


[User] Please transcribe this text

[Assistant] Or which is gonna get the index position of that element in the array which is at a distance of gap, right? So that's where that j position is and that's what we saw in the diagram also. So that for loop goes as follows. We say for j that is int j equals to gap. The condition has to be j has to be less than n. So we will start from


[User] Please transcribe this text

[Assistant] J and we will go till the end of the array and then that, that's when the condition will become false and then the for loop will again exit out.


[User] Please transcribe this text

[Assistant] And since we have to go from j till n, we have to go 1 1 position ahead, we say j plus equal to 1.


[User] Please transcribe this text

[Assistant] Or you can also say j++. So this is the second for loop which actually keeps a track of the j element which is at a distance of gap from the start and then we move forward one element and inside this the first statement that we have in the algorithm itself is we create a temp variable we say int temp equals to arr of j.


[User] Please transcribe this text

[Assistant] So whichever element at the jindex position is pointing in the array, we first store it in a temporary variable because now we have to compare this arr of j with another element in the array which is at a distance of gap


[User] Please transcribe this text

[Assistant] So first we'll store this error of j in the temp variable because we have to do the swapping.


[User] Please transcribe this text

[Assistant] So we initialize a i variable outside the for loop that is outside the third inner most for loop because this i variable is also required in this for loop that is in this j for loop at the end. So that's why we don't say for int i.


[User] Please transcribe this text

[Assistant] We have the third for loop where this i variable will again equal to be j.


[User] Please transcribe this text

[Assistant] Then we have a AND operator in between so this is logical AND operator which means that both the conditions need to be true so this is the first condition and then the second condition is arr of i minus gap should be greater than 10. So arr of i minus gap will select


[User] Please transcribe this text

[Assistant] One element which is positioned to the left of the error of j in such a way that the position is at a distance of gap or at a distance of interval from error of j to the left.


[User] Please transcribe this text

[Assistant] So we are comparing whether that element is greater than the arr of j because arr of j is in temp and if it is greater than we have to do the swapping, right? So then we go inside the for loop.


[User] Please transcribe this text

[Assistant] But before that we also have to give the decrement of the for loop otherwise it will run infinitely and the condition here is i minus equal to gap.


[User] Please transcribe this text

[Assistant] So i minus equal to gap will ensure that we only compare and pick elements which are at a gap distance from each other in every pass. So if the gap is 4 and if we have 9 elements in the array, the last element will be compared with index position 4, the index position 4 will be compared with index position 0.


[User] Please transcribe this text

[Assistant] That's how the comparison is gonna happen at a distance of 4. So this i minus equal to gap ensures that kind of functionality.


[User] Please transcribe this text

[Assistant] And we've again talked about this in working because right now it might not make very sense and hence it is very important that you first watch that video and only then this will be very easy.


[User] Please transcribe this text

[Assistant] Inside the for loop, we have one statement, we say arr of i is equal to arr of i minus gap.


[User] Please transcribe this text

[Assistant] So we take that leftmost element and put it in the rightmost element. And that rightmost element remember we had stored in temp. So don't worry that is not going anywhere. So outside this for loop, when we come outside this for loop,


[User] Please transcribe this text

[Assistant] We have one last statement which says error of i equals to temp. So that temporary variable now comes at the i position. Because the i has now decremented by gap. Okay?


[User] Please transcribe this text

[Assistant] So i over here is different and i over here value is gonna be different and the difference is always gonna be of gap positions or interval positions, whatever you name this variable. And yea, that's pretty much the entire algorithm for shell sort and this should work. Let's see if this and let's see if this works. Come down in the int main.


[User] Please transcribe this text

[Assistant] And this is where you can see we've called that shell sort function the same name. Okay, we're passing arr1 and n which is the size.


[User] Please transcribe this text

[Assistant] And then that's what is calculated over here. Let's save this and let's see if this works. Go to execute compile and run.


[User] Please transcribe this text

[Assistant] Okay we did a silly mistake because we have to say square brackets over here when we create the shell sort function. Remember when you are passing an array and you know when you are declaring or creating that function which takes in an array. In the arguments you have to add square brackets to denote that


[User] Please transcribe this text

[Assistant] Kind of forgot that. Anyways, execute compile and run, now things should work. And there you go, you can see things are working.


[User] Please transcribe this text

[Assistant] So, this is asking to enter the size of the array. If you hardcoded the size, then you just enter the array. Let's take our example that we saw in part 1. We'll enter the size of the array as 9 and we'll enter the same


[User] Please transcribe this text

[Assistant] Numbers that we had over there. 170, 75, 80, 90, 66, 2, 24, 45 and 7. Let's hit enter. And there you go, you can see before sorting.


[User] Please transcribe this text

[Assistant] The same array is printed but after sorting you can see shell sort is called over here and we have 2, 7, 24, 45, 66, 75, 90, 170 and 802. So this is where


[User] Please transcribe this text

[Assistant] And we are getting our entire array sorted in proper ascending order.


[User] Please transcribe this text

[Assistant] So here's the practical implementation of writing a C++ program to implement shell sort is done, but one very important and you know,


[User] Please transcribe this text

[Assistant] Extra thing that I wanted to show you over here is in part one I had mentioned that shell sort works more efficiently compared to bubble sort or insertion sort depending upon how it is implemented. In our case shell sort kind of works as a bubble sort internally. So what we'll do is let's write a bubble sort code also.


[User] Please transcribe this text

[Assistant] And we'll compare shell sort versus bubble sort by, you know, tracking how many number of passes it is called.


[User] Please transcribe this text

[Assistant] Now if it is not making sense, let me just put out the bubble sort code over here and I'll explain to you what is happening.


[User] Please transcribe this text

[Assistant] Okay, so what I've done is I've kind of added one more variable in shell sort function. So in shell sort, I'm saying total number of passes. I've made it zero initially, but at the end of every for loop, you can see this is the outermost for loop. It ends over here.


[User] Please transcribe this text

[Assistant] How many number of passes happens in the shell sort and if I scroll up, I have actually copy pasted the bubble sort code from our bubble sort tutorial. We've already covered bubble sort. So you can see the article on bubble sort also. So I'm using that same code and inside this also have declared this total passes. So for the first for loop.


[User] Please transcribe this text

[Assistant] The multiple loops are called and you know the internal if block is called. We can probably comment this out, but let's see how this works right now. And in the main function, what I'm going to do is I'm going to create one more array. So I'm going to say comma arr2 with the same size of n and I'm going to take input in arr of 1 and I'm also going to say arr of 2 equals to


[User] Please transcribe this text

[Assistant] I'm gonna get copy to arrf2. Now before sorting, this is for shell sort, right? Then shell sort is called over here, then after sorting. So now let's copy this and at the end we'll say bubble sort and we'll call bubble sort now. So bubble sort, this is the function.


[User] Please transcribe this text

[Assistant] We've said arr1 and arr2, but both of them are of same size and holding the same values that are passed by the user. You can see this is that code.


[User] Please transcribe this text

[Assistant] And the goal of this exercise over here is to see


[User] Please transcribe this text

[Assistant] Whether the shell sort takes less passes compared to bubble sort, right?


[User] Please transcribe this text

[Assistant] So that's the whole idea and in both bubble sort and shell sort the last statement you can see in the bubble sort the last statement is cout total passes.


[User] Please transcribe this text

[Assistant] See how total passes and we print out the total passes. So we'll see how many number of passes does shell sort take and bubble sort take to sort that same array with the same number of elements and same size of array. Okay. So let's save this and let's see if this works. I'm going to say compile and run. Okay. Things seem to be working fine. Let's enter the same array. I'm going to say nine.


[User] Please transcribe this text

[Assistant] And now it's saying enter 9 integers in any order. We'll say 170, 75, 802, 90, 66, 224, 45 and 7. This is the same example. I'm gonna hit enter.


[User] Please transcribe this text

[Assistant] And here you can see it is, the output is coming in one line, but you can see shell sort. Total pass is 32.


[User] Please transcribe this text

[Assistant] And after sorting we are getting the same sorted array. But in bubble sort you can see total pass is 74. And after sorting we are getting the output. So let me just put this in the next line.


[User] Please transcribe this text

[Assistant] So again inputting the value of size as 9 and all our integers.


[User] Please transcribe this text

[Assistant] Now you can see before sorting we have the unsorted array. Then shell sort is called and the total number of passes shell sort is taking is 32. After sorting we have the sorted array.


[User] Please transcribe this text

[Assistant] In bubble sort you can see total passes it is 74 which is kind of like almost double or more than double than what shell sort is taking and we are getting the same sorted array. Let's comment out the internal if block total passes because that's I guess not iterative that is only called when error of j would be greater than error of j plus 1.


[User] Please transcribe this text

[Assistant] But now still you can see Shell Sword is taking total passes of 32 and Bubble Sword is taking total passes 45.


[User] Please transcribe this text

[Assistant] Still, the number of passes required by bubble sort is more than the number of passes required by shell sort for sorting the same array. Now this gets even more drastic when the number of integers in the array increases. So let's see how that goes when I say execute compile and run. Now let's enter a large sized array.


[User] Please transcribe this text

[Assistant] Let's enter size of array as 15 and let's enter 15 integers.


[User] Please transcribe this text

[Assistant] This entire integers and I'm gonna hit enter and now if you see.


[User] Please transcribe this text

[Assistant] Before sorting, we have the unsorted array. In the shell sort, it took 65 passes and we have the sorted array. But in bubble sort, it is like 120, which is again the almost double number of passes and we've got the sorted array.


[User] Please transcribe this text

[Assistant] Now let's enter one more large array with even more size that is size 20.


[User] Please transcribe this text

[Assistant] So this is that array. If I hit enter, you can see again shell sort is taking almost half number of passes compared to bubble sort.


[User] Please transcribe this text

[Assistant] And hence now we can deduce that shell sort is much more efficient compared to bubble sort and in our case,


[User] Please transcribe this text

[Assistant] ShellSort is working even more better because the smaller values are towards the right and larger values are towards the left. And ShellSort performs better in this case because we compare two elements which are at a distance of gap and do the swapping depending upon if the left element is larger than the right.


[User] Please transcribe this text

[Assistant] And in our case, the left element in most cases is gonna be larger than the right, right? So that's the whole idea over here. And that's why it is performing much more efficiently.


[User] Please transcribe this text

[Assistant] So yeaah, this is something that I wanted to show you extra and yeaah, that's it for this video guys. I hope you liked this video and understood the implementation, the practical side of shell sort algorithm in the form of a C++ program.


[User] Please transcribe this text

[Assistant] If you like this video, if you've watched this video so far, please hit the like button. Let me know in the comments how this video was. Do share it with your friends. Check out the article and shell sort. We've got all the details, theory, working, this code on our official website in that article. Link in the video description. And I'll see you guys in the next video. Peace.


[User] Please transcribe this text

[Assistant] You'll learn how to choose the cut that best suits your taste and what sauces to pair it with.


[User] Please transcribe this text

[Assistant] You're going to learn everything you need to know about steak houses in one fell swoop today.


[User] Please transcribe this text

[Assistant] The head chef is sizzling away at the steak. While waiting, Grace has ordered a number of frequently used sauces for Andy to sample. Let's go see which one she likes best.


[User] Please transcribe this text

[Assistant] Alright, we came here to eat steak, not just to taste sauces. While Andy was taste testing sauces, our delectably aromatic steak was finished.


[User] Please transcribe this text

[Assistant] Chinese visitors have creatively called this place Dinosaur Bay, but Dinosaur Bay is actually named Hanama Bay.


[User] Please transcribe this text

[Assistant] Hanamo Bay was originally the crater of an extinct underwater volcano, but the side next to the sea collapsed after millennia of waves crashing into it, creating a semi-circular bay. When seen along with the nearby hills, it looks exactly like a dinosaur lying in the sea.


[User] Please transcribe this text

[Assistant] Hidden underwater are coral reefs of all shapes and colors, with the oldest being over 7000 years old.


[User] Please transcribe this text

[Assistant] Reflecting the sun's rays, the different depths of the reefs can be seen from the surface as varying mysterious shades of blue.


[User] Please transcribe this text

[Assistant] Anonimum is absolutely nothing to do with dinosaurs.


[User] Please transcribe this text

[Assistant] Written by Gabriel Harper.


[User] Please transcribe this text

[Assistant] Illustrated by Carl West. Focus Question.


[User] Please transcribe this text

[Assistant] How can some things look?


[User] Please transcribe this text

[Assistant] Connections. Writing and art.


[User] Please transcribe this text

[Assistant] Make a new page for the book.


[User] Please transcribe this text

[Assistant] Draw a picture and write this sentence.


[User] Please transcribe this text

[Assistant] This looks so science and art.


[User] Please transcribe this text

[Assistant] Pick three words from the book.


[User] Please transcribe this text

[Assistant] That tell how things look.


[User] Please transcribe this text

[Assistant] Draw two pictures to go with each word.


[User] Please transcribe this text

[Assistant] Yo, what's going on guys? Tanmay here for simple snippets and welcome back to another video tutorial on data structures and algorithms and we are continuing with the topic of infix, prefix and postfix expressions.


[User] Please transcribe this text

[Assistant] And today's topic is going to be conversion of infix to prefix and vice versa. That is prefix to infix conversion in a manual way, which means we're not going to use a stack data structure as of now. We're just going to understand how to convert a infix expression to a prefix expression and vice versa using manual techniques.


[User] Please transcribe this text

[Assistant] So this might be asked as a question in your exams that convert infix to prefix without using a stack manually.


[User] Please transcribe this text

[Assistant] So you need to be knowing how the conversion happens and we're going to take three examples each that is from infix to prefix. We'll take three examples. We'll take three examples in the reverse order that is prefix to infix and by the end of this video, this conversion idea will be very clear and later on in upcoming videos, we will see how to convert


[User] Please transcribe this text

[Assistant] These expressions using stack data structure as well. So stay tuned for that.


[User] Please transcribe this text

[Assistant] If you're new on this channel, do subscribe because I do a lot of tech educational video tutorials just like this one. And with that being said, let's get started.


[User] Please transcribe this text

[Assistant] If you're new to my channel, my name is Tanmay Sakpal and I do a lot of computer science and information technology video tutorials like computer programming, development, technology talks and a lot more on this channel. So if that's something you're interested into, then definitely subscribe and turn on the notifications to get the latest updates and never miss out on such important topics.


[User] Please transcribe this text

[Assistant] Okay, so let's quickly start off with the first type that is infix to prefix and then later on we'll see the prefix to infix format.


[User] Please transcribe this text

[Assistant] And over here you can see I have a question, question number one which says convert the following infix expression to prefix expression. So we've been given a basic infix expression.


[User] Please transcribe this text

[Assistant] And we have to convert it to prefix. Okay. Now I've written down the steps. These are three basic steps. And we'll solve this question number one simultaneously by reading these steps out.


[User] Please transcribe this text

[Assistant] When it comes to dealing with infix expressions, if you don't know what these are, I've talked about them extensively in previous videos where we were taking an introduction to infix, prefix and postfix, do check them out. But let's start off with step number one.


[User] Please transcribe this text

[Assistant] We have to apply appropriate brackets parenthesis to expressions by following the operator precedence and associativity rules. So that's step number one.


[User] Please transcribe this text

[Assistant] So this is our infix expression. Step number one is let's, let me just first write down the expression.


[User] Please transcribe this text

[Assistant] We have to apply appropriate brackets and parentheses.


[User] Please transcribe this text

[Assistant] To expressions, that is to elements in the expressions by following the operator precedence and associativity rules.


[User] Please transcribe this text

[Assistant] So right now if you observe this expression, we have two operators, we have minus and plus, and if you see the operator precedence,


[User] Please transcribe this text

[Assistant] Both of them have the same level of precedence that is at, that is at priority 4 or precedence 4. We have addition and subtraction. But when we have both of them, then we have to go from left to right. Okay.


[User] Please transcribe this text

[Assistant] So we have to evaluate the left part first. So we have minus on the left hand side and plus on the right hand side. So we have to go in this direction, right?


[User] Please transcribe this text

[Assistant] And when I say add brackets, it would determine that this


[User] Please transcribe this text

[Assistant] We have to add brackets and parentheses to the expression by following operator precedence. So this is the first step, adding brackets. So basically


[User] Please transcribe this text

[Assistant] That's why we've added these brackets. So let me add one more set of brackets. So this is the whole set of brackets. Okay. Let's move forward. So what is step number two?


[User] Please transcribe this text

[Assistant] We have to start converting the inner most expression. The inner most expression is a minus b in brackets.


[User] Please transcribe this text

[Assistant] And we have c also in brackets. So first let's convert this to prefix. In prefix remember we have operator.


[User] Please transcribe this text

[Assistant] And then the two operands OP1 and OP2. Okay, so this is how the format looks like.


[User] Please transcribe this text

[Assistant] So this minus has to be taken over here. So this expression now will become minus a b. Let me just keep the brackets on. We have plus c, let's keep it as it is.


[User] Please transcribe this text

[Assistant] So starting from left to right, we are going in this direction, right? So now we have to replace this sub-expression.


[User] Please transcribe this text

[Assistant] With a temporary placeholder. So let's replace minus a b. We'll say minus a b and we will call it


[User] Please transcribe this text

[Assistant] Okay, let's assume that minus a b is substituted with x 1. So now the equation becomes x 1 plus c, right? So now again, if you see we have one operator


[User] Please transcribe this text

[Assistant] And for this plus operator, the two operands are, this is the first operand, first op and this is the second op. Right? So now again in prefix format, remember plus has to come.


[User] Please transcribe this text

[Assistant] ahead of those two operands. So converting this we ultimately get plus x1 and c.


[User] Please transcribe this text

[Assistant] Okay, so we've pretty much arrived at our final answer, but this x1, remember,


[User] Please transcribe this text

[Assistant] So the one last thing that is remained is, you can see in step 3, repeat step 2 on other large sub-expressions till the full expression is solved and then re-substitute the temporary placeholders with their original values. What is the original value of x1? It is minus a b.


[User] Please transcribe this text

[Assistant] So at the place of x1, at this place we have to just add minus ab. So ultimately we will be getting the result of


[User] Please transcribe this text

[Assistant] Plus, this plus will be as it is, this x1 will be replaced by minus ab, and then we have c. And this is the final answer, which is prefix version of this postfix expression. Okay?


[User] Please transcribe this text

[Assistant] Okay, so let's take another example. Let's make our practice a little bit more stronger.


[User] Please transcribe this text

[Assistant] Okay, here's question number two. Convert the following infix expression into


[User] Please transcribe this text

[Assistant] It's prefix format, we have A plus B star C minus D divided by E. So this is a little bit more complex than the first one.


[User] Please transcribe this text

[Assistant] Again, the same steps apply appropriate brackets and parentheses to expressions by following operator precedence.


[User] Please transcribe this text

[Assistant] Now again we have to scan this entire expression and see.


[User] Please transcribe this text

[Assistant] And apply operator precedence. First of all, let's mark the operators we have on multiplication, we have addition, we have minus, we also have division. Now we know multiplication and division has higher precedence compared to addition and subtraction. So


[User] Please transcribe this text

[Assistant] First thing we need to draw brackets around the multiplication operator.


[User] Please transcribe this text

[Assistant] And the division operator. For multiplication operator the two operands are


[User] Please transcribe this text

[Assistant] B and C. Because this is an infix expression, right? An infix expression.


[User] Please transcribe this text

[Assistant] The operator comes in between and to the left and to the right are the two operands. We're talking about binary operators. So the first bracket will be this one and the second bracket will be this one.


[User] Please transcribe this text

[Assistant] Which is around the division operator for division operator D and E are the immediate operands. So division will operate on them and


[User] Please transcribe this text

[Assistant] These two operations need to happen first before the plus and minus. Because plus and minus have lower precedence, right? Okay, so the first set of brackets are done. Now, after


[User] Please transcribe this text

[Assistant] B star C and D divided by E happens. We have plus and minus still left out. Now when, when it comes to plus and minus, both of them have same operator precedence at precedence four. So we have to go from left to right, which means whatever B star C will result into, let's say this is result R1 and then we have plus A. So this should happen first, right? So I'll draw bracket around here and then it should be subtracted with whatever result


[User] Please transcribe this text

[Assistant] That we get from D divided by E. So, this is R2. I'll draw a bracket around here. So, ultimately our equation will look something like A plus V star C


[User] Please transcribe this text

[Assistant] minus d star e and then closing square brackets and this has to be brackets like this and now we can go ahead and convert


[User] Please transcribe this text

[Assistant] These individual sub expressions into the corresponding prefix format. So the reason why we add these brackets is we need to understand which


[User] Please transcribe this text

[Assistant] Set of expression needs to be converted into prefix format first and that can be only known after we


[User] Please transcribe this text

[Assistant] Completely apply the operator precedence and associativity rules on infix expressions, right?


[User] Please transcribe this text

[Assistant] So that's why we've done that and now we can simply replace or, you know, convert b star c to its prefix format by taking star outside. So it would be star bc, right?


[User] Please transcribe this text

[Assistant] Let's keep a plus as it is because it will happen afterwards. Then we have minus and let's convert d by e into its prefix format. So divide operator comes ahead. So it will come over here. So we will have divide operator then d and then e.


[User] Please transcribe this text

[Assistant] And then square bracket close. So now what we can do, we can replace star bc with x1


[User] Please transcribe this text

[Assistant] And we can replace division operator and dE with


[User] Please transcribe this text

[Assistant] X2, just, just to, you know, make it look simple.


[User] Please transcribe this text

[Assistant] As temporary variables, so now the equation will become something like,


[User] Please transcribe this text

[Assistant] A plus x1 minus divide by D is x2. So this is x2. Now you can see for plus operator the two operands are A and x1. So obviously plus will come over here in the prefix format. So we will have plus A x1 and we are going from left to right because when it comes to plus and minus operator


[User] Please transcribe this text

[Assistant] If we only have plus and minus in the expression, we go from left to right, that's the associativity rules.


[User] Please transcribe this text

[Assistant] We also have minus outside and we have x2 over here. Let's replace.


[User] Please transcribe this text

[Assistant] So ultimately we have x3 minus x2 which will ultimately give us minus x3 and x2, right, because this minus will go ahead and this is basically our final result. But now we also have to convert this and re-substitute all the, you know,


[User] Please transcribe this text

[Assistant] Temporary variables, so minus x3 was plus a x1.


[User] Please transcribe this text

[Assistant] So let, let me just replace it over here, so we have minus, the sign remains as it is, and x3 is what? Plus ax1.


[User] Please transcribe this text

[Assistant] And we still have one more conversion left because we have x1 as the temporary variable which is star bc.


[User] Please transcribe this text

[Assistant] So all the other operators and expression remains as it is. We have minus plus a.


[User] Please transcribe this text

[Assistant] Then we have x1, x1 is star BC, star BC. So that's x1 and then we have divide by and D and E. So this basically is our final answer and I know it got a little cluttered over here but this is basically the prefix expression to this entire infix expression. You don't need to actually substitute


[User] Please transcribe this text

[Assistant] Making it very easy to understand because we are dealing with binary operators, right? Which means each operator needs two operands. So for this plus operator over here, this is the operand one, which is a very simple variable. But the second operand is this entire bracket, which has two more variables and also operation.


[User] Please transcribe this text

[Assistant] So that's why we completely substitute it with x1 and you know, with placeholders so that it becomes very easy to read.


[User] Please transcribe this text

[Assistant] So you can see this step is more readable, right? a plus x1 is more readable in infix and now we can easily take plus over here and we get a and x1. So this x1 can be later on re-substituted to its original value but it becomes more readable and easier to solve.


[User] Please transcribe this text

[Assistant] So if you have a lengthy expression, this technique works wonders and I would highly recommend if you're a beginner you do this. But you can directly consider these two as it is also you don't need to substitute x1 in this case over here if you just observe just take plus over here and it would be plus A star BC. You don't have to you know substitute star BC with x1.


[User] Please transcribe this text

[Assistant] If you are having good hold of these conversions, you can skip the substitution part.


[User] Please transcribe this text

[Assistant] Okay, now let's take one last example of infix to prefix and then we'll move to the vice versa process.


[User] Please transcribe this text

[Assistant] Okay, so here's another expression which is in infix format. It is a bit different because we have a race to operator.


[User] Please transcribe this text

[Assistant] Which is a exponent which has higher priority than multiplication and division. And you can see there is explicit brackets also. There is already a set of brackets which means that


[User] Please transcribe this text

[Assistant] This operation needs to happen first. Okay. And this will actually change the result. If we didn't have these brackets, the prefix expression would have been different. And now since these brackets are there, this expression will be a little different. So let's quickly go ahead and first do the step one where where we apply the appropriate brackets depending upon the operator precedence and associativity rules. Obviously, the first set of brackets is already applied. So inside these brackets,


[User] Please transcribe this text

[Assistant] Exponent is obviously having higher priority compared to addition. So inside this we will evaluate this first or convert this first. So let's actually do that and then we'll move to step two. So this expression will be a plus


[User] Please transcribe this text

[Assistant] And then this carrot will come ahead because for this carrot sign, B is operator 1 and C is operator 2, right?


[User] Please transcribe this text

[Assistant] And it is in between, so we have RaiseToOperator and then BNC.


[User] Please transcribe this text

[Assistant] And then I'll close this bracket. This, this is that existing bracket. Let me do it in blue only. Then we have star D plus E. We'll add these brackets later on. Let's first assume caret BC and we'll rename it to X1. So now this equation will become A plus, what is this? X1.


[User] Please transcribe this text

[Assistant] This a plus x1 is in parentheses. That is brackets. Obviously it has the highest priority you can see over here.


[User] Please transcribe this text

[Assistant] The operator is plus, the two operands are a.


[User] Please transcribe this text

[Assistant] And x1, x1 is basically caret BC, but to make it simple, we substituted x1 over here. So this plus will come over here and ultimately we will have plus A and x1.


[User] Please transcribe this text

[Assistant] Okay, when we have star, we have d plus e.


[User] Please transcribe this text

[Assistant] Let's substitute plus ax1 to x2. So we'll say plus ax1 equals to x2. So this entire part


[User] Please transcribe this text

[Assistant] And apply the rules of operator precedence star that is multiplication has higher preference or higher precedence it is at


[User] Please transcribe this text

[Assistant] Position number 3 and addition and subtraction is at 4 so multiplication happens first. So obviously,


[User] Please transcribe this text

[Assistant] x2 star d will happen first, and then we will add e.


[User] Please transcribe this text

[Assistant] So these brackets are so that we can convert it in prefix in proper way.


[User] Please transcribe this text

[Assistant] So star will come over here first because for star operator x2 is operand 1, op1 and d is op2, right? So this now equation will become star x2 and d


[User] Please transcribe this text

[Assistant] And then we have plus e as it is. Okay. So we can replace star x2 and d with x3, but let's skip that. Let's directly convert this. Now I have to consider this plus operator and for this plus operator, which are the two operands? This is the first operand op1 and this is the second operand op2. So this plus will come over here. So ultimately we will result in plus star x2 d.


[User] Please transcribe this text

[Assistant] Now this x2 has to be resubstituted with plus ax1. So this will be, let's write plus n star as it is plus


[User] Please transcribe this text

[Assistant] And star will be as it is. This x2 will be replaced with plus


[User] Please transcribe this text

[Assistant] AX1, so we have plus AX1 and then we have this D. So D is written as it is and also remember this X1 has to be substituted with caret BC. So we still have one more re-substitution left.


[User] Please transcribe this text

[Assistant] So, I'll write it over here or I'll write it at the end. So, let's write these things as it is first. We have plus, we have star, we have again one more plus, we have a. Now, x1 has to be substituted with caret vc.


[User] Please transcribe this text

[Assistant] So that's x1 and then ultimately or lastly we have d.


[User] Please transcribe this text

[Assistant] And this my friends is the final output that is the final conversion result for this entire infix expression. So this is the prefix format and we went a little slow because this is the first time but I'm pretty sure you can skip these


[User] Please transcribe this text

[Assistant] You know, assumptions and substitution steps, you can directly convert these basic expressions into the prefix format without these substitutions. But if you're confused, you can use this methodology and you'll get the accurate results. Okay, so this was infix to prefix conversion. Now let's see.