Searching and Sorting Algorithms Flashcards
What is an algorithm?
An algorithm is a series of steps that leads to a solution/desired output
What are the characteristics of an algorithm?
The Characteristics of an algorithm are:
Output - The values produced as a result
Clarity - The clarity of the code and if the computer is able to understand it
Efficiency - If the code is efficient and works well. The code must be basic.
Input - Values entered by the coder/user that helps up get to our desired output
Finiteness - If the code stops after finding the desired output.
How many types of searching techniques are there and what are they?
There are two types of searching techniques:
Linear Search and Binary Search
What is another name of linear search?
Another name of linear search is sequential search
What is linear search?
Linear search is a simple algorithm. For linear search, we need a set of data and in that set of data a value to be found. This algorithm will search through each element of the data and will give you the value to be found as an output. The search stops after the desired output is found.
What are the advantages of linear search?
The advantages of linear search are that we can find our desired value in a set of data. Linear search is simple and basic,
What are the disadvantages of linear search?
The disadvantage of linear search is that in a set with a lot of data, it is hard to find the desired output. In a big set if the linear search is used it would consume a lot of time.
What is sorting?
Sorting is the process in which elements of the data are sorted into ascending/descending order or an order decided by the user.
What are the two types of sorting? Explain both of them.
The two types of sorting are:
Internal Sorting - In this sorting the primary memory is used to store the data
External sorting - In this sorting, there is usually a large amount of data. Because of this, secondary memory is used.
What is bubble sort? Explain
Bubble sort is a sorting algorithm in which two neighbouring elements are compared and are sorted into ascending/descending order. All elements of the set are sorted and once the set is in an ascending/descending order the new set is displayed as an output.
What are the steps of bubble sort called?
The steps of bubble sort are called passes.