Data Structure Insertion Sort Algorithm

Data Structure Algorithm for Straight Insertion sort pseudo-code.
After knowing and completely understanding this algorithm for Insertion sort. You will be able to write a Data Structure Program for Insertion sort in any language. The basic ideology and idea behind all the programs will be same. Yes the programs will differ according to the syntax and semantics of the language. 
This algorithm is a part of Mumbai University MCA Colleges Data Structure MCA Sem 2.



Algorithm InsertionSort(list) (* Assume the list is not empty. *)
1 set listWall to startList (* listWall points to start of unsorted list *)
2 loop while listWall <= endList
1 set hold to listWall
2 set current to listWall prev
(* scan the sorted list moving larger elements to right *)
3 loop while (current > startList) AND hold key < current key
1 move current to current next
3 set current to current prev
4 end loop (* found the insertion point *)
5 move hold to current next
7 set listWall to listWall next
3 end loop
End InsertionSort


Hope this Algorithm is useful to you in some sense or other. Keep on following this blog for more Mumbai University MCA College Programs. Happy Programming and Studying.

No comments:

Post a Comment