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

Tree delete JAVA Assignment | part2: delete methods & helpers | Data Structures & Algorithm Analysi

📁 Обучение 👁️ 17 📅 05.12.2023

More Data Structures and Algorithm Analysis videos:
https://youtube.com/playlist?list=PLZPy7sbFuWViIs2tnMRzkr6-1Pr2I3o3o

Notes for Data Structures and Algorithm Analysis:
https://docs.google.com/document/d/1YU8wUtH0_bOHlAM1MqOAbxnZhQQBJ0yHYA-lNPafgkM/edit?usp=sharing


Tree Delete Assignment Instructions:
https://docs.google.com/document/d/1SFzNsmQ8lUsTjC7FOhUYOPJhevt4OSdNDLGyddGSHlw/edit?usp=sharing


For deleting a node that has either one child or no children, can I use the same snippet of code as below?
If (leaf.right!= null)
return leaf.right
Else
return leaf.left

A: Yes because in the case of no children, you will be returning null which would qualify for the no children. It would also qualify for the one child since the one that is not null will be returned. This would mean that in essence you have 2 conditions

Two children
One or no children

How do I deal with getting rid of a node that has 2 children
A:
go to the right child of the node that you want to delete. Recursively go to the left until you have no more left. Return the node or the value sitting in the node.

Replace the value of the last step with the value of the node that is being deleted. Keep in mind that you do not want to delete the node but rather just change its value

The last step is to go to the right of the node that has the substituted value (the node that you wanted to delete) and issue the delete function against the substituted value to get rid of the duplicate

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Tree delete JAVA Assignment | part2: delete methods & helpers | Data Structures & Algorithm Analysi», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

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

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

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