Question

Desribe the difference between a linear and binary search. Describe how the selection sort algorithm, the...

Desribe the difference between a linear and binary search.

Describe how the selection sort algorithm, the bubble sort algorithm, and the insertion sort algorithm are different. In other words, briefly explain how they sort data

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Linear search search through the file sequentially while binary search search through file by jumping to the required part by pruning search area to half. Catch here is linear search is applicable to all kind of arrays while binary search can only be applied to a sorted array.

Selection sort: Sorts data by bringing in minimum of remaining array to front and then repeating this process.

Insertion sort: Sorts data by placing current element in order in already sorted part of the array.

Bubble sort: Sorts data by bubbling up smaller data keeping invariant of sorted data at start.

Add a comment
Know the answer?
Add Answer to:
Desribe the difference between a linear and binary search. Describe how the selection sort algorithm, the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Course: CIS-5, Intro to Programming 1. Which algorithm is also called the sequential search? binary search...

    Course: CIS-5, Intro to Programming 1. Which algorithm is also called the sequential search? binary search linear search bubble sort selective sort 2 Which search algorithm requires that the elements be pre-sorted? linear search bubble sort binary search We were unable to transcribe this image

  • ***PLEASE USE C++ LANGUAGE*** Binary Search of Strings 1. Write a version of the selection sort...

    ***PLEASE USE C++ LANGUAGE*** Binary Search of Strings 1. Write a version of the selection sort algorithm presented in the unit, which is used to search a list of strings. 2. Write a version of the binary search algorithm presented in the unit, which is used to search a list of strings. (Use the selection sort that you designed above to sort the list of strings.) 3. Create a test program that primes the list with a set of strings,...

  • List the worst case and average case Big O for each algorithm below and describe how...

    List the worst case and average case Big O for each algorithm below and describe how the algorithm works. You can diagram or write a short paragraph. Bubble Sort Modified Bubble Sort Insertion Sort Merge Sort Selection Sort Shell Heap Quick

  • Write an insertion sort algorithm that uses Binary search to find the position where the next...

    Write an insertion sort algorithm that uses Binary search to find the position where the next insertion should take place. Show your work using a programing language such as Java and add your screenshots of the output. show the steps please

  • With the following code answer the following questions. describe what happens when the following code is...

    With the following code answer the following questions. describe what happens when the following code is executed: String[] searchMe = {"apple","bear","cat","dog","elephant"}; describe what is being created when this statement executes System.out.println(linearFind("cat",searchMe)); describe the values passed to the method describe how each of the specific values are compared to each other describe when the method stops executing and/or when the loop stops executing describe what is returned to beoutprinted System.out.println(binaryFind("apple",searchMe)); describe the values passed to the method describe how each of...

  • 1. Compare and contrast: SORTING -a bubble sort through an array -a selection sort through an...

    1. Compare and contrast: SORTING -a bubble sort through an array -a selection sort through an array Explain how each works and what the advantages and disadvantages are. Note the efficiency of each. 2. Compare and contrast: SEARCHING -a sequential search through a file -a sequential search through an array -a binary search through an array Explain how each works and what the advantages and disadvantages are. Note the efficiency of each.

  • . Shell sort is a sorting algorithm similar to insertion sort. Research shell sort and apply...

    . Shell sort is a sorting algorithm similar to insertion sort. Research shell sort and apply that to the following array. Show your work in Detail. [15 points] 45 20 50 10 80 30 60 70 40 90 2. Is Shell sort a stable sorting algorithm? Answer this with an example. [10 points] 3. Apply Merge Sort to sort the following list. Show your work in Detail. [15 Points] 45 20 50 10 80 30 60 70 40 90 4....

  • 4. i) Give the difference between binary trees and Binary search trees. Insert the values 50,...

    4. i) Give the difference between binary trees and Binary search trees. Insert the values 50, 76, 21, 4, 32, 64, 15, 52, 14, 100, 2, 3, 70, 87, 80 in the BST [Show the steps]. Write the algorithm for all the 3 operations of BST ii) Insert the given items 16, 14, 10, 8, 7, 9, 3, 2, 4, l into the Min- Heap. [Show the steps]. Write the pseudocode for Insertion of items using the Min- Heap

  • Database a) Roughly describe how a binary search works. You don’t need to give pseudocode or an e...

    Database a) Roughly describe how a binary search works. You don’t need to give pseudocode or an exact algorithm, but explain the principle or point of how it works. b) In a binary search, does the number of operations required grow roughly exponentially or logarithmically with the number of items to be searched?        c) Can a binary search be done on a “heap” file? Explain why or why not. d) Explain why hashing can (usually) provide very fast lookups (retrieval)...

  • Write a program in Java that obtains the execution time of selection sort, insertion sort, bubble...

    Write a program in Java that obtains the execution time of selection sort, insertion sort, bubble sort, merge sort, quick sort, and radix sort. Your program should test all sort methods for input sizes of 10000, 20000, 30000, 40000, 50000, and 60000. The selection sort, bubble sort, and radix sort should also be tested for input sizes 100000 and 200000. Your program should create the data that is sorted from randomly generated integers and should output the results in a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT