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
Vadim26 [7]
3 years ago
6

Suppose that f is a function with a prototype like this: void f(________ head_ptr); // Precondition: head_ptr is a head pointer

for a linked list. // Postcondition: The function f has done some computation with // the linked list, but the list itself is unchanged. What is the best data type for head_ptr in this function?
Computers and Technology
1 answer:
AlekseyPX3 years ago
4 0

Answer:

node*

Explanation:

The argument 'head_ptr' is the head-pointer for the following linked list so the data type of the following argument 'head_ptr' is 'node*' in the method 'f()' because the following method 'f()' computed the linked list, but perhaps the list itself remains unaffected.

A linked list is the DS type in which that component would be a different entity. Such component of the following list is called as a node that consists of two elements

You might be interested in
Write Album's PrintSongsShorterThan() to print all the songs from the album shorter than the value of the parameter songDuration
lidiya [134]

Answer:

kindly check explainations for code

Explanation:

Check below for program code.

#include <iostream>

#include <string>

#include <vector>

using namespace std;

class Song

{

public:

void SetNameAndDuration(string songName, int songDuration)

{

name = songName;

duration = songDuration;

}

void PrintSong() const

{

cout << name << " - " << duration << endl;

}

string GetName() const { return name; }

int GetDuration() const { return duration; }

private:

string name;

int duration;

};

class Album

{

public:

void SetName(string albumName) { name = albumName; }

void InputSongs();

void PrintName() const { cout << name << endl; }

void PrintSongsShorterThan(int songDuration) const;

private:

string name;

vector<Song> albumSongs;

};

void Album::InputSongs()

{

Song currSong;

string currName;

int currDuration;

cin >> currName;

while (currName != "quit")

{

cin >> currDuration;

currSong.SetNameAndDuration(currName, currDuration);

albumSongs.push_back(currSong);

cin >> currName;

}

}

void Album::PrintSongsShorterThan(int songDuration) const

{

unsigned int i;

Song currSong;

cout << "Songs shorter than " << songDuration << " seconds:" << endl;

/* Your code goes here */

for(int i=0; i<albumSongs.size(); i++){

currSong = albumSongs.at(i);

if(currSong.GetDuration()<songDuration){

currSong.PrintSong();

}

}

}

int main()

{

Album musicAlbum;

string albumName;

getline(cin, albumName);

musicAlbum.SetName(albumName);

musicAlbum.InputSongs();

musicAlbum.PrintName();

musicAlbum.PrintSongsShorterThan(210);

return 0;

}

4 0
3 years ago
You notice that lately your computer has been running slow. When you open up your web browser, you get endless pop-up ads to the
Vlad [161]

Answer:

Spyware

Explanation:

The reason why you noticed your computer has been running slow is because of spyware, which is considered to be very bad to get on your computer. When a user opens his/her web browser, the user receives ads that are misleading to the user, which fools the user of thinking it's something real and not a scam. Not only that, the user also receives pop-up ads that can, as mentioned, trick the user to think that it's real and not fake. Finally, the user's search results will be manipulated. In conclusion, spyware is, in fact, the main cause of the scenario.

4 0
3 years ago
Consider the formula: G=D+(A+C^2)*E/(D+B)^3 Show the order that a processor would follow to calculate G. To do so, break down th
motikmotik

Answer:

1. G=D+(A+C^2)*E/(D+B)^3

cobegin:

p1: (D+B)

p2: p1^3

p3: C^2

p4: A+ p3

p5: E/p2

p6: p4 * p5

p7: D + p6

   :G

coend

2. Now The value A=2, B=4, C=5, D=6, and E=8

p1: 6+4 =10

p2: p1 ^3= 10^3= 1000

p3: c^2= 5^2 =25

p4: A + p3= 2 +25 =27

p5: 8/1000

p6: 27 *8/1000

p7: D+ P6= 6+ 216/1000

      = 6216/1000

      =6.216

Explanation:

The above, first bracket with power is processed, and then power inside and outside bracket. And rest is according to BODMAS, and one process is solved at a time.

4 0
3 years ago
Assume the existence of a class named window with functions named close and freeresources, both of which accept no parameters an
denis-greek [22]
In your question whereas there is a class named window and it would be like this:

class window {
//code here 
}

Next is there is a function called close and freeresource and it goes like this:

class window{
  function close( ){
   //code here
  }
  function freeresource( ){
  // code here
  }
 public destruct (){
this.close();
this.freeresource();
}

}
The last code function destruct invokes the function close and freeresource. Hope this would help 

7 0
3 years ago
software that instructs the computer how to run applications and controls the display/keyboard is known as the
OverLord2011 [107]
<span>Operating System is the software that gives the computer instructions on how to run applications. It is considered the most important program that runs on a computer because it manages all the hardware and software on it. It also controls the display/keyboard. </span>
4 0
3 years ago
Other questions:
  • true or false manual handling of materials accounts for the primary source of energy in the workplace
    13·2 answers
  • What languages other than English are spoken in the United States?
    14·1 answer
  • The series of events that make up a story is called
    6·2 answers
  • \What will the weather most likely be like the day after a warm front? (4 points) The temperature will be cool or cold, and ther
    7·2 answers
  • Which CSS attribute would change an element's font color to blue
    15·2 answers
  • What is your favourite video game??​
    5·2 answers
  • An aerophone is an instrument that causes ________ to vibrate, thus creating sound waves.
    11·2 answers
  • Why is it important to use random assignment when determining which research participants will comprise the different treatment
    12·1 answer
  • What method of thermal energy is at work when heat lamps are used to warm up baby chickens?
    11·2 answers
  • Can i have help for a ggogle class room
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!