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;
- Arrays
- Linked lists
- Stack
- 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
- Input − should have 0 or more well-defined inputs.
- Output −should have 1 or more well-defined outputs, and should match the desired output.
- Finiteness − they must terminate after a finite number of steps.
- Feasibility − Should be feasible with the available resources.
- Independent − should be independent of any programming code.
- 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
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)
I've always found DSA very interesting... great intro article.