top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to check if same value is present in consecutive locations in a circular array using C?

+1 vote
419 views
How to check if same value is present in consecutive locations in a circular array using C?
posted Feb 17, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

go around the arrayList and store the current int in a dummy variable. As you iterate compare against each one and replace. Repeat until the entire way around.

dummy = inf
currentInt = arrayList[0]
for(int = 0; int < size; int++){
    if(dummy == currentInt){return there is a repeat}
    dummy=currentInt
    currentInt=nextInt
}

return no repeat

answer Mar 4, 2016 by Manikandan J
...