Join Raghavendra Dixit for an in-depth discussion in this video Binary trees, part of Introduction to Data Structures & Algorithms in Java.
- [Instructor] Now that we know…what a general tree data structure is,…let's look at what a binary tree is.…A binary tree is one in which every node can have,…at most, two children.…That is, a node may have no children,…which makes them a leaf node.…Other node may have only one child,…or it may have two children, but none of the nodes…can have more than that.…That's why they are called binary trees,…because binary means two.…Now, how do we represent a node in a binary tree?…Well, a node contains some data,…just like we held data in the node of a linked list,…and it also have references to it.…
Left and right child, which are themselves,…tree node type of references, all right?…So we can call them left and right,…or left child and right child.…And of course, the child reference may point…to some tree node type of an object.…Let's implement some code in Java.…In the IDE, let's first create a package for this chapter.…And then create a class named TreeNode.…
Let it contain integer type of data,…or if you are aware of generics in Java,…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Why study data structures and algorithms?
- How to calculate the time complexity
- Using Big O notation
- Using basic sorting and search algorithms
- Searching elements in unordered arrays and ordered arrays
- Implementing a linked list in Java
- Implementing stacks using arrays
- Queues using arrays
- Binary search trees
- Representing heaps using arrays
Skill Level Intermediate
1. Introduction to Algorithms
2. Analysis of Algorithms
3. Basic Sorting and Search Algorithms
4. Linked Lists
5. Stacks and Queues
7. Binary Search Trees
8. More Sorting Algorithms
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.