News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Re: need help

Started by eax, March 26, 2006, 01:23:28 AM

Previous topic - Next topic

eax

Hello ,


I am fresher in assembly language( 80*86) .

Could you please give me any clue , how to write Bubble sort in assembly language.

Any suggestion would be helpful.

I am trying hard but when i run my program it prints all 0's instead of numbers in asscending order.


hutch--

This sounds a lot like a homework assignment. All you need to do is learn to write assembler code and then code up a bubble sort if you can actually find a use for one.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dsouza123

If your problem is understanding the bubble sort algorithm
then tracing through this unoptimized/simplified pascal example may help.


var
  i,j,s,d,t : longword;
  A : array[0..7] of longword;

begin
  A[0] := 7; A[1] := 6; A[2] := 5; A[3] := 4;
  A[4] := 3; A[5] := 2; A[6] := 1; A[7] := 0;

  i := 0;
  j := 7;
  repeat
    write(A[i]:2);
    i := i + 1;
  until i > j;
  writeln;

  j := 7;
  repeat
    i := 1;
    repeat
      s := A[i];
      d := A[i-1];
      if s < d then begin
        t := s; s := d; d := t;
        A[i]   := s;
        A[i-1] := d;
      end;
      i := i + 1;
    until i > j;
    j := j - 1;
  until j = 0;

  i := 0;
  j := 7;
  repeat
    write(A[i]:2);
    i := i + 1;
  until i > j;
  writeln;
end.

IAO

Hi to all:  My English is poor. But I try.

Mr. eax: You can see here:
http://webster.cs.ucr.edu/
The Art of Assembly Language. Chapter 12.

Thanks.
Bye ('_').


"There is no way to peace. Peace is the way."    Mahatma Gandhi

eax

thanks for ur help .

I am done with bubble sort in assembly language,

now i need to write a program to test if a string is palindrome or not.

please give me any clue to start with it.

Mark Jones

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08