Data structures and algorithms (Intro)

Data structures and algorithms (Intro)

Hey! Thanks for coming to this corner.

Who is this for?

  1. Computer science undergraduate looking to learn data structures.
  2. Developers who want to understand data structures.

Content:

1.Why study Data structures?

  1. Data and types of data.

  2. What are data structures?

  3. Types of data structures and their examples.

  4. What is an algorithm?

Let's get right in.

Why study Data Structures?

Data structures are what makes storing, accessing and retrieving data in everyday computing efficient. It is important for every developer to have a knowledge of it as we deal with data directly or indirectly.

Before proceeding to what data structures are, let us consider what data is and the types of data.

Data

Data is simply unprocessed facts and figures. The only become useful when they undergo processing that is needed. What are the types of data that exist?

Data types.

We have:

  • built-in or primitive data types(we would be referring to this as primitive).
  • Abstract data types.

Primitive data types are provided by the programming language. They often serve as the building block. They include:

  • integers(int)
  • floating point numbers(for decimals)
  • Char(specific to some languages like C and Java)
  • Strings.
  • Booleans(True and False) In languages like Java and C(Forgive me, I might be referring to them a lot throughout this series), Double(for two or decimal points).

Abstract data types.

Abstract data types or (ADT for short) is a data type that gives information about the types of operations to be performed on it but not how it should be performed.

Examples of ADTs.

  • List
  • Stacks
  • Queues
  • Graphs

    Abstract data types are sometimes confused with data structures, but the main difference is that data structures are used to implement abstract data types(ADT). Just keep that at the back of your mind, it would get clearer as we progress. Hang on!

What are data structures?

There are tons of definitions of data structures on the internet. These definitions are only expressed in different terms but they mean the same thing.

Data structures are logical ways or models for organizing data in the computer memory.

They make it easy to store and access data. The usage and purpose of the data will determine the data structure to be used.

Types of data structures.

There are two types of data structures.

  1. Linear - Arranged in linear format(

Examples: Arrays and Linked list.

  1. Non-linear - Arranged in a non-linear format

Examples: Trees, Graphs.

These two types of data structures can also fall into two categories:

  • Static : Memory is allocated at compile time i.e before execution of the program.
  • Dynamic: Memory is allocated at runtime i.e during the execution of the program.

2021-03-10 (2).png

List of data structures.

  1. Arrays.
  2. Linked list.
  3. Queues.
  4. Trees.
  5. Heaps.
  6. Graphs.

These are some of the most popular data structures. Other complex ones are usually an implementation of one data structure to perform a task e.g Hash tables, binary trees, hash trees etc.

Algorithms.

An algorithm is a step by step procedure to solve a specific problem. In computing, there are various types of algorithms and they differ in their applications. I wrote about algorithms as a aid for problem solving here.

In the coming articles of this series, we would focus more on language agnostic concepts that are useful in data structures and algorithms.

If you find this article helpful, please let me know. You can also shoot me a DM on Twitter .

Peace.