#shorts Day 13 || Sorting Array Containing 0's 1's & 2's #dsa #python #algorithms #sortingalgorithm

preview_player
Показать описание
In the video basically used the algorithm in which i used three pointers low and mid which were initially set to index 0 and high which was initially set to len(arr)-1 i used while loop to traverse across the array and to if i encounter a 0 i used to swap the low and mid index elements and increase low and mid by 1 if i encountered mid as 1 i just simply increased mid by 1 if i encountered 2 i swapped with element present at index high and i stopped the loop when my mid reaches high index.
Рекомендации по теме
welcome to shbcf.ru