Week 1 Flashcards
is a way of collecting and organizing data in such a way that we can
perform operations on these data in an effective way. It is about rendering
data elements in terms of some relationship, for better organization and storage.
Data Structure
are structures programmed to store ordered data, so that various operations
can be performed on it easily. It represents the knowledge of data to be organized in
memory.
Data Structures
Characteristics ofa Data Structure
- Correctness — Data structure implementation should implement its interface correctly.
- Time Complexity — Running time or the execution time of operations of data structure
must be as small as possible.
Space Complexity — Memory usage of a data structure operation should be as little as
possible.
Data structure implementation should implement its interface correctly.
- Correctness —
Running time or the execution time of operations of data structure
must be as small as possible.
- Time Complexity —
Memory usage of a data structure operation should be as little as
possible.
Space Complexity —
is a step-by-step procedure, which defines a set of instructions to be executed in a
certain order to get the desired output.
Algorithm
Need for data structure
Data Search — Consider an inventory of 1 million (106) items of a store. If the application is to
search an item, it has to search an item in 1 million (106) items every time slowing down the
search. As data grows, search will become slower.
Processor Speed — Processor speed although being very high, falls limited 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.
Consider an inventory of 1 million (106) items of a store. If the application is to
search an item, it has to search an item in 1 million (106) items every time slowing down the
search. As data grows, search will become slower.
Data Search —
although being very high, falls limited if the data grows to
billion records.
Processor Speed —
as thousands of users can search data simultaneously on a web server, even
the fast server fails while searching the data.
Multiple Requests —
categories of algorithm
- Search — Algorithm to search an item in a data structure.
- Sort — Algorithm to sort items in a certain order.
- Insert — Algorithm to insert item in a data structure.
Update — Algorithm to update an existing item in a data structure.
Delete — Algorithm to delete an existing item from a data structure.
algorithm characteristic
- 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. - Input — an algorithm should have 0 or more well-defined inputs.
- Output — an algorithm should have 1 or more well-defined outputs, and should match
the desired output. - Finiteness — Algorithms must terminate after a finite number of steps.
- Feasibility — should be feasible with the available resources.
- Independent — an algorithm should have step-by-step directions, which should be
independent of any programming code.
Basically, data structures are divided into two categories:
Linear data structure
Non-linear data structure
the elements are arranged in sequence one after the other. Since
elements are arranged order, they are easy to implement.
In linear data structures,