This essay has been submitted by a student. This is not an example of the work written by professional essay writers.
City

city planner to get to Kensington

Pssst… we can write an original essay just for you.

Any subject. Any type of essay. We’ll even meet a 3-hour deadline.

GET YOUR PRICE

writers online

city planner to get to Kensington

For the city planner to get to Kensington, he will need to split the entire dataset into two main subclasses by first arranging the whole dataset in either ascending or descending order. The order of traversal will then need a comparison between the primary roots. If the answer exists in higher than nodes, the order of traversal is towards one root depending on the side of the pivot. Therefore, the city planner would.

Arranging the whole dataset in a sorted manner, we would:

Divide the set into two,

Taking the middle value as a pivot,

20.40, the new data would be -16, for lower than 20.40, and all other values for larger than… hence, we ignore the part not forming the partial answer.

Thus, the only town traversed is Northern Liberties.

Question #2

Starting with Norther Liberties as the pivot, the city planner will achieve two equal datasets then try to search by comparing it with each city. Therefore, the city planner would revisit all the cities first before returning the search does not exist.

Question #3

Linear search will always compare each constituent starting at the elements at location zero, assuming Bella Vista as the first element in the array list. We are likely to obtain the first elements in a faster iteration rather than the time taken to perform the binary search for the whole dataset. Therefore, entries such as Bella Vistas will execute faster than Western Mount Arry.

Don't use plagiarised sources.Get your custom essay just from $11/page

Hint: for each neighborhood in the listing, calculate the number of steps it would take to find it

using a linear search, then calculate the number of steps it would take to find it using binary

search.

Question #4

Hint: use your calculations from Question #3 to answer this question.

By using a linear search algorithm, the average number of comparison would be:

The total number of steps involved in locating the elements divided by the location of the element in the list. For the case of Bella Vista, the average comparison made will be 1 since the search method will execute faster by making one step. In the Binary search algorithm, the number of computational steps needed will be determined by the location of the search item from the pivot, either right or left, for sorted data. Therefore, when searching for Kensington, it is obvious that all the neighborhoods will first be compared with the pivot to achieve a sorted array then determine the item location either on the right or left of the pivot.

 

 

Question #5.

To obtain results in a binary search algorithm, it is essential first to sort the data if unsorted first, before implementing the search algorithm. However, sometimes it takes more time to arrive at specific answers.

If the list of the unsorted array is 15

Then, the number of computational steps would be:

To search for 10 elements in the worst case:

Then the number of steps involved will be:

{Log 210} log 2 10

To sort the elements

{15\log_2 15}Nlog215

To conduct a search for 10 elements in the sorted array after sorting then we obtain:

{Log 210} log 2 10

From the above computational steps, it is evident that binary search takes longer to execute for a given range of elements.

  Remember! This is just a sample.

Save time and get your custom paper from our expert writers

 Get started in just 3 minutes
 Sit back relax and leave the writing to us
 Sources and citations are provided
 100% Plagiarism free
error: Content is protected !!
×
Hi, my name is Jenn 👋

In case you can’t find a sample example, our professional writers are ready to help you with writing your own paper. All you need to do is fill out a short form and submit an order

Check Out the Form
Need Help?
Dont be shy to ask