Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. void insertionSortInventory(article inventory[], int noOfArticles){
  2.  
  3. {
  4.  
  5. int i, j;
  6. int nextid;
  7. int nextcounts;
  8.  
  9. for (i = 1 ; i <noOfArticles ; i++) {
  10. nextid = inventory[i].id;
  11.  
  12. j = i - 1;
  13. while (j >= 0 && nextid < inventory[j].id) {
  14. inventory[j + 1].id = inventory[j].id;
  15. inventory[j + 1].counts = inventory[j].counts;
  16. j = j - 1;
  17. }
  18.  
  19. inventory[j + 1].id = nextid;
  20. inventory[j + 1].counts = nextcounts;
  21. }
  22. }
  23.  
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement