Programming Series: Search Index History

in programming •  6 years ago 

Rashid does not go shopping before Eid or any festival. Because there are lots of customers before the festival. The shopkeepers do not care for the price of the customers. Rashed goes shopping everyday in the day. It is also around 10am in the morning. So that the shopkeeper gives a little profit as the first customer but gives things. She pretends to go to the low price sometimes. To see the customer go away, the shopkeeper would call back from the shirt and pants for less profit. Without it shirt or t-shirt somewhere torn, a sticker or oil stain on the fracture does not change then Rashed Rather than trying to reduce the price of things by half the problem, she tries to reduce the price. Because of the need to save more money than the tangled or oil spots, the more importer than him.


| Search algorithm | using index | search |

Find the mango seedlings at the search

Two days of end mobile charger can not be found. Rashed said to comfort him, listen, many lose a lot. For example: class books, umbrella on rainy days, sleeveless jacket, shoes at the mosque, how much more! But you were losing your pants to the Eid prayers during your childhood? Thukku, I forgot that it can not be said to everyone.


Flour flour, find out for you

But many people are looking for lost things. That's why the police searched for the terrorists, the investigation committee looking for crime, looking for a promotional promotion, looking for the bus helper passengers. Looking for such a flour flour as sugary, our life was 'Search: The Search' mission. But the search for all these searches is to find mobile chargers. No human can be found in the world that the mobile phone charger does not lose two or four times a month.


Finding the charger at the top of the table, the chipchapate book. If you do not find it there under the pillow. Pants in the pocket, university bag. If you do not get anywhere, there will be no way you can find it under the checkpoint. Now, once you start searching for a checkpoint, you can once again find the right side of the left side, from the left side to the loose style. However, it may take a lot of time to find these systems. So from the one side of the cold head, Pace started to walk a little bit.


The wall color burgers, now the charger and the search

Find out that this charger is Finding this search is a task. The system that is looking for the charger under the checkpoint, can find books, Punjabi, shoes under the box on the same system. That means finding the same system. It can be used to find any thing. And since you're working to find out. So search the search for the search. Finding the search is called search in English.


You're short in height. Your hand is not long. So, with your own hand, you can not pull out the things that are lying in the middle or behind the stools. For that, you have got a stick as an alternate method.

                        

First, pull a piece of cloth from the bottom of the stool with a stick. Then see if it is a charger or not. If there is a charger, then your search is complete. Because the charger got you. And if it is not the charger, then pull the stick with another stick. Then check whether it is the charger or not. If it is not the charger, then pull the next thing with the stick. It means that until the charger passes it will be able to get out with a stick. Now when you write step by step on finding the top charger-


  • Step-1: Make a possible list of what's under the checkpoint


  • Step-2: Pull one thing up and down


  • Step-3: Check whether it is a charger or not


  • Step-4: Work is done on the charger. And if you do not have a charger, you will be searching


The steps of a program or program are called step by step, in the programming language algorithm. The algorithm does not need to be heated to the head. Just remember that the search program is a search algorithm for searching or finding a thing. That's all. And search algorithms are used to find different things. That means you were looking for the charger a little earlier. That was the job of finding the charger with search algorithm. Now if the stapple in search of charger will be written in English-


for every jinish in choukirTola


        get a jinish


        If jinish is a charger


               got charger and stop the search


The first line of writing in the upper English is written, "for every jinish in choukirTola" means that you have to find all that is in the bottom of your pocket. That means there are many things in the bottom of your checkpoint. If there are many things, they can be put together in an array.


The world is lying in the bottom of your pocket. They can not be rescued even after a three-hour shootout. Still, you dare to find a Charger with courage. Your idea is, there are T-shirts, jeans, shoe boxes, books, towels, chargers, coke bottles, empty packets of chips, notebooks, water glasses, america, Punjabi etc. And it's very straightforward to put these things in an array. Just write the names of them, comma in any two things. And in the array, because the bottom line is named, this array is named after the choukirTola then the contents inside the array are written as below.


var choukirTola = ["tShirt", "jeans", "juta", "boi", "gamcha", "charger", "panjabi"];


In fact, all the things in the bottom of the stools are not seen together at the bottom of the pouch; Rather, one has to find out and check it out. Again, what's below your bottom floor. There may be other things from these things on the bottom of another's patrol. There may be a charger in it or it may not be there. But for the sake of this example, you can write down the choukirTola array, assuming what's in the bottom of your checkpoint.


Look at the first line of the algorithm written in English. There is "for every jinish in choukirTola" written there. That means, one thing out there from what's in the bottom of the checkpoint, from your choukirTola array. You already know the way to get one thing from one array to another. Just for loop will write the following:


for (var i = 0; i <choukirTola.length; i ++) {


}


"Get a jinish" is written in the English language of the algorithm in the second line. It's very easy to find one thing from an array. Just typed the name of the array and entered the third bracket i. Like the following:


for (var i = 0; i <chourkirTola.length; i ++) {


      var jinish = choukirTola [i];


}


Dos, half of the work is done. Now look at the third line of the English algorithm- "if jinish is a charger". That means checking whether jinish is the charger or not. To check if a thing is to be entered after the if. There will be no exceptions here too. So do not delay and write down in the mood of the puffery.


for (var i = 0; i <choukirTola.length; i ++) {


      var jinish = choukirTola [i];


      if (jinish == "charger") {


      }


}


And on the last line of the algorithm - "got charger and stop the search" is written. So after the if-- in the first line of the bracket write console.log ("charger paisi"). Write the next line; This break is to stop the loop. As the bus breaks, the bus stops. Similarly, when the loop break inside a loop, the loop stops.


for (var i = 0; i <choukirTola.length; i ++) {


      var jinish = choukirTola [i];


      if (jinish == "charger") {


           console.log ("charger paisi");


           break;


      }


}


Many times you want to know that there is an item in an array or in a position. It's very straightforward to find out. Just inside the console.log, I will write the charger paisi and write it. So that the value of i returns by output. Because the value of i is the thing, the value of the position that is in.


for (var i = 0; i <choukirTola.length; i ++) {


      var jinish = choukirTola [i];


      if (jinish == "charger") {


           console.log (i);


           break;


      }


}


However, in most programming languages, the name of array after the name of the array and indexOf gives the position of the first bracket that gives the name of the name. If that thing is in the array, then it will say that index or position. And if not, then say -1. For example, if there is a juta in choukirTola array, write to ask.


choukirTola.indexOf ("juta");


So give the return 2, because the shoes are in position 2 in the array. And if you are writing choukirTola.indexOf ("balish") then pubi-1 as output; Because there is no balish in your choukirTola array.


While programming, the for loop is used more than indexOf instead of searching. There are more search algorithms, see them at www.habluderadda.com/compos / search.


Do it yourself


8.1: Suppose your cousin Tamal escaped with his girlfriend. Father of Tamal's girl Chowdhury Saheb He gave ultimatum to the house of his khala with a huge gun shot, if he did not return the lonely boy to his cool girl in 24 hours, he would have killed him with a stroke. You got to know about the incident and find out his girlfriend and his girlfriend. Declare an array of locations by name of those places where you should go for it. Then write a search algorithm with the for loop. The algorithm that tells you whether there is a friend's friend in your locations called 'friendHouse'.


Answer:


8.2: What foods are available in the hotel at the restaurant, write in the vortas array. Then there is no position in the array (shutkiVorta), using that indexOf.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hello! Your post has been resteemed and upvoted by @ilovecoding because we love coding! Keep up good work! Consider upvoting this comment to support the @ilovecoding and increase your future rewards! ^_^ Steem On!

Reply !stop to disable the comment. Thanks!