#cant figure out variable incrementation placement

1 messages ยท Page 1 of 1 (latest)

soft bloomBOT
#

<@&987246399047479336> please have a look, thanks.

#

I uploaded your attachments as Gist.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
Stuck on this for three hours now. i need variables that increment after a sorting alg swaps/shifts elements, after it loops, and after it compares two elements.

o elements. In a sorting algorithm, variable incrementation should be placed in different parts of the algorithm depending on what you want to track.

  1. To track swaps or shifts of elements, you should increment the variable after each swap or shift operation is performed. This can be done within the swapping logic of the algorithm.

  2. To track loops, you should increment the variable at the beginning or end of each iteration of the loop that goes through the elements being sorted. This will count how many times the loop runs.

  3. To track comparisons between two elements, you should increment the variable within the comparison logic of the algorithm, typically within an if statement where the comparison is being made.

Make sure to initialize your variables before using them and consider where it makes sense to place increments based on what you are trying to achieve with your tracking variables. If you are still stuck after three hours, consider reaching out for help or breaking down your code into smaller parts to better understand where things might be going wrong.

soft bloomBOT
#

Closed the thread.