Draw a flowchart and write up some pseudocode

Assignment Help Python Programming
Reference no: EM133059352

Learning Activity: Flowchart and Pseudocode exercise - binary search

In one of the essential resources, we asked you to draw a flowchart and write up some pseudocode for searching for a particular element in an arbitrary list. Now we will look at a more sophisticated algorithm and ask you to draw a flowchart and pseudocode for it.

Suppose again you have a list of n elements a_list and a target value key. You would like to find out whether key is contained in the a_list. In this learning activity, however, the list a_list is sorted in an increasing order, that means a_list[0] <= a_list[1] <= a_list[2] .... Do you want to amend the flowchart and pseudocode you did earlier so that you can use as less comparison as possible to ascertain whether the target value key is contained in a_list.

If you know that all the elements in a_list are sorted increasingly, it would not be wise to compare each element in a_list with key and to see whether they would match or not. You would instead first compare the element right in the middle of a_list. If that element is larger than key, then you do not need to compare any elements on the right-hand side of the middle element in a_list because all of them will be larger than key. On the contrary, if that middle element is smaller than key, then you do not need to compare the left half. This process is repeated until you find key in a_list, or you exhausted all the elements in a_list. This idea is illustrated in the figure below.

357_binary search.jpg

Now draw a flowchart and write up pseudocode for this algorithm and post them on Module 2.2 Flowchart and Pseudocode discussion forum.

Reference no: EM133059352

Questions Cloud

Write a python program that computes the summation : Find a particular number in a random list - Implement a linear search algorithm, but this time, if you find the number in the list, return the index
What are the possible consequences : Question - Read the Ethical Issue case about Becky Knauer and her position with Mueller Imports. What are the possible consequences
Programming Exercise - Fibonacci series : Programming Exercise - Fibonacci series - write a Python program that allows the user to type in an integer n. Your program will then output the first n terms
Write a python program that outputs all the even numbers : Write a Python program that outputs all the even numbers from 2 to a number (inclusive) provided by the user, separated by comma
Draw a flowchart and write up some pseudocode : Draw a flowchart and write up some pseudocode for searching for a particular element in an arbitrary list.
Write a simple income tax calculator in Python : Write a simple income tax calculator in Python. Australia adopts a progressive income tax regime
Programming exercise - facilitators favourite number : Write a Python program that allows the user to type in a three-digit number. If the number is your learning facilitators favourite number, then output Yes
Programming exercise - odd or even number : Programming exercise - Write a Python program that determines whether a user's input number is an odd or even number.
Draw flowchart diagram for searching for particular element : Draw a flowchart diagram for searching for a particular element in a list and write out the pseudocode for that algorithm

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd