This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

merge sorting will work in c8051f120?

In c8051f120 controller, i use merge sorting technique of one of my application in a project. but problem is local variable acting as global variables within a function(auto keyword). following is a example of merge sorting.
divide(int left,int right)
{ int mid; if(left<right) { mid=(left+right)/2; divide(left,mid); divide(mid+1,right); }
}

Parents
  • problem is local variable acting as global variables within a function(auto keyword).
    I rather heavily doubt the correctness of that assessment.

    following is a example of merge sorting.
    No, it isn't. Not only is that not mergesort, that's actually no sort algorithm at all. One can tell by it not moving any data at all.

    But yes, even this snippet does have one feature that's rather problematic on an 8051: it's a recursive function. The 8051 is bad at recursion.

Reply
  • problem is local variable acting as global variables within a function(auto keyword).
    I rather heavily doubt the correctness of that assessment.

    following is a example of merge sorting.
    No, it isn't. Not only is that not mergesort, that's actually no sort algorithm at all. One can tell by it not moving any data at all.

    But yes, even this snippet does have one feature that's rather problematic on an 8051: it's a recursive function. The 8051 is bad at recursion.

Children