1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Svetlanka [38]
4 years ago
7

Implement the function def findChange(lst01). This function is given lst01, a list of integers containing a sequence of 0s follo

wed by a sequence of 1s. When called, it returns the index of the first 1 in lst01. For example, if lst01 is a list containing [0, 0, 0, 0, 0, 1, 1, 1], calling findChange(lst01) will return 5. Note: Pay attention to the running time of your function. If lst01 is a list of size �, an efficient implementation would run in logarithmic time (that is Θ(���'(�))).

Computers and Technology
1 answer:
Mashcka [7]4 years ago
7 0

<u>Solution and Explanation:</u>

The following is the function which will implement the required change as asked in the question.

def findChange(lst01):

left = 0

right = len(lst)-1

while (left <= right):

   middle = (left + right)// 2

   if (lst01[middle] == 1 and (middle == 0 or lst01[middle - 1] == 0)):

     return middle

   elif (lst01[middle] == 1):

     right = middle - 1

   else:  

     left = middle + 1

return -1;

lst = [0, 0, 0, 0, 0, 1,1]  

print(findChange(lst))

Please see the attched file.

You might be interested in
Both the original location and destination must be visible in file explorer when you
Xelga [282]

When you drag-and-drop files

Dragging and dropping files between two open windows is a quick way to transfer files and folders. If the file or folder and both the original and destination location where you want to transfer it are visible, you can simply drag the item/items from one location to the other. Dragging is unlike moving a file of folder. Dragging from one disk to another copies the file/folder so that it appears in the two locations.

5 0
3 years ago
2. (8 points) When creating the Academic Database, there were several instances of data
Bad White [126]

Answer:

See explaination

Explanation:

An Academic Database deals with the information pertaining to the records of students of an institute. The various fields which can be associated with a student are Name, Unique Identification Number, Marks in various subjects, Grades, Courses Taken and so on. Most of the fields mentioned above have some or other form of validation that is required for the DB to be consistent and follow the basic properties of a database.

One field where range validation can be used is MARKS. In the marks field, the range of marks will be say 0 to 100 and anything below 0 or above 100 must be reported to the database administrator. Another field where we can apply a range validation is AGE in which the range of age allowed could greater than say 10, if it is a college and maximum age could be say 60. Thus, the range check on the AGE field is 10 to 60.

One field where choice validation can be used is GENDER. In the gender field, there could be multiple choices like Male, Female and Others. Thus, out of the available choices we have to select only the available choice and only one choice must be selected where we can apply choice validation. Another field is COURSE, where we can have a list of courses a student can opt for and out of the available courses can select one.

Thus, there are multiple fields where we can apply various types of validation and it is important to explore the area for which the DB has been created understanding all the scenarios and attributes of the problems that are associated with that area.

8 0
4 years ago
Need answer quick plz.
morpeh [17]

Answer:

SPSS

IS THE ANSWER

IHOPEIT WILL HELP YOU

4 0
3 years ago
Write an algorithm to sum to values
Elis [28]

Answer:

There is no need to make an algorithm for this simple problem. Just add the two numbers by storing in two different variables as follows:

Let a,b be two numbers.

c=a+b;

print(c);

But, if you want to find the sum of more numbers, you can use any loop like for, while or do-while as follows:

Let a be the variable where the input numbers are stored.

while(f==1)

{

printf(“Enter number”);

scanf(“Take number into the variable a”);

sum=sum+a;

printf(“Do you want to enter more numbers? 1 for yes, 0 for no”);

scanf(“Take the input into the variable f”);

}

print(Sum)

Explanation:

hi there answer is given mar me as brainliest

5 0
3 years ago
Join Viber Creations on Viber https://invite.viber.com/?g2=AQAboWGw5hKZN009gOjCULc4cbWKWg42%2BIFmJoPC93MPlt9kstcpJyU6yagPh050 |
Dovator [93]
Hmmmm
I have to say the step mom in Cinderella
7 0
3 years ago
Other questions:
  • During the Requirements Definition stage of a systems development​ project, the employees who will be the primary users of the n
    15·1 answer
  • Which name is given to a set of communications standards for simultaneous digital transmission of voice, video, data, and other
    6·1 answer
  • The picture that graphically represents the items you use in Windows is called a/an
    15·1 answer
  • Please check my answer! (Java)
    8·1 answer
  • The commands available from a menu change depending upon what you are doing.<br> True<br> False
    11·2 answers
  • Consider an unpipelined or single-stage processor design like the one discussed in slide 6 of lecture 17. At the start of a cycl
    10·1 answer
  • Moore’s law states that the number of transistors on integrated circuits doubles approximately every two years?
    15·2 answers
  • Discuss your favorite video games and why you like them. What types of features make a game fun to play? Why are they features e
    11·2 answers
  • ANSWER ASAP!!!!!!
    12·2 answers
  • A computer professional's job involves analyzing computer systems for
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!