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

C# | Binary Search Trees (Linked List Implementation)

📁 Обучение 👁️ 21 📅 29.11.2023

C# | Microsoft Visual Studio | Binary Search Tree | Linked List
For CMSC 204 - Data Structures and Algorithms

My video shows applications written on C# to demonstrate basic operations on Binary Search Trees (implemented via Linked List). The operations covered are:
(1) Inserting a Node
(2) Deleting a Node
(3) Finding the Minimum
(4) Finding the Maximum
(5) Finding Successor of a Node
(6) Finding the Predecessor of a Node
(7) Searching a Node
(8) Printing the Nodes (Inorder)

Tools:
- IDE: Microsoft Visual Studio.
- Screen Recording: Free Cam 8.
- Audio Recording: Audio Evolution Mobile.
- Video Edit: PowerDirector

Additional Notes

I’m sharing additional notes to highlight items that might not have been evident in the 5-minute video.

Buttons

There were 8 options required for the exercise, which I implemented using Buttons in Windows Form.

- Buttons 1 to 6 call matching methods in my Tree class.
- Button 7 (Search) does not exactly call a similar “Tree.Search(key)” but it calls a helper function called GoToNode in an attempt to go to the target node specified by the value.
- Button 8 (Display) also does not a call a “Tree.Display()” method. The Inorder recursion is maintained within the button definition itself.

Helper Methods

I created helper methods in my tree implementation to help with my main methods.

- GoToNode(double? key). This method attempts to go to a node defined by the key and returns the node. If it returns null, then the key does not exist. If it returns a node, then it is found. This method is used multiple times to verify if the node exists before performing any action – Delete (it cannot delete what’s not there), Successor, Predecessor, etc.
- FreeNode(ref Node currentNode, Node toDeleteNode). This recursively finds the node and makes the node null.
- FindParent(double? key). Given a value of a node, this method looks for the parent of the node (and returns the node). This simplifies finding the parent given a node. What this actually does is call GoToNode of the specified key and returns its .Parent if it exists.

Demo Tree Display

This display was not required but I felt that it was a natural next step when using visual Windows Forms.

- I created a placeholder for a 15-node perfect binary tree, but the application can actually handle more nodes than what is displayed.
- Because I’m just working with predefined boxes the code to actually put the value in the box was not complicated. Basically, what it does is assign specific parts of the tree (e.g. Tree.Root.Left.Left.Right, etc.) to its appropriate location (e.g. textBox8, etc.)

Reset Button

The reset button was not a required function. Since I have a display, I also needed a way to clear the display. The reset button calls two methods (within the main form).

- Reset (). The Reset method performs a Postorder recursion to delete each node of the tree. This clears the tree, but not the display.
- ResetDisplayTree(). This clears the entire tree display by assigning “” to each textbox. Performing this alone does not clear the actual tree (just the display).

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «C# | Binary Search Trees (Linked List Implementation)», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

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

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

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