where this is because it knows how many items are already in the array the new item is simply inserted in the next available space searching and deletionhoweverare not so fast in no-duplicates mode you're on your honor not to insert an item with the same key as an existing item if you dothe applet displays an error messagebut it won' prevent the insertion the assumption is that you won' make this mistake searching click the find button you'll be prompted for the key number of the person you're looking for pick number that appears on an item somewhere in the middle of the array type in the number and repeatedly press the find button at each button pressone step in the algorithm is carried out you'll see the red arrow start at cell and move methodically down the cellsexamining new one each time you push the button the index number in the message checking next cellindex will change as you go along when you reach the specified itemyou'll see the message have found item with key or whatever key value you typed in assuming duplicates are not allowedthe search will terminate as soon as an item with the specified key value is found if you have selected key number that is not in the arraythe applet will examine every occupied cell in the array before telling you that it can' find that item notice that (again assuming duplicates are not allowedthe search algorithm must look through an average of half the data items to find specified item items close to the beginning of the array will be found soonerand those toward the end will be found later if is the number of itemsthen the average number of steps needed to find an item is / in the worst-case scenariothe specified item is in the last occupied celland steps will be required to find it as we notedthe time an algorithm takes to execute is proportional to the number of stepsso searching takes much longer on the average ( / stepsthan insertion (one stepdeletion to delete an item you must first find it after you type in the number of the item to be deletedrepeated button presses will cause the arrow to movestep by stepdown the array until the item is located the next button press deletes the item and the cell becomes empty (strictly speakingthis step isn' necessary because we're going to copy over this cell anywaybut deleting the item makes it clearer what' happening implicit in the deletion algorithm is the assumption that holes are not allowed in the array hole is one or more empty cells that have filled cells above them (at higher index numbersif holes are allowedall the algorithms become more complicated because they must check to see if cell is empty before examining its contents alsothe algorithms become less efficient because they must waste time looking at unoccupied cells for these reasonsoccupied cells must be arranged contiguouslyno holes allowed thereforeafter locating the specified item and deleting itthe applet must shift the contents of each subsequent cell down one space to fill in the hole figure shows an