Data structure Note

What is data structure?
Data Structures are different ways of organizing data on a computer, that can be used effectively.

What is an algorithm?
Set of insructions to perform a task. Correctness and efficiency makes good algorithm.

Types Of data structure
Primitive – integer, float, character, Boolean
Non-Primitive – Linear
Static – Array
Dynamic – LinkedList, Stack, Queue
Non linear – Tree, Graph

Types of Algorithm
– Simple recursive algorithms
– Devide and conquer algorithms
– Dynamic programmic algorithms
– Greedy algorithms
– Brute force algorithms
– Randomized algorithms

What is Recursion?
The way of solving a problem by having a function calling itshelf. performing the same operation multiple times with different inputs.
Base condition is needed to stop the recursion, otherwise infinite loop will occur.

Why we need recursion?
Recursive thinking is really important in programing and it helps you break down problems into smaller ones and easier to use.

When to choose recursion?
If you can divide the problem into smaller sub problems
Design an algoritm to compute nth
Write code to list th n...
Implement a method to compute all.
It implements stacks internally to call methods.
The prominent usage of recursion in data structures like trees and graphs.
It's used in many algorithms (divide and conquer, greedy and dynamic programing).

The logic behind Recursion:
1. A method calls it shelf
2. Exit from infinite loop

This Post Has 5 Comments

Leave a Reply