Data Structure Algorithm is to simply place and store data in an organized manner.
For example: Array
We can store data in Data Array, Stack, Queue are type of data structure where we can store data so that we can use it for particular purpose.
Primitive- int, flow
Non-Primitive- Array, Stack, Queue
• To organize data
• Storage of data
• Retrieval of data
• Manipulation of data
• DS allow into storage on hard disk
• It manages large data
• It is necessary for designing of efficient algorithm
Algorithm is a set of instructions which leads to a step procedure for solving a given problem.
- Input: Whatever instructions are entered by the programmers.
- Output: Atleast one outcome will be produced.
- Definiteness: Each instruction should be clear and unambiguous.
- Finiteness: Every algorithm with terminate after a certain number of steps and it is called finiteness.
- Effectiveness: Every instruction must be sufficiently basic that it can in principle be carried out by a person using pencil and paper.
Linear DS: If elements or items are stored in sequence, it is called Linear Data Structure.
Non-Linear DS: Not stored in sequence, elements, or items. Example: Tree, graphs, etc.
- Stack is a linear data structure that follows LIFO (Last In First Out) approach for accessing elements.
- Push, pop, and top (or peek) are the basic operations of a stack.
- Check for balanced parentheses in an expression
- Evaluation of a postfix expression
- Problem of Infix to postfix conversion
- Reverse a string