Showing posts with label data structures. Show all posts
Showing posts with label data structures. Show all posts

Wednesday, September 13, 2023

 Tree Data Structure



A tree data structure is a hierarchical data structure that consists of nodes connected by edges or branches. It is called a "tree" because it resembles an upside-down tree with a single root node and various child nodes branching out from the root.
Each node in a tree can have zero or more child nodes, and it is organized in a way that reflects a hierarchical relationship.

 Queue Data Structure


Intro

Queue is a LIFO (First In First out) based data structure. That means the element we add first will be the first one to be removed from the queue.
It is just like a queue (line) of people waiting to enter the cinema. People that got there first, will be the first to enter the cinema.

 Stack Data Structure


Intro


Stack is a special type of data structure. The order in a Stack is LIFO (First In First Out) which means the element we added last will be first removed from the stack.

 Array List VS Linked List


Here are some differences between the Array List and Linked List:

 Linked List Data Structure


Intro

Linked List is a special type of data structure where elements besides holding data, have pointers.
The element can have up to two pointers.

Tuesday, September 12, 2023

Dynamic Array - Implementing custom ArrayList in Java


Intro


In the previous post, we covered the static arrays. Here, we will discuss and implement a dynamic array - ArrayList.

 Arrays


Intro


Array is a special type of data structure, where we have easy access to elements. It is an index-based data structure and elements get stored in a contiguous order in memory, hence the fast retrieval.