Computer Data Structure: Overview



Introduction

Welcome to my blogpost series on data structure. In this blogpost series, we will be exploring computer data structures, so make sure to sit tight and make sure you are not in a distracted environment.

We will start by discussing what a computer data structure is, why you need to have the knowledge of data structures as a computer programmer, then we will discuss, implement (using Go programming language) some of these types of data structures and situations where we can use them. Before we get started on data structure, let discuss about “Data”. So, “what is data?”.


Data

According to Wikipedia: In common usage and statistics, data is a collection of discrete or continuous values that convey information, describing the quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted formally. In a simpler term, data is basically collection of recorded facts and figures, like numbers, words, measurement, observation, or anything that can be stored and used for reference. Now the question is how data are stored in a computer and the answer to that is “memory”, we all know that computer memory is where computer store data and there are different types of computer memory, but the blogpost series is about computer data structure and not computer memory, so we won’t go into computer memory, but maybe I might create a blogpost series on computer memory in the future.

Now that we all know what data is and where it is stored in the computer, it’s time we discuss data structure. I believe we all know what the word “structure” means, anyways it means arrangement or organization.


What is Data Structure

Data structure is the efficient organization/arrangement/structuring and management of data in computer memory. Data structure allows us to organise and store our data in computer memory for fast access and efficiency use. There are different types of data structures, and they are suited to different kinds of applications, some are very specialised to a particular task. For example, the stack data structure is mostly used for redo-undo features.


Why You Need to Know About Data Structure

You need to know about computer data structure as a computer programmer for several reasons and some of these reasons are:


Type of Data Structure

In this section of this article, we are going to be discussing some different types of data structures and an application example of some of this mentioned data structures. There are many different types of data structure, but we are going to categorize them into two sections, which are primitive and non-primitive data structures.

Recap: Remember we said computer memory is where computers store data, while data structure is how these data are organized in memory for fast access and efficient use.

Primitive Data structure: In simple definition, primitive data structures are the types of data structure that can hold a single value of a specific type in a specific location in computer memory. Example of primitive data structures are:

  1. Integer
  2. Float
  3. Character
  4. Boolean
  5. etc.

Primitive data structures, also known as basic data types, are the basic building blocks of data and they cannot be subdivided but they can be organized within more complex data structures. For example, Array allows one to store a collection of elements of the same data type, so we can have an array of integers, floats, character, Boolean, etc.

Non-Primitive Data structure: In simple definition, non-primitive data structures are the types of data structure that can hold more than one value either in a contiguous location in computer memory or in a random location. Example of non-primitive data structures are.

  1. Array
  2. Stack
  3. Queue
  4. Linked list.
  5. Tree
  6. etc.

Unlike a primitive data structure, a non-primitive data structure can be subdivided into linear and Non-linear data structures in which linear data structures organize and store data in a contiguous location in memory, while Non-linear data structures organize data in a random computer memory location. Although not all linear data structures organize and store data in a contiguous memory. for example, a LinkedList. In a linked list, data are not organized and stored in a contiguous memory location instead they are linked using a pointer. So, we can say a linear data structure organizes and stores data sequentially.

Example of Linear and Non-Linear data structures are:

Linear Data Structure:

  1. Array
  2. Stack
  3. Queue
  4. etc.

Non-linear Data Structure:

  1. Graph
  2. Tree
  3. etc.

Situation in Which Some of These Data Structure Can be Use

This section of the article gives some examples of a situation in which some of the data structures mentioned above can be used.

Examples are:

  1. Array: When you need collection of elements of the same type of a fixed size and constant time access
  2. Graph: When you need to represent relationships between entities e.g. social network
  3. Stack: When you need Last in First out behavior e.g. backtracking algorithm
  4. Queue: When you need First in First out behavior e.g. scheduling algorithm
  5. etc.

Conclusion

Great!
You made it to the end of this article. I hope you find it interesting and informative, and I hope that now you know what data structures are, why you need them, the types of data structures and situations in which you can use some of these data structures. In the coming articles, I am going to be discussing and implementing some of these data structures using Go programming language.