Skip to content

Latest commit

 

History

History
103 lines (76 loc) · 3.63 KB

BasicOfDataStructureandAlgorithm.md

File metadata and controls

103 lines (76 loc) · 3.63 KB

Data Structure And Algorithm

Data Structure

  • Data Structure is a way of storing and organizing information in a systematic way so we can we retrieved and handled more efficiently and more productively.
  • The data structure is a data organization, management, and storage format that enables efficient access and modification.
  • An Efficient program executes faster and helps minimize resources like disk, chip, memory.

There are two types of data structures

1.Primitive Data Structures

  • Primitive types are the most basic data types available within any programing language.
  • Primitive data types are predefined types of data, which are supported by the programming language.
  • To handle primitive data types such as int, float in an efficient way called primitive data structure.

Examples:

- integer
- float
- boolean
- string

2.Abstract Data Structures.

  • Abstract Data type (ADT) is a type (or class) for objects whose behavior is defined by a set of values and a set of operations.
  • We have some abstract data types such as stack queue, linked list, graph, tree to handle this type of data in an appropriate way we need abstract data structures.
  • Abstract Data type doesn't just store a value, but rather a collection of values in various formats.

Examples:

- Array
- List
- Stack
- Tuple
- Dictionary
- Set
- Files
- Queue

Algorithm:

  • The algorithm is a set of rules or logic defined in proper flow to complete a predefined task.
  • A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.
  • Algorithms are unambiguous specifications for performing calculation, data processing, automated reasoning, and other tasks.
  • A set of rules that precisely defines a sequence of operations called an algorithm.
  • The algorithm is basically an instance of logic written in software by software developers, to be effective for the intended "target" computer(s) to produce output from given (perhaps null) input.
  • An optimal algorithm, even running in old hardware, would produce faster results than a non-optimal (higher time complexity) algorithm for the same purpose, running in more efficient hardware; that is why algorithms, like computer hardware, are considered technology.
  • The algorithm can be expressed either as an informal high-level description as a pseudo-code or using a flowchart.
  • If the algorithm is efficient and fast then our data structures of programming are good.

How to decide that the algorithm is efficient & fast?

If the algorithm takes less amount of time to execute a program(or solve a problem) and consume less amount of memory on disk then we can call such an algorithm as efficient, fast and appropriate.

The performance of an algorithm can be depended upon the following two properties 1.space complexity. 2.time complexity.

1. Time Complexity:

  • The time complexity is a function or method that gives the amount of time required by an algorithm to perform a specific task.

2. Space Complexity:

  • The space complexity is a function or method that gives the amount of space required by an algorithm to perform a specific task.

Note: There are many solutions or techniques available to perform a specific task but choose that algorithm that has higher performance in the term of space and time.

Data Structure

  1. Array
  2. Linked list
  3. Stack
  4. Queue
  5. Binary search tree
  6. Balanced Binary Tree
  7. Heap
  8. Dictionary
  9. Tries
  10. Graph
  11. Hash Table

Searching Algorithm

  1. Linear search
  2. Binary search

Sorting Algorithm

  1. Bubble sort
  2. Merge sort
  3. Selection sort
  4. Insertion sort
  5. Heapsort
  6. Quicksort