The major method of insertSort