How do you get started with Data Structures in Go.
As a developer, am sure each and everyone of you has come across this expression in either a tutorial, a blog or even a boot-camp. For ages this has been the GO-to expression that every programmer prints while writing the first few lines of their code in any new language. The second part in this unfamiliar territory has always been Data Structure and Algorithms which invokes some level of fear in many developers.This has also been a favorite for interviewers to test one's computer science prowess across different rounds in a technical interview.Me and my colleagues while creating this forum wanted to make sure that the reader understands these fundamentals in such a way that they treat GO as language which helps them communicate better with a computer in a way that two humans communicate better with each other.Many of the concepts that we use in the virtual world are inspired and even copied to some extent from things that are found around us in the real world.
What is a Data Structure ?
A data structure is simply a way to organize the data in a computer.We use different techniques to make it easier for us to access this data and hence we have different data structures to help us in this process.
What are these different Data Structures?
Based on how we organize the data in these different data structures, we can classify them broadly into two categories:
- Linear Data Structures:
This type of data structure stores data in a sequential manner in the computer memory.This means that we can access all the data elements in a single traversal of the data structure.Some of the commonly used Linear Data Structures are:
4) Linked List
- Non-Linear Data Structures
This type of data structure stores data in a non-sequential manner in the computer memory.This means that we cannot access all the data elements in a single traversal of these data structure.Some of the commonly used Non-Linear Data Structures are:
2) Binary Tree
3) Binary Search Tree
6) Hash Table
How do we decide which Data Structure to use?
The decision as to which data structure is to be used under what circumstance solely relies on two aspects, i.e, Space & Time Complexity which is denoted using "O()" notation.I will explain space-time complexity in detail in a separate blog series ,for now, remember the following definition:
Time Complexity: It is the amount of time an algorithm takes to execute its statements.
Space Complexity:It is the amount of memory an algorithm takes during the course of a statement execution.
Armed with this knowledge, let us look at the following article for the first data structure.
Join the conversation