Array

Array #

Tips #

  1. Don’t discard the option of doing things with more than one pass (possibly two or three passes).
  2. Don’t worry about integrity of the array (sortedness, keeping equal entries together, etc.) until it is time to return.
  3. Consider overwriting an entry, possibly by moving an item from the back, instead of deleting an entry and moving all items from its right).
  4. Learn to manipulate subarrays.
  5. To avoid off-by-1 error and to make the implementation simple, allocate n+1 sized array for n items.
© 2024 Manoj Pravakar