Results 1 to 7 of 7

Thread: Threading and recursive functions problem.[solved]

Threaded View

  1. #1

    Thread Starter
    Lively Member mindloop's Avatar
    Join Date
    Mar 2004
    Posts
    64

    Resolved Threading and recursive functions problem.[solved]

    Hi, i'll briefly try to explain what i'm trying to do:

    For programming class i got to prepare a project that demonstrates QuickSort algorythm. This means i have to create an animation that simulates the sorting process: the elements in the array to be sorted, the swapping of elements in each partition (i'm implementing "in place quicksort" algorythm).
    The animation runs ok, i'm using labels to depict each number in the array to be sorted, but my problem is the one requirement that sais that my program should implement pausing and step-by-step runnning of the animation and various speed settings. this is the C# code i'm using, sorry for not having vb.net version, still on c# forums noone had any ideea:

    Code:
    public void _swapBars(int L ,int  H)
    		{
    			int i;
    			
    			Bar low = (Bar)(bare[L]);//Bar object is a control that inherits Label
    			Bar high = (Bar)(bare[H]);
    			int posHigh = high.Left ;
    			for (i=0;i<120;i++)
    			{
    				low.Top--;
    				high.Top--;
    			};
    			
    			
    			if (L!=H)
    			{
    
    				do
    				{
    					
    					low.Left++ ;
    					high.Left--;
    				}while (low.Left<posHigh);
    			}
    
    			for (i=0;i<120;i++)
    			{
    				low.Top++;
    				high.Top++;
    			}
    			
    			bare[L]=high;
    			bare[H]=low;
    			         
    
    		}

    Where should i look into so i can control the speed of the animation and the breakpoint-like runnning mode ?

    something similar to what i'm looking for is presented on this page:
    http://ciips.ee.uwa.edu.au/~morris/...10/qsort1a.html
    check for the [run quicksort animation] button located on the bottom of the page.
    Last edited by mindloop; Mar 31st, 2005 at 04:16 PM.
    ehmm...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width