Write a version of the sequential search algorithm that can be used to search a sorted list. Write a program to test the sequential search algorithm. Use either the function bubbleSort or insertionSort to sort the list before the search. Your program should prompt the user to enter 10 digits and then prompt the user to enter a digit to search - if the list contains this digit, output its position to the console:

Answers

Answer 1

Answer:

#include <iostream>

using namespace std;

void insertionSort(int myArr[]){

  int currentvalue, position;

  for (int i = 1; i < myArr.size(); ++i){

    currentvalue = myArr[i] ;

    position = i;

    while (position>0 and myArr[position-1]>currentvalue){

        myArr[position]= myArr[position-1] ;

        position = position-1 ;

     }

    myArr[position]= currentvalue;

  }

}

int main(){

   int numberList[10], search;

   for (int x = 0; x < 10; ++x){

       cin>> numberList[x];

   }

   insertionSort(numberList);

   cout << "Enter the search term/number: ";

   cin>> search;

   for (int i = 0; < 10; ++x){

       if (search == number[i]){

           cout<< i;

           break;

       } else {

           cout<< "Number does not exist.";

       }

}

}

Explanation:

The C++ source code defines the insertionSort void function, then prompts the user ten times to fill the array numberList. It uses the insertion sort algorithm to sort the array of ten items and then a number is searched using a sequential search algorithm.


Related Questions

What is the name of the tab that becomes available after you add and select an image in your PowerPoint presentation?
Home
Insert
Picture
View

ASAP PLS

Answers

Answer:

INSERT

Explanation:

INSERT PCIURE

A value chosen by the responder to identify a unique IKE SA is a _________.
A. Initiator SPI
B. Responder SPI
C. Flag
D. Message identifier

Answers

Answer:

Responder SPI

Explanation:

Responder SPI : Cookie of an individual referring to an application from the SA organization, a message from the SA, or a delete from the SA.

g Create a Java program that takes input of a list of integers from the user, stores them into an array and then finally uses the array contents to output the list of integers in reverse. The user's input begins with the number of integers to be stored in the array. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.Create a Java program Ex: If the input is: 8 5 2 3 4 10 6 8 9

Answers

Answer:

import java.util.Scanner;

public class Main{

public static void main(String[] args) {

int arraylent;

Scanner input = new Scanner(System.in);

System.out.print("Array Length: ");

 arraylent= input.nextInt();

int[] myarray = new int[arraylent];

for(int i = 0; i<arraylent;i++)

    myarray[i] = input.nextInt();

for(int i = arraylent-1; i>=0;i--)

System.out.println(myarray[i]);

}

}

Explanation:

This declares the length of the array

int arraylent;

This next two lines prompt and get the array length i.e. number of input

System.out.print("Array Length: ");

 arraylent= input.nextInt();

This declares the array as type integer. And the length of the array is gotten from the user input

int[] myarray = new int[arraylent];

This gets the items of the array

for(int i = 0; i<arraylent;i++)

    myarray[i] = input.nextInt();

This reverse and prints the array

for(int i = arraylent-1; i>=0;i--)

System.out.println(myarray[i]);

Jorge is sending a message to Thomas but would like a copy sent to his external email address as well. Jorge does not want Thomas to see this copy that was sent.

Which mail field will Jorge use to achieve this goal?

To:
From:
CC:
BCC:

Answers

Answer:  BCC (fourth choice)

=================================================

Explanation:

CC stands for "carbon copy".

BCC stands for "blind carbon copy".

Filling out forms is a tedious process. It's even more tedious when you have to repeat yourself multiple times. Carbon copy paper technology allows you to fill out one form and have those inputted entries be copied to the layers below. In terms of email, a carbon copy (CC) email is just an email sent to more than one person. In the CC line, recipients can see who the other people are in the email chain.

In contrast, a blind carbon copy is where the recipients cannot see who is in the BCC line. This allows Jorge to send the message copy to an external address without Thomas knowing.

Question 24 Multiple Choice Worth 5 points)
(01.04 MC)
Zavier needs to compress several files. Which file type will allow him to do this?
ODOC
GIF
OJPG
O ZIP

Answers

Answer:

ZIP

Explanation:

ZIP is a type of compression file as Jpg is a picture file, Gif is a picture file, and ODOC stands for Oklahoma Department of Corrections

TBH:

it may be O ZIP but i've never heard of it.

Answer:

Zip (D)

Explanation:

Took The Test

write a function named list_total that accepts a list as an argument (assume the list contains integers) and returns the cumulative total of the values in the list

Answers

Answer:

def listSum(mylist):

  sum =0

  for item in range(0,len(mylist)):

      sum=sum+mylist[item]

  print(sum)

Explanation:

Using the Python programming language, I defined a function as listSum that accepts a list as a parameter and returns the sum of the elements in the list.

The most important logic here is defining the range of elements in the list not to exceed the length of the list using the len function. Then using a for statement, we loop through each element and add them up to a sum variable initially assigned the value of 0.

Describe the general strategy behind deadlock prevention, and give an example of a practical deadlock prevention method.
Multi-programming (or multi-tasking) enables more than a single process to apparently execute simultaneously. How this can be achieved on a uni-processor?]

Answers

Answer:

In multi-programming, you use semaphore constructs to protect shared resources. Your program thread or process will block if you want to claim a semaphore when another thread or process has it claimed.

Generally you need to keep the code scope of the claimed semaphore (a.k.a. the critical section) as small as possible, and also, prevent claiming another semaphore within a given critical section.

Given all of the limitations of MBR, is it still relevant in current day use?

Answers

Explanation:

MBR does have its limitations. For starters, MBR only works with disks up to 2 TB in size. MBR also only supports up to four primary partitions—if you want more, you have to make one of your primary partitions an “extended partition” and create logical partitions inside it.

Display filters and capture filters can be interchanged because they use the same syntax. A. True B. False

Answers

Answer:

Very True

Explanation:

Course Aggregation Many times, departments are only interested with how students have done in courses relative to a specific major when considering applicants for admission purposes.
For this problem you are given a dictionary where the keys are strings representing student ids and the values are dictionaries where the keys represent a course code and the value represents a grade. Your task is to write a function that given a dictionary of the described format and a prefix for course codes, return a dictionary where each key is a student id and the corresponding value is the average grade of the student only in courses that start with the given prefix.
def course_grader (student_to_grades, course_prefix): ({str, {str, float}}) -> {str, float} I: a dictionary containing the grades of students (as described above) and a course code prefix P: compute and store the average grade of all students only for courses that start with the given course prefix 0: a dictionary of student ids to average grades as described in the Processing step pass

Answers

Answer:

def course_grader(student_to_grades, course_prefix):

   student_grades = dict()

   for key, value in student_to_grades.items():

       grade_score = 0

       for course,grade in value.items():  

           if course_prefix == course:  

               grade_score += grade

                student_grades[key] = grade_score / len(value.keys())

   return student_grades

Explanation:

The course_grader function is a python program that accepts two arguments, the student dictionary and the course prefix. The function returns a dictionary of the student id as the key and the average grade of the student as the value.

Explain to Alana why she might not want to blast her boss on social media just yet.

Answers

Answer: She might get fired. And who knows, if she doesn't, she might get a raise!

If I want to control the aperture and I want the camera to control the shutter speed which setting on the mode dial is most appropriate?
a)AV
b) TV
c) M
d) P
since this is my last question im giving 100 points and brainliest

Answers

Answer:

answer is a

hopes this helps

Why do people want phones so bad??

Answers

To help explain this, take a look at these reasons why kids should have cell phones:

#1 To keep in touch. What happens if you're running late picking your child up from school? ...

#2 To talk to friends. ...

#3 To stay safe. ...

#4 To develop essential skills. ...

#8 To improve their organization. ...

#11 To encourage responsibility.

Because we live in a world full of technology and we use it for almost everything. They made life easier in some ways

You manage a Windows server that has an attached printer that is used by the Sales department. The sales manager has asked you to restrict access to the printer as follows:Sally needs to connect to a printer, print documents, and pause and resume her own print jobs.Damien needs to pause and resume documents for all users, but does not need to change printer properties.You want to assign the most restrictive permissions that meet the sales manager's requirements. What should you do

Answers

Answer:

Damien would be assign the Manage Documents permission while Sally on the other hand will be assign the permission to print.

Explanation:

Based on the information given in order for me to assign a restrictive permission that will meet the requirements of the sale manager's what I will do is for me to assign the Manage Documents permission to Damien reason been that Damien only needs to stop and resume the documents for all users in which he does not need to change the printer properties and to assign the permission to print to Sally reason been that Sally only needs to connect to a printer and to print documents in which she will then stop and resume her own print jobs.

You need to update your router settings, so you log into the administration panel, Whose Internet protocol (IP) address is 192.168.0.1. which IP version is this?

A-IPv4
B-IPv2
C-IPv6
D-IPv1

Answers

Answer:

D

Explanation:

It is said that Wifi repeater is not good as a rumor

Answers

True your welcome bue

For an interview, the most used microphone types are

A. Boom mics, long range mics
B. Strap, studio recording mics
C. Lapel or handheld
D.No mics are needed

Answers

The answer is A; hope this helps you

Benjamin took a photo that focused on certain part of an image while blurring out the rest. What is this effect called?
A.
alternate focus
B.
major focus
C.
minor focus
D.
selective focus

Answers

Answer:

(D) selective focus

Explanation: hope this helps!

Answer:

D. Selective Focus

Explanation:

Photographers commonly use the tilt-shift effect to focus on a certain part of the image while blurring the rest of the photograph. They refer to this as selective focus.

Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, he discovers an arcade store that pays real cash for every game that the player wins - however, the store will only pay out once per game. The store has some games for which they will pay winners, and each game has its own completion time and payout rate. Thrilled at the prospect of earning money for his talent, Adam walked into the store only to realize that the store closes in 2 hours (exactly 120 minutes). Knowing that he cannot play all the games in that time, he decides to pick the games that maximize his earnings
Sample game board at the arcade GAME COMPLETION TIME (in minutes) PAYOUT RATE Pac-man 90 400 Mortal Kombat 10 30 Super Tetris 25 100 Pump it Up 10 40 Street Fighter II 90 450 Speed Racer 10 40
An acceptable solution is the one where it still picks the best earnings even when the list of games or completion times or payout rates change.
Question:
Write code in Java/Scala/Python to help Adam pick the sequence(s) of games that earn him the most money?.
Then, assume you have a variable list of games and their payout rates. What is the best way to pick the games that earn you the most?
Input Explanation
The first line of input is always an integer denoting many lines to read after the first line. In our sample test case, we have 6 in the first line and 6 lines after the first line, each having a game, completion_time and payout_rate.
In each data line, the game, completion_time and payout_rate are separated by a ','(comma).
The games board may change but the store still closes in 120 minutes.
Input
6
Pac-man,80,400
Mortal Kombat,10,30
Super Tetris,25,100
Pump it Up,10,40
Street Fighter II,90,450
Speed Racer,10,40
Output Explanation
Print the game names that earn him the most into the standard output in alphabetical order
Output
Mortal Kombat
Pump it Up
Speed Racer
Street Fighter II

Answers

Answer:

ask it to ur teacher boiiiiii

Suppose a switch is built using a computer work station and that it can forward packets at a rate of 500,000 packets per second, regardless (within limits) of size. Assume the workstation uses direct memory access (DMA) to move data in and out of its main memory, which has a bandwidth of 2 Gbps, and that the I/O bus has a bandwidth of 1 Gbps. At what packet size would the bus bandwidth become the limiting factor

Answers

Answer:

When the transmission exceeds 667 packets

Explanation:

In computer networking, a packet is a chunk of data transmitted across the network. The packet size of an Ethernet network is 1.5kilobytes, while the packet size of an IP packet payload is 64 kilobytes.

A switch is a physical network device that connects nodes or workstations while communicating the packets (or frames). The I/O bus size bandwidth is 1Gbps which allows approximately 667 packets. Once this packet size is crossed, the bus becomes a limiting factor or bottle neck.

Is it important to study information systems

Answers

Answer:

There is massive importance if you want to study information study.

It can help you understand the data, organize, and process the data, using which we can generate and share information.

Explanation:

It largely depends on your interest and requirement, but a better knowledge or clue about information systems may help analyze the data especially if you want to become a data scientist, machine learning, Artificial intelligence or deep learning, etc.

It can help you understand the data, organize, and process the data, using which we can generate and share information.

A great understanding of information systems may exponentially increase the productivity, growth, performance, and profit of the company.

Most Professions get exposed to information Systems no matter what their career objective is, as it may help in having better decision making based on the information they get through data.

So, yes!

There is a massive importance if you want to study information study.

As you draw a star, pressing the shift key while you drag increases the number of points on the star. True or false

Answers

Answer:

true

Explanation:

What is the thickness of a character’s outline called

Answers

Answer:

actually is answer is font weight

hope it helped!

If you are working on doing senior portraits and want a lens that will give you the best shallow depth of field which lens would you choose?
a) 55mm f1.2 (focal length of 55mm, maximum aperture of 1.2)
b) 28-80mm f4.5 (Zoom lens with focal length from 28-80mm, max aperture 4.5)
c) 18mm f5.6
d) 50mm f1.4
45 points and brainliest

Answers

Answer: The answer is C     Hope this helps :)    Please mark Brainliest

Explanation:

Answer:

c) 18mm f5.6

Explanation:

For the best lens that offers the best shallow depth of field, you need to choose the one with the maximum apertature but does not zoom.

Hence choice c) has the maximum aperture and does not zoom.

Hope this helps :)

What does Stand for in web design

Answers

Answer:

g

Explanation:

h

Analyze the needs of the National Security team and help them articulate its problems, develop solutions to meet its needs, and deliver a recommendation that is aligned with the extant national objectives.

Answers

Answer:

Following are the solution to this question:

Explanation:

The Council's role has been to assist and support the President regarding national security and foreign policies ever since its inception under Truman. This Committee often acts as the primary arm of a President to organize these initiatives between government agencies.

The Leader holds sway over the NSC. Its Secretary Of Defense offers a range of options for the Administration on policy issues. The director of national intelligence helps prepare the administration's foreign travel, among other tasks, and offers context memos and staffing for the administration's discussions and phone interviews involving global leaders.

Safety investments were taken for many years utilizing threat cost-benefit analysis wherein the effect metric has been largely focused on even a risk reduction comparative estimate. To evaluate investment decisions, most aim to conduct similar analyses.

Even so, the potential threat is much harder to measure for high-security installations that potential hazard since the likelihood of an attack is highly uncertain and depends strongly on undefinable psychological factors like deterrence as well as the intensity of enemy goals.

The material inspection and recieving report the multi-purpose document that serves as evidence of inspection and acceptance, shipping document, receiving document, and contractor invoice is designated as the:________.

Answers

Answer:

DD Form 250

Explanation:

DD Form 250 which is an acronym for Department of Defense Form 250.

It is the Material Inspection and Receiving Report that is used for contracts supplies and services including acquiring noncommercial commodities such as:

1. Acknowledgment of equipment by the Government

2. Contractor's invoice for expense.

3. loading record for hauling and acquiring.

4. Proof of Government Quality assessment.

Hence, in this case, the correct answer is DD Form 250.

Janet needs to flag a message for follow-up in Outlook. Which option is not a default?

Today
Tomorrow
Next Week
Next Tuesday

Answers

Answer:

Explanation:

Today

Answer:

Next tuesday.

Explanation: Its to specific

what stage is the most inner part of the web architecture where data such as, customer names, address, account numbers, and credit card info is the store?

Answers

Never store the card-validation code or value (three- or four-digit number printed on the front or back of a payment card used to validate card-not-present transactions). Never store the personal identification number (PIN) or PIN Block. Be sure to mask PAN whenever it is displayed.

How can you get access to help? Check all that apply

Answers

Answer:

The answer is "F1"

Explanation:

Please find the complete question in the attachment file.

The F1 key is also known as the function key, which can be used to configure on a device or console key to cause such actions, a form of a soft button, to also be performed by a web browser control parser or software application. The main purpose of the F! key is to open the Help screen for all programs.

Other Questions
Zeitoun saw himself as someone trying to help after the storm. How do the police officers see him? as a hotheaded young man who was looting houses as an agitated civilian who has lost all of his worldly possessions as a terrorist threat who does not deserve the rights of a citizen as an individual who was in the way of relief agencies Anu upsarg se do shabd banaaiye Find the slope of the line that would pass through the ordered pairs below.(-7, 9) and (14, -18) What be 10 different Greek artifacts involving S.P.R.I.T.E, Social, Political, Religious, Intellectual, Technological, and Economic. At an intersection, the red light of route A is red for 60 seconds and the other two lights are red for 45 and 75 seconds, respectively. What is the probability that a car traveling from route A will encounter a red light at an intersection? **PLEASE HELP FAST**What was the most important historical effect of the astrolabe? A. It enabled sailors to find their latitude. B. It may have originated in Africa. C. It made possible long voyages beyond sight of land. D. It spread from Africa or the Middle East to Europe. 14:56 in simplest form? An axe used to split wood is driven into a piece of wood for an input distance of 0.05m. If the mechanicaladvantage of the axe is 0.85, how far apart (output distance) is the wood split? The first amendment also allows citizens the freedom to practice any religion of their choice, but also prevents the government from officially recognizing or favoring any religion. This action is known as? g(x) = x^2 + 55 What is the minimum value of the given function? which is an example of a physical change?a.ice meltingb.iron rusting c.wood burning d.garbage rotting Why postharvest physiology is important to maintain sustainable food supply on this planet. Please give named examples and discuss various biological factors associated with produce deterioration after harvest The transition from a hunter-gatherer lifestyle to a sedentary one For a scene in a movie, a stunt driver drives a 1700 kg pickup truck with a length of 4.45 m around a circular curve with a radius 0f 0.355 km. The truck is to complete a semicircle, jump across a gully, and land on the other side 3.00 m below and 10.5 m away. What is the minimum centripetal acceleration the truck must have going around the circular curve so that the entire truck will clear the gully and land on the other side What question can you never answer yes to? HAPPY EARLY CHRISTMAS !!! hope yall asked for something good and ur gonna get it! FREE 50 POINTS! IM vERY NIcE Laws of motion Laws of motion Hitler effectively used "group mind" by__________ What gets wetter and wetter the more it dries? Help Pleasee, Thank You!