1-Introduction To Data Stage and Algorithm-22!05!2024
1-Introduction To Data Stage and Algorithm-22!05!2024
Proof of correctness
Data structures
• Organization of data in memory
01-08-2022 3
On the basis of size the data structure can be classified as: Static
and Dynamic Data structures
01-08-2022 4
Data structure types
01-08-2022 5
Standard operations
• Traversing
• Insertion
• Deletion
• Updation
• Sorting
• Searching
• Merging
01-08-2022 6
Need for Data structures
• As applications are getting complex and data rich, there are three
common problems that applications face now-adays.
• Data Search − Consider an inventory of 1 million(10^6) items of a store. If
the application is to search an item, it has to search an item in 1
million(10^6 ) items every time slowing down the search. As data grows,
search will become slower.
• Processor speed − Processor speed although being very high, fails if the
data grows to billion records.
• Multiple requests − As thousands of users can search data simultaneously
on a web server, even the fast server fails while searching the data.
8
Algorithm: Definition & Characteristics
• Algorithm is a finite sequence of unambiguous
instructions for solving a problem i.e., for obtaining
a required output for any legitimate input in a finite
amount of time.
Characteristics of an algorithm
Unambiguous − Algorithm should be clear and unambiguous. Each of its steps (or phases), and their
inputs/outputs should be clear and must lead to only one meaning.
Output − An algorithm should have 1 or more well-defined outputs, and should match the desired
output.
Independent − An algorithm should have step-by-step directions, which should be independent of any
programming code.
Generality: The algorithm must be able to work for a set of inputs rather than a single input.
Stages of algorithm development
Step 1 : Describing the problem.
The problem should be clearly explained, so that it's easy for the developer to find
the solution for the problem.
• These particulars are taken into account in the next step of our procedure.
Step - by - step refinement refers to the process of gradually
Stages of algorithm development
Step 5 : Review the Algorithm
Examine the algorithm step by step to see if it solves the original problem.
Does this algorithm solve a very specific problem or does it solve a more general
problem
Example
Area of any circle (formula π*R2) -> Solves a more general problem
Stages of algorithm development
Step 5 : Review the Algorithm
Example
Is this solution similar to the solution to another problem? How are they alike? How they
are different?
Example
Consider the following two formulae for computing the area:
Rectangle area = length * width
Differences: Different measurements are used. The triangle formula contains 0.5.