A question concerning algorithms

  • Thread starter Thread starter wajed
  • Start date Start date
  • Tags Tags
    Algorithms
Click For Summary
SUMMARY

The discussion centers on algorithmic concepts related to array manipulation, specifically addressing the storage of values outside the main array during sorting operations. Participants clarify that the "i" variable, referenced in the code, is defined as "j - 1" and is crucial for tracking indices during the rearrangement of the array A. The conversation emphasizes the importance of understanding how external variables, like "k," are utilized to maintain values while sorting, which is essential for efficient algorithm design.

PREREQUISITES
  • Understanding of array data structures
  • Familiarity with sorting algorithms
  • Basic knowledge of variable scope in programming
  • Experience with algorithmic complexity analysis
NEXT STEPS
  • Research in-depth sorting algorithms like QuickSort and MergeSort
  • Learn about variable scope and lifetime in programming languages
  • Explore algorithm optimization techniques for space complexity
  • Study the use of auxiliary data structures in sorting algorithms
USEFUL FOR

Computer science students, software developers, and algorithm enthusiasts seeking to deepen their understanding of array manipulation and sorting techniques.

wajed
Messages
56
Reaction score
0
http://img207.imageshack.us/img207/8504/questionw.jpg


1st question: "with at most a constant number of them stored outside the array any time."
Is that array the sub-array of the sorted numbers?

2nd question: what does the "i" represent? it`s not even mentioned in the text (only in the code)
 
Last edited by a moderator:
Technology news on Phys.org
"with at most ... at any time" means that value of member jth of A will be stored in variables outside of A (in this case, k). This step helps you save the value when you rearrange the array A, i think.

Variables i is declared in line 4 (like j declared in line 1). i is equal to (j - 1 ).
 

Similar threads

  • · Replies 30 ·
2
Replies
30
Views
7K
Replies
12
Views
3K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 13 ·
Replies
13
Views
4K
Replies
9
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K