What is Search Function:
Search function mean that when a user want to find an element or thing in the many things.
In the view of a developer search function is perform to make a crawler which check the every element or thing of the list and when this crawler find the key matching element then it return the function performance which is written inside the program.
In the view of a developer search function is perform to make a crawler which check the every element or thing of the list and when this crawler find the key matching element then it return the function performance which is written inside the program.
Example:
We can take the example of a list of the workers in the list and the owner of the company want to know that which worker is not get its pay now a time then the crawler of the program go inside the list of the workers and then check the every worker account detail that is the salary convey to this worker or not if the salary is reached or convey to the worker then it pass that account and go to the next account and in which account it find the worker that to this worker salary is not conveyed then it might make a list and write every worker name in the list to whom the salary is not conveyed.Then at the last it show the list of the workers to whom the salary is not conveyed.
Search Function Design:
In the list the search function is performed by traversing mean first a list of the node is created or it already created then as the concept is already cleared that there are two given namic nodes in which the first is the first node and the last take the name last node.Then for searching take a element ,number or anything which want to search in the list from the user and also make a temporary pointer which is used for traversing in the list.
If any reader does not know about the traversing then user can read the traversing article in the website.
Then the traversing process is started and the temporary pointer take the value of the first pointer and then in a loop the condition is checked that if the number which is searching is found at the first node then show it that the number is found but if not then the temporary pointer take the value of the next node to the first and then in the condition checking if number found then show at the message other wise go to the next node and take its value and this process is working till the number is found or till the temporary pointer reach the last pointer that mean number is not in the list and show the message to the user that number is not found.
If any reader does not know about the traversing then user can read the traversing article in the website.
Then the traversing process is started and the temporary pointer take the value of the first pointer and then in a loop the condition is checked that if the number which is searching is found at the first node then show it that the number is found but if not then the temporary pointer take the value of the next node to the first and then in the condition checking if number found then show at the message other wise go to the next node and take its value and this process is working till the number is found or till the temporary pointer reach the last pointer that mean number is not in the list and show the message to the user that number is not found.
Conditions and Loops:
The best conditions for checking the number if condition and syntax is if number is equal to key.
The best loop is while loop for this situation.Even the for loop can also be used but it can not give the proper functioning that's why its best to use the while loop and then in the loop check the if condition.
0 Comments
Commet
Emoji