code: void addTaskToChain(Task[] tasks, Task task, int index) {
          task.setNext(tasks[index]);
          tasks[index] = task;
      }
docs: Adds the task as the head of the chain at the index location.
  
  @param tasks the ordered array of the pending operations
  @param task  the pending operation to add
  @param index the array location