Sail E0 Webinar
Question
Choose the code snippet which uses recursion for linear search.
Options:
A .  public void linSearch(int[] arr, int first, int last, int key){
B .  public void linSearch(int[] arr, int first, int last, int key)      {
C .  public void linSearch(int[] arr, int first, int last, int key){
D .  public void linSearch(int[] arr, int first, int last, int key){
Answer: Option A


Every time check the key with the array value at first index, if it is not equal then call the function again with an incremented first index.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers