# Data Structures

Edited by Jen Moreau

## DATA STRUCTURES

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

as possible

### 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.

### BASIC TERMINOLOGY

**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

## ENVIRONMENT SETUP

To set up your computer environment for C programming language, there is need for a text editor and the C Compiler

### TEXT EDITOR

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++

## ALGORITHMS

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.

### ALGORITHM ANALYSIS

Efficiency of algorithm are analyzed either before implementation or after implementation,

- 1in this form, the efficiency of a particular algorithm is determined by assuming that processor speed is constant and have no effect on the implementation.
**A Priori Analysis**: - 2it is an empirical analysis where the selected algorithm is deployed using programming languages.
**A Posterior Analysis**:

### ALGORITHM COMPLEXITY

- 1time is measured by counting the number of key operations.
**Time Factor**: - 2it is measured by estimating the maximum memory space for the algorithm.
**Space Factor**:

### SPACE COMPLEXITY

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 ANALYSIS

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.

## Comments

## Article Info

Categories : Data Structures