-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata structure.html
More file actions
40 lines (40 loc) · 2.04 KB
/
data structure.html
File metadata and controls
40 lines (40 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html>
<head>
<title>DATA STRUCTURE</TITLE>
</head>
<body>
<h1 style="text-align:right;color:rgb(78,78,90);text-transform:uppercase;">sorting</h1><hr/>
<ul type=square style="font-size:20px";>
<li>Sorting is the process of arranging the data in some logical order.</li>
<li>This logical order may be ascending or descending in case of numeric values or dicitonary order in case of alphanumeric values.</li>
<li>Two types of sorting<br/>
- INTERNAL SORTING
-EXTERNAL SORTING</li>
<p>Some sorting algorithm which are used to sort a list of data.This sorting algprithm is very useful.Following are the sorting algorithm which we are discuss here: <br/>
<ol>
<li style="color:red;text-transform:uppercase;font-size:24px";>insertion sort</li>
<li style="color:red;text-transform:uppercase;font-size:24px";>bubble sort</li>
<li style="color:red;text-transform:uppercase;font-size:24px";>slection sort</li>
<li style="color:red;text-transform:uppercase;font-size:24px";>radix sort</li>
</ol>
<h2> INSERTION SORT </h2>
<p style="text-size:20px";>Insertion sort is a simple sortion algorithm that work similar to the way you sort a playion card in your hand.Initially the list is virtually split into two part sorted part and unsorted part.
Elements are picked from unsorted list and placed in the sorted sublist until the list is sorted.</p>
<p style="color:brown";> ALGORITHM</P>
<ol style="tezt-size:20px";>
<li>If it is first element then it is already sorted</li>
<li> Pick the next element.</li>
<li>Compare with all other element in the sorted sublist.</li>
<li>Shift all tha element in sublist if they are greater than the value which is to be sorted.</li>
<li>Insert the value</li>
<li>Repeat the steps until the list is sorted</li>
</ol>
<p>Complexity of insertion sort</p>
<ul>
<li>Worst case:Every element has to compare with each of the other element soo for every Nth element,(n-1) comparisons are made therefore,
n*n-1~n*2 ,its complexity is O(n^2).</li>
<li>Best case :O(n)</li>
</ul>
<a href="datastruct.html">next sorting</a>
</body>
</html>