What is a Data Structure? Data Structures And Program Design

Learn about essential data structures like arrays, linked lists, stacks, queues, and trees. Discover their roles in efficient data organization, searching, and processing.
A data structure is a meaningful way of arranging and storing data in a computer so as to use it efficiently.

Let’s take a look at a real-life analogy...

If you go out shopping at a grocery store, you would expect related items to be in the same section, such as the fruit and vegetable section, the meat section, the dairy section, etc. These items can be further organized according to their prices and so on.

Such meaningful structuring of items helps the business operate efficiently. Because you (or anyone) would never visit (or re-visit) a messy store where it takes forever to find each of your required items.

Likewise, you wouldn't want to use a slow computer where searching for an old photo takes around a day. That's why we have an efficient data structure called the ‘file system’ that organizes and stores said data into a hierarchy starting from the root directory.

Though file system is a much more advanced data structure, it does try to solve the fundamental issue that any data structure tries to tackle i.e. efficient way of storing, organizing, and maintaining data.

Basic Terminology

Data - represents an atomic value or collection of facts that could lead to contextual information e.g. a unit value 40 or a collection such as [(35, 19), (35, 18), (30, 18), (29, 18), (29, 17)] doesn't make sense in isolation but are referred to as data nonetheless.

It's only when we associate respective contexts like the price of apples per kg. or 5-day temperature forecast, do we harness information out of the raw data.

Database - an organized record of data so as to use it efficiently, nevertheless usually stored in hard disk or permanent memory as opposed to data structures being stored usually in RAM or volatile memory.

Algorithm - is a step-by-step set of instructions for doing stuff such as making an omelet, playing rugby, checking primes, and reading this article. From washing machines to self-driving cars to every deterministic action ever taken can be expressed as algorithms.

Asymptotic Complexity - determines how fast an algorithm can compute (with respect to input) when applied over a data structure.

We can classify Data Structures into two categories:

1. Primitive Data Structure

2. Non-Primitive Data Structure

The following figure shows the different classifications of Data Structures.

Figure 2: Classifications of Data Structures
Primitive Data Structures

1. Primitive Data Structures are the data structures consisting of the numbers

and the characters that come in-built into programs.

2. These data structures can be manipulated or operated directly by machine-level

instructions.

3. Basic data types like Integer, Float, Character, and Boolean come under the

Primitive Data Structures.

4. These data types are also called Simple data types, as they contain characters

that can't be divided further

Non-Primitive Data Structures

1. Non-Primitive Data Structures are those data structures derived from

Primitive Data Structures.

2. These data structures can't be manipulated or operated directly by machine-

level instructions.

3. The focus of these data structures is on forming a set of data elements that is

either homogeneous (same data type) or heterogeneous (different data types).

4. Based on the structure and arrangement of data, we can divide these data

structures into two sub-categories -

1. Linear Data Structures

2. Non-Linear Data Structures


*

إرسال تعليق (0)
أحدث أقدم