RUVIDEO
Поделитесь видео 🙏

Python Practice Hashing Binary Search || Lesson 27 || Python Placements || Learning Monkey ||

📁 Обучение 👁️ 18 📅 02.12.2023

#pytho #learningmonke #pythoncodin #placement #pythontutorial #pythoncours #pythonforbeginner #pythonfordatascienc #pythonfullcours #pythonprogrammin #pythonfreecourse
Python Practice Hashing Binary Search
In this class, we do Python Practice Hashing Binary Search.
Binary Search Example
The reader should have basic knowledge of Data structures and python.
Check our data structures course for all the related concepts.
For python, Click here.
All these examples will help you improve your coding skill so that you can easily crack placement exams.
consider the following binary search code given below

num_list=[3,6,7,9,15,20]
element=17

How many iterations needed to search given element

def binarysearch(num_list,element):
low=0
high=len(num_list)-1
mid = (low + high)//2
while(lowlt=high):
if(element==numlist[mid]):
break
elif(elementgtnum_list[mid]):
low=mid+1
else:
high=mid-1
mid= (low+high)//2
if(element=num_list[mid]):
print("element is at index position",mid)
else:
print("element not there in the list")

In the above program, it was given binary search code using loops.
Given an element and how many iterations are done to check the presence of element in the list?
Logic
Binary search checks the middle element in the list.
If the element to be searched is greater than the element in the mid position. The next iteration will search in the right half.
Otherwise, search in the left half.
This search is repeated until low less than or equal to high.
Low is starting position of the partition, and high is the ending position of the partition.
In our example, element 17 has to be searched. The element is not present in the list.
Output: Three iterations.
Hashing example
Which of the following hash functions will lead to the least number of collisions.
when the following elements are inserted in the hash table.

48,98,34,25,18
1) H(key) = Key%8
2) H(Key) = Key%10
3) H(Key) = key%9
4) H(key) = key%3


In the above example, hash keys are given.
The list of elements takes the position by using the hash key.
Example:
Element 48 will take the position 0. because 48%8=0.
If two elements take the same position, a collision occurs.
Check the collision for all the values.
Output: Using key-value nine, we are getting a fewer number of collisions.


Link for playlists:
https://www.youtube.com/channel/UCl8x4Pn9Mnh_C1fue-Yndig/playlists



Link for our website: https://learningmonkey.in

Follow us on Facebook @ https://www.facebook.com/learningmonkey

Follow us on Instagram @ https://www.instagram.com/learningmonkey1/

Follow us on Twitter @ https://twitter.com/_learningmonkey

Mail us @ [email protected]

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Practice Hashing Binary Search || Lesson 27 || Python Placements || Learning Monkey ||», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.