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
pychu [463]
3 years ago
8

Given a vector and a starting position, find the index of // the smallest value in the range [start, last], where last is // vec

tor.size()-1. That index is returned.
Computers and Technology
1 answer:
marusya05 [52]3 years ago
7 0

Answer:

The solution code is written in Python

  1. def findSmallest(vec, start):
  2.    index = start
  3.    smallest = vec[start]
  4.    for i in range(start + 1, len(vec)):
  5.        if(smallest > vec[i]):
  6.            smallest = vec[i]
  7.            index = i
  8.    return index

Explanation:

Firstly we can define a function findSmallest() that takes two input parameters, a vector, <em>vec</em>, and a starting position, <em>start </em> (Line 1).

Next, create two variables, <em>index</em> and <em>smallest</em>, to hold the current index and current value where the smallest number is found in the vector. Let's initialize them with <em>start</em> position and the value held in the<em> start </em>position (Line 3-4).

Next, create a for-loop to traverse through the next value of the vector after start position and compare it with current <em>smallest </em>number. If current <em>smallest</em> is bigger than any next value in the vector, the <em>smallest </em>variable will be updated with the new found  lower value in the vector and the index where the lower value is found will be assigned to variable<em> index</em>.

At the end return index as output.

You might be interested in
Design the logic for a program that allows a usher to continuously enter numbers until the usher enters 0. Display the sum of th
uysha [10]

int sum = 0, n;

do {cin>>n; sum+=n;}while (n!=0);

cout<<sum;

5 0
3 years ago
When using the Internet, do not give out your __________ without your parents' permission. (Select all that apply.)
Dafna1 [17]

Answer:

IP address

Explanation:

if you do give out your IP address people can find you so you need to ask your parents to give out your IP address

8 0
2 years ago
Functions of barriers include (mark all that apply): A. Define boundaries B. Design layout C. Deny access D. Delay access
gayaneshka [121]

Answer:

A. Define boundaries

C. Deny access

D. Delay access

Explanation:

A barrier is a material or structure used to prevent or block access. Barriers can either be natural or structural and are used for many purposes usually for security reasons. The following are functions of barriers either natural or structural:

  1. Define areas of boundaries
  2. Delay or slow access. Example is the use of speed bumps to slow down vehicles.
  3. Provide access to entrances such as the use of gates
  4. Deny access to unauthorized personnel and allowing authorized personnel.
4 0
3 years ago
10 points!
melisa1 [442]

Advantages;            

Firstly, the internet can let a person to communicate with people in virtually any parts of the world through the internet or e-mail, without having to leave his room. E-mail allowed peoples to communicate with minimum of times. It is now possibles to send a message to any parts of the world through a simple e-mail address and the message is delivered in matter of seconds. Every companies is using e-mail in business. The convenience of e-mail has allowed businesses to expand and communicates with their vendors and customers located all over the world in records times. Personal communication has also become more easier thanks to e-mail. Chat rooms, video conferencing are some of the latest additions in this technology and these have allowed peoples to chat in real time. Besides, there are a lot of messengers services in offering. With the help of such services, it has become very easy to establish a kind of global friendship where you can share your thoughts and explore other cultures. The internet also allows people within an organization to easily communicate and share informations.

Second, information is probably the biggest advantages that internet offers. Internet is a virtual treasures trove of information. Any kinds of information on any topic under the sun is available on the internet. The search engines like Google, Yahoo are at your service through the internet. There is a huge amount of information available on the internet for just about every subjects known to man, ranging from government law and services, trade fairs and conferences, market information, new ideas and technical support, the lists is simply endless. We can uses these search engines, websites dedicated to different subjects and large amount of articles and papers are available for perusal in a matter of a few seconds.

Forums on a number of sites allow peoples to discuss and share their thoughts and informations with others located at different places all over the world. Whether this information is the latest news happenings in the world or information about your favourite celebrity, everything is available at your finger tips. A huge cache of data is available on the internet on every single subjects. With this storehouse of information people can not only increases their knowledge bank but can do so without wasting their time through traditional means such as visiting libraries and conducting exhaustive research. With internet, students can save their times to search for information and using their time to do other works.

This is particularly relevant for students who can use this wealth of information for their school projects and also learn new things about the subjects they are interested in. In fact this internet is for many schools and universities that are now able to assigns projects and work to the students and follows their progress which can be easily posted on the school or university internal websites. Online education has grown at a very fast pace since internet allow the development and uses of innovative tools for imparting education. University students and lecturers can communicate through internet. Besides, some universities are also offerings far distances courses to make study become more inefficient and convenience. Internet become a gateway for those who wants to learn but cannot afford the living fees at foreign countries.

Thirdly, entertainments is another popular reasons why many people prefer to surf the internet. In fact, the internet has becomes quite successful in trapping the multifaceted entertainment industry. Downloading games or just surfing the celebrity websites are some of the uses people have discovered. Even celebrities are using the internet effectively for promotional campaigns. Besides that, there are numerous games that can be downloaded for free. The industry of online gaming has tasted dramatic and phenomenal attentions by game lovers. The internet has also revolutionized the entertainments industry. People nowadays no need to go to a cinema hall to watch your favourite movie. Instead of watching movies at cinema now have companies offering their services where you just can downloads or order your favourite movie and watch it with a fast internet connection. Besides that, you also can download other important software or your favourite music in a matter of few minutes. There are a number of shareware programs that allow you to share and download your favourite music and videos. The internet also allows people from different cultures and background to connect with each other. Internet gaming is a huge business and allow enthusiastic gamers to compete against each other in games even when they are located far apart. Likewise dating has also allowed people to find their prospective soul mates.

4 0
2 years ago
PLEASE HELP what is the mechanical advantage of a wheel with a radius of 8.0 cm connected with a axle with a radius of 2.5 cm?
Paraphin [41]
3.2 i believe. I looked it up though
5 0
3 years ago
Read 2 more answers
Other questions:
  • Design a 4-bit register that can accept an input from the user and store the accepted input. The 4-bit register will operate in
    6·1 answer
  • A four-year old laptop will not boot and presents error messages on screen. You have verified with the laptop technical support
    11·1 answer
  • A url consists of a ____, a domain name, sometimes the path to a specific web page or location in a web page, and the web page n
    11·1 answer
  • WHEN COPYING EXISTING SPREADSHEET DATA TO A WORD DOCUMENT YOU NEED TO SELECT?
    12·1 answer
  • What command do you type in the search box to access the command line intrface in windows?
    8·1 answer
  • Write a method called makeLine. The method receives an int parameter that is guaranteed not to be negative and a character. The
    11·1 answer
  • Pressing the e key while in edit mode will exit the interaction mode<br><br> true<br><br> false
    7·1 answer
  • Your employer is opening a new location, and the IT director has assigned you the task of calculating the subnet numbers for the
    14·1 answer
  • Which native windows application allows you to access basic pc settings and controls such as system information, controlling use
    7·1 answer
  • Which instruction is used to convert an integer value to float and push it onto the fpu stack?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!