Edited by Jen Moreau
- 1 DATA STRUCTURES
- 2 ENVIRONMENT SETUP
- 3 ALGORITHMS
- 4 Comments
The data structure is a systematic way to get data organize in other for effective use. Foundation terms in data structure;
- Interface �"this illustrates and represents operations the data structure supports. An interface present only supported operation.
- Implementation- it provides the definition of an algorithm employed in the operation of the structure.
CHARACTERISTICS OF DATA STRUCTURE
- Space Complexity �" effective management of memory space.
- Correctness �" the user interface should be well implemented
- Time Complexity �" running and execution time should be as minimal
NEED FOR DATA STRUCTURE
- Data search �" for fast and effective data search
- Multiple Request �"
- Processor Speed �" this might be less effective if the data grow above billions of record.
Data structure provides the solution to these needs. When data is well organized, required data or set of data can be searched almost instantly.
- DATA �" Data value.
- DATA ITEM �" refers to as single unit of values
- GROUP ITEM- they are subdivided data items.
- ELEMENTARY ITEM- a set of undivided data items.
- ATTRIBUTE AND ENTITY �" a set of attributes or which may be assigned a value is called an entity.
- ENTITY SET �" similar set of entities
- FIELD- single elementary unit if information
- RECORD �" collection of field values
- FILE- collection of records in an entity set
To set up your computer environment for C programming language, there is need for a text editor and the C Compiler
This main function is to type your program. Most common examples are Notepad++, windows notepad. Files created by this editor are called source file and mainly contained source codes.
THE C COMPILER
The compiler job is mainly to convert the program you write to machine language for the CPU to implement on. For compiling compiler such as C/C++
The algorithm is a step by step procedure which defines the set of rules /instruction to be executed. An algorithm is independent of any language, it can be implemented in more programming. These are some important categories of an algorithm.
- Search: used to search an item
- Sort: use to sort items in a specific order.
- Insert: use to insert item
- Update: use to update an existing item
- Delete: use to delete an existing item
CHARACTERISTICS OF AN ALGORITHM
- INPUT: there should be 0 0r a well-defined input
- OUTPUT: there should be 1 or a well-defined output
- UNAMBIGUOUS: it should be clear and have a unique output.
- FINITENESS: Must terminate after finite steps
- FEASIBILITY: should be feasible
- INDEPENDENT: It should be independent of any program
HOW TO WRITE AN ALGORITHM
The algorithm should follow step by step process. Example:
Alternatively, the algorithm can be rewritten as thus
With the second example, it becomes easy for the analyst to analyze the algorithm. A particular problem can be solved in more than one ways.
Efficiency of algorithm are analyzed either before implementation or after implementation,
- 1A Priori Analysis:in this form, the efficiency of a particular algorithm is determined by assuming that processor speed is constant and have no effect on the implementation.
- 2A Posterior Analysis:it is an empirical analysis where the selected algorithm is deployed using programming languages.
- 1Time Factor:time is measured by counting the number of key operations.
- 2Space Factor:it is measured by estimating the maximum memory space for the algorithm.
This represents the total amount of memory space required in a life cycle by the algorithm. Space Complexity of any algorithm P is S(P) = C + SP(I)
Where S(P) = space complexity
C= fixed part
S(I) = variable of the algorithm
P = algorithm
An example is illustrated below,
Hence S(P) = 1+3
Asymptotic Analyse refers to defining mathematical framing of its run time performance. With this analyses, we can best decide which is the best case, worst case and an average case of an algorithm. For example, the running time of an operation F(n) maybe for another operation g(n2), similarly the running time of the two operations will be significantly same if n is small.
Time required for an algorithm fall under these three categories
- BEST CASE: Smallest time for program execution
- AVERAGE CASE: Average required time for execution
- WORST CASE: Maximum required time for execution
- If you have problems with any of these steps, ask a question for more help, or post in the comments section below.
Categories : Data Structures