# The total number of element comparisons made in Non-DC=?

**URL:** <https://forum.kirupa.com/t/the-total-number-of-element-comparisons-made-in-non-dc/663633>\
**Category:** Uncategorized\
**Created:** [December 13, 2023, 3:29pm UTC](https://forum.kirupa.com/t/the-total-number-of-element-comparisons-made-in-non-dc/663633 "2023-12-13T15:29:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oslon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/oslon/32/24631_2.png) [@oslon](https://forum.kirupa.com/u/oslon)\
**Post date:** [December 13, 2023, 3:29pm UTC](https://forum.kirupa.com/t/the-total-number-of-element-comparisons-made-in-non-dc/663633/1 "2023-12-13T15:29:46Z")

</div>

```auto
Algorithm Non_DC(A,n,max,min)
{
    max<-min<-A[1];
    for i<-2 to n 
    {
        if(A[i]>max)
        {
            max<-A[i];
        }
        if(A[i]<min)
        {
            min<-A[i];
        }
    }
}

```

Let us assume a best case:  
What’ll be the best case?  
Let us assume a worst case:  
What’s the worst case?

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [December 13, 2023, 6:53pm UTC](https://forum.kirupa.com/t/the-total-number-of-element-comparisons-made-in-non-dc/663633/2 "2023-12-13T18:53:51Z")

</div>

It isn’t helpful to ask us to answer questions without providing more context.

What do you think the answer is? Why do you think that is the answer?
