Data structure and algorithms





Data structure and algorithms


01. Data structure

Data structure means the way we used to store or hold the data (RAM or Hard Disk).

Advanced: A data structure is a way of organizing and storing data in memory (like RAM or even on disk) so that we can access and manipulate it efficiently.

There are some basic data Structures (several commonly used data structures):

  1. Basic data structures: Array, LinkedList, Stack, Queue, Map
  2. Advanced/complex data structures: Tree, Graph, Trie, Heap, etc.

Those 2 types are the foundation/base to build most of data structures.

Array: Stores data contiguously in memory (in a memory block). Fast to access by index, but resizing and insert/delete operations are expensive.

Linked List: In the Link List, not matter where data has been saved. Each data may have in different different locations but in Link List, they (Node) hold the memory address (Stores elements as nodes, where each node contains the data and a reference (or address) to the next node).

  1. Singly Linked List: One direction (→)
  2. Doubly Linked List: Two directions (↔)
  3. Circular Linked List: Last node points back to the first node


NOTE:

Most of other data structures like Stacks, Queues, Trees, and even Graphs and etc... has been bult on top of Array and Link List by providing extra functionality.

There are some pre defined basic and complex data structures:

  1. Ex for simple data structure: Arrays, LinkList, Map, Queue, stack 
  2. Ex for complex data structures: Tree, Graph and etc..

In the java OOP, object is also a complex and custom data structure which we defined.


02. Algorithms means:

Normally we hold the data based on a structure (Data Structure). So we want to do CRUD (Create, read, update or delete) operation on those data.

To do those action (specially read the data), We have different technique to access those data. Those accessing technique is call algorithms.

Multiple algorithms can be applied to the same data structure — but choosing the best one depends on the situation (e.g., speed, memory usage, simplicity).


In Summary:

  • Data Structures help us store and organize data efficiently.
  • Algorithms help us operate on that data to solve problems.
  • Together, they form the foundation of computer science and efficient programming.


Comments

Popular posts from this blog

Database - Topics

02. Spring – Creating spring project clone it with GIT step by step.

01. Steps in SQL Query Execution (MySQL)