We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

CS401 Assignment No 02 Spring 2019 Solution & Discussion Due Date: 30-05-2019

+ Click Here To Join also Our facebook study Group.

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?


See Your Saved Posts Timeline

Views: 4398

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

Replies to This Discussion

here goes the solution. make sure you change the if to represent your vu id instead of this one found in the file.

https://drive.google.com/file/d/1m2b_hewjbpDQbQZ0NKSGjzNeBTgrFUwJ/v...

id kahan likhni 

Bhai jan ye bubble sort h g selection sort nhi h.

Cs401
[org 0x0100]
jmp start

data: dw 1,2,3,4,5,6,7,8,9
swap: db 0

start: mov bx,0 ;intialize array index to zero
mov byte [swap], 0 ;rest swap flag to noswap

loop1: mov ax, [data+bx] ;load in number in ax
cmp ax, [data+bx+2] ;compare with next number

jbe noswap ;no swap if already in order

mov dx, [data+bx+2] ;load second number in first
mov [data+bx+2], ax ;store first number in second
mov [data+bx], dx ;store second number in first
mov byte [swap], 1 ;flag that a swap has been done

noswap: add bx, 2 ;advance bx to next index
cmp bx, 18 ;are we at last index

jne loop1 ;if not compare next two

cmp byte [swap],1 ;check if swap has been done

je start ;if yes make another pass

mov ax, 0x4c00 ;terminate program
int 0x21

; sorting a list of number using selection sort; sorting a list of number using selection sort
[org 0x0100] jmp startdata: dw 6,5,5,0,5,5,3,1,7 yaha apni id likhni haswap: db 0start: mov; 0 ;initialize array index to zeromov byte [swap],0 ;reset swap flag to no swaps
loop1: mov ax, [data+bx] ;load number in axcmp ax, [data+bx+2] ;compare with next numberjbe noswap ;no swap if already in order
mov dx, [data+bx+2] ;load second element in dxmov [data+bx+2], ax ;store first number in secondmov [data+bx], dx ;store second number in firstmov btye [swap], 1 ;flag that a swap has been down
noswap:add bx,2 ;advance bx to next indexcmp bx, 18 ;are we at last indexjne loop1 :if not compare next two
cmp btye[swap],1 ;check if a swap has been doneje start ;if yes make another passmov ax,0x4c00 ;terminate programint 0x21

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service