DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Rhonajoy
Rhonajoy

Posted on

INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS

Data Structures and Algorithms is such an essential unit in computer science and programming because it helps us understand the nature of a programming problem at a deeper level.
The name Data basically means a collection of Information, while structure would mean someplace holding in things.
So therefore data structure in technical terms translates to a named place that can be used for storing,organizing,manipulating data.
An Algorithm is simply a set of finite steps or instructions to solve a particular problem.
Let us take for example that our goal is bake a cake, the algorithm to it would probably look like:
Mix up dry ingredients
Mix up wet ingredients
Mix-up the dry and wet ingredients
Preheat oven
Put cake in the oven for 45 minutes at 400 degrees celsius

There are two main types of data structures. These include:
Primitive Data structures- They store data in one type.
Non-Primitive Data Structures-These store data of different types in a single unit.They are further divided into two categories:
LINEAR DATA STRUCTURES
These are those that are arranged in a line form. Meaning items come one after the other. Examples : Arrays,Queues,Stacks and Linked Lists
NON-LINEAR DATA STRUCTURES
For these items are not arranged sequentially rather they are arranged in a hierarchical manner using nodes. Each node may be connected to two or more items. They are majorly categorized into two types, that is trees and graphs.

primitive and non primitive data structures

REAL LIFE APPLICATIONS DATA STRUCTURES

  • Online bus booking systems
  • Web Browsers
  • Music player applications
  • Google Maps

CHARACTERISTICS OF AN ALGORITHM

Finiteness - An algorithm must always stop after a finite number of steps.
Definiteness - Each step of an algorithm must be precisely defined,put in a clear and concise manner.
Input -An algorithm has zero or more inputs.
Output- An algorithm has one or more outputs.
Effectiveness- An algorithm is also generally expected to be effective.

An algorithm’s performance is tested against two major metrics:
The amount it takes to run- Time complexity
The amount of space it uses up during its execution- space complexity
Guidelines of writing a good algorithm are:

  • An algorithm will be enclosed by START (or BEGIN) and STOP (or END).
  • To accept user input we use statements such as INPUT, READ.
  • To showcase results/ outputs we use statements such as PRINT, DISPLAY
  • COMPUTE or CALCULATE is used while describing mathematical expressions and based on situation relevant operators can be used.
Step 1: Start
Step 2: Declare variables num1, num2 and multiple.
Step 3: Read values num1 and num2.
Step 4: Multiply num1 and num2 and assign the result to multiple.
       multiple←num1*num2
Step 5: Display multiple
Step 6: Stop

Enter fullscreen mode Exit fullscreen mode

Top comments (6)

Collapse
 
ritzmike12 profile image
michael Arita

Nice piece

Collapse
 
rhonajoyke profile image
Rhonajoy

Thank you

Collapse
 
monginadiana profile image
monginadiana

Insightful article, keep up the good workπŸ‘

Collapse
 
rhonajoyke profile image
Rhonajoy

Thank you!

Collapse
 
paragonnoah profile image
Noah Mugaya

thats awesome

Collapse
 
rhonajoyke profile image
Rhonajoy

Thank you

Create an Account!
Now it's your turn!
Β 
πŸ—’ Share a tutorial
πŸ€” Reflect on your coding journey
❓ Ask a question

Create an account to join hundreds of thousands of DEV members on their journey.