It is currently Tue Jun 02, 2020 1:44 pm

All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: PUSH/POP STACK
PostPosted: Sun Apr 16, 2017 4:00 pm 

Joined: Thu Apr 13, 2017 2:01 am
Posts: 1

I have a question in regards array pushing and popping. I am trying to write a code that will sort an array in ascending order, and the way I have went about it is to find the minimum from the initialized array (which I have completed and working) then after I would like to pop it out of array 1 and store it into array 2, then check for the minimum again and keep this cycle going until it's done.

Or I also thought instead of push and pop I could swap the maximum value found with the element in the first index and decrement size checking the rest of the elements because by the time I have run through all of the array it would be in ascending order.

Is my thought process illogical and is there a way where I could do this in 68000 or no? If it is possible how do I go about this issue?

 Post subject: Re: PUSH/POP STACK
PostPosted: Thu Apr 20, 2017 4:25 am 

Joined: Thu Feb 23, 2017 4:24 am
Posts: 3
Your thought process is on the right track. What may help you is the coverage of the subject of "Sorting Algorithm" on Wikipedia. My favorite algorithm is the Insertion short, which I implemented in 6809 assembly language and can translate nicely to 68000. It was written to sort the filenames in a disk directory, then secondary sort them by date. The algorithm can be implemented in most any high level language which supports arrays. The 6809 and 68000 have indexed addressing modes which make easy work of indexing into arrays. Easy68k is a perfect platform to experiment on. Hope this helps.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group