DEV Community

Catherine Kawara
Catherine Kawara

Posted on

Data Structures 101: Introduction to Data Structures and Algorithms.

A data structure is a particular way of organizing data in a computer so that it can be used effectively.As developers, we must have good knowledge about data structures as it is a key topic when it comes to Software Engineering interview questions.
The most commonly used data structures include;

  1. Arrays
  2. Linked lists
  3. Stack
  4. Queues

Algorithms

An Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. They are normally independent of any programming language, as they can be implemented in more than one programming language.

Characteristics of a good algorithm

  1. Input − should have 0 or more well-defined inputs.
  2. Output −should have 1 or more well-defined outputs, and should match the desired output.
  3. Finiteness − they must terminate after a finite number of steps.
  4. Feasibility − Should be feasible with the available resources.
  5. Independent − should be independent of any programming code.
  6. Unambiguous − Each of its steps, and their inputs/outputs should be clear and must lead to only one meaning.

Example of an algorithm

Algorithms are mostly writen in a step by step manner. For example, an algorithm to ad two numbers would look something like this

Step 1: Start
Step 2: Declare variables num1, num2 and sum.
Step 3: Read values for num1 and num2.
Step 4: Add num1 and num2 and assign the result to sum.
sum=num1+num2
Step 5: Display sum
Step 6: Stop
Enter fullscreen mode Exit fullscreen mode

That is the basic introduction to algorithms, of course this is a much deeper topic which we will continue to explore. Till next time, happy coding✌!

Top comments (1)

Collapse
 
dyarawilliams profile image
D'yara Williams

I've always found DSA very interesting... great intro article.