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
soldier1979 [14.2K]
4 years ago
6

Which element would the search element be compared to first, if abinary search were used on the list above?

Computers and Technology
1 answer:
Natali [406]4 years ago
6 0

Answer:

35

Explanation:

Binary search is more efficient than linear search,time complexity of binary is 0(logn) where as linear's 0(n).In binary search we search from the middle of the array,whereas in linear we start with index 0 until the last.

4

35

44

98

List contains 4 elements, for finding the middle element we will divide by 2 .

4/2=2 so at the index 2 -35 is present ,we will start checking from 35.  

You might be interested in
In an advanced word processing program which type of image or graphic is available in a variety of formats and styles?
ira [324]
IS it coding?If not sorry
5 0
3 years ago
Read 2 more answers
The efficinecy for solving the towers of hanoi problem recursively
V125BC [204]

Answer:

B.O(2n)

Explanation:

The time complexity of solving towers of hanoi problem recursively is O(2n) because there are two recursion calls in the solution of tower of hanoi.First recursive call to move n-1 disks to from source to helper then the user moves nth disk from source to destination after that recursion moves n-1 disks from helper to destination using source as helper rod.So each recursive call make two more recursive call this makes the time complexity be O(2n).

8 0
4 years ago
Write a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters.
vichka [17]

Answer:

Explanation:

The python code for the question is attached in the image below.

The objective here is to write a code in python with a function called has_duplicates that takes a string parameter and returns True if the string has any repeated characters. Otherwise, it should return False.

SEE BELOW FOR THE CODE.

alphabet = "abcdefghijklmnopqrstuvwxyz"

test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]

test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]

def histogram(s):

   d = dict()

   for c in s:

       if c not in d:

           d[c]=1

       else:

           d[c] += 1

   return d

def has_duplicates():

   for string in test_dups:

       dictionary=histogram(string)

       duplicates=False

       for ch in dictionary.keys():

           if dictionary[ch] > 1:

               duplicates=True

               break

       if duplicates==True:

           print(string,"has duplicates")

       else:

           print(string,"has no duplicates")

def missing_letters(string):

   answer=""

   for ch in alphabet:

       if ch not in string:

           answer=answer+ch

   return answer

print("__________________________________________")

print(" Calling has_duplicates() function")

print("__________________________________________")

has_duplicates()

print("\n______________________________________________")

print("Calling missing_letters() function in for loop")

print("______________________________________________")

for i in test_miss:

   answer=missing_letters(i)

   if len(answer)>=1:

       print(i,"is missing letters",answer)

   else:

       print(i,"uses all the letters")

3 0
3 years ago
Write a program whose input is two integers. Output the first integer and subsequent increments of 10 as long as the value is le
Lubov Fominskaja [6]

Answer:

import java.util.Scanner;

public class TestClock {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter two integer numbers");

       int num1 = in.nextInt();

       int num2 = in.nextInt();

       int newSum=num1+10;

       System.out.println("The first number is "+num1);

       do{

          System.out.println(newSum);

          newSum +=10;

       }while (newSum <=num2);

   }

}

Explanation:

Using Java Programming language

  1. Prompt user for the two inputs and save them as num1 and num2(Using the scanner class)
  2. Create a new Variable newSum = num1+10
  3. Create a do...while loop to continually print the value of newSum, and increment it by 10 while it is less or equal to num2
3 0
3 years ago
In this exercise, you are agiven a phrase that may or may not contain the word “plate”. If the word does exist, replace all occu
Aloiza [94]

Answer:

Is in the provided screenshot!

Explanation:

Steps required to solve this problem

1) Take the input sentence and split it up into its separate words

2) Go through each word and see if it starts with the word plate.

- We need to check that it starts with plate and not if it equals plate so we can make sure that we keep any punctuation that is on the end of the word.

3) We also need to check if the word is not plates, so we can do that here.

4) If the word is plate, but not plate - then we can replace it with bowl

5) Now we just put our individual words back into a full sentence

7 0
3 years ago
Other questions:
  • A school librarian has been asked to identify inappropriate Internet usage. Which students would most likely be reported to the
    5·2 answers
  • ________ viruses are often transmitted by a flash drive left in a usb port.
    8·1 answer
  • Explain in your own words how you can use MSCONFIG and Task Manager to troubleshoot problems on the computer.
    15·1 answer
  • Diane wants to maintain a record of percent change in sales from the year 2000 to the present year. She enters the values of per
    10·1 answer
  • A(n) ______________________________ is a camera mount that uses the concept of a lever and fulcrum and allows a camera to be rai
    9·1 answer
  • _____emphasizes on proper breathing and the mind-body-spirit connections.​
    6·2 answers
  • Define the four basic operation of a computer ​
    6·1 answer
  • Give a recursive algorithm to compute the sum of the cubes of the first n positive integers. The input to the algorithm is a pos
    5·1 answer
  • 1. Haruto was a programmer working in the early 2000s. Which kind of program or language was
    5·1 answer
  • Create two functions to calculate the area and circumference of the circle using pointer.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!