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
Otrada [13]
3 years ago
14

Whats an effective way to sort linked lists in cpp.

Computers and Technology
1 answer:
irina [24]3 years ago
6 0

Answer:

Using Merge Sort.

Explanation:

Merge Sort is preferred for sorting the linked list because the the data stored in linked list is not in serial memory address which makes the quick sort algorithm very slow and other sorting algorithms impossible.

Merge Sort is a divide and conquer algorithm.

In this algorithms we divide the linked list into sub parts and sort the sub parts of the linked list and then we merge them in sorted order. It is a very effective approach for linked list sorting.

The time complexity of merge sort is O(NLogN).

You might be interested in
A Function checkMe takes three parameters, a character and two integers. If the sum of the two integers is negative, and the cha
Paul [167]

Answer:

Check the explanation

Explanation:

Here is the program with function definition and two sample calls.

Code:

#include <iostream>

using namespace std;

//checkMe FUNCTION which takes values a, b and c

void checkMe(char &a, int &b, int &c)

{

//if sum of b and c is negative and a is 'n', b and c are set to 0, otherwise a is set to 'p'

if((b+c)<0 && a=='n')

{

b = 0;

c = 0;

}

else

{

a = 'p';

}

}

int main()

{

//first test case when else part is executed

char a = 'n';

int b = 5;

int c = 6;

 

checkMe(a, b, c);

 

cout<<a<<" "<<b<<" "<<c<<endl;

 

//second test case when if part is executed

a = 'n';

b = -4;

c = -5;

 

checkMe(a, b, c);

 

cout<<a<<" "<<b<<" "<<c<<endl;

return 0;

}

Kindly check the Output below:

7 0
3 years ago
Ray owns a gaming cafe where users can play video games on computers. These games involve rich graphics and need high processing
tankabanditka [31]

Answer:

thick

Explanation:

i took the test and got it right

6 0
2 years ago
Write a script that prints the multiples of 7 between 0 and 100. Print one multiple per line and avoid printing any numbers that
Sedbober [7]

Answer:

The program to this question can be described as follows:

Program:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

int x; //defining integer variable

for(x=0;x<=100;x++) //defining loop to count value from 0 to 100

{

   if(x%7==0) //check value is divisable by 7

   {

       cout<<x<<endl; //print value

   }

}

   return 0;

}

Output:

please find the attachment.

Explanation:

In the above code, an integer variable x is declared, which is used in the for loop, in this loop variable  "x" starts from 0 and ends when the value of x is less than and equal to 100.

  • Inside the loop an, if block is used that defines a condition that is (i%7==0), it will check, that the value is divided by 7.
  • In this loop, a print method is used, that prints its values.

8 0
3 years ago
Computer and human interaction advantages in your day to day activities.
kondaur [170]

Answer:

Use of computer in our life is incredibly necessary. Computer science is evaluated and challenged by humans every day. From Engineers to Doctors, Students to Teachers, entrepreneurs to investors, government organization they all use it to perform specific tasks, for entertainment, online earnings, and office work. Computers have made our life easier in these decades. With higher accuracy and quality, less time-consumption, computers can do a lot in a short time while that task can take a lot of time if we do manually. Computers have taken industries and businesses to a worldwide level. They are used at home for online education, entertainment, in offices, hospitals, private firms, NGOs, Software house, Government Sector Etc. The computer is a very vast field in every sector and every aspect of life.

<em><u>IT MAY HELP YOU!!!!</u></em>

5 0
2 years ago
What is civil construction?
sasho [114]
Civil construction is any construction in a society that belongs to the group of core infrastructure such as <span>pipelines, telecommunications, sewers, water treatment systems, highways, roads, bridges etc.</span>
6 0
3 years ago
Other questions:
  • A(n) _______________ supplies one of the most critical aspects of docking stations, but in a smaller, more portable format: supp
    15·1 answer
  • Alexei was given a key to a substitution cipher. The key showed that the entire alphabet was rotated 13 steps. What type of ciph
    7·1 answer
  • The code segment below uses the procedure IsPartOf (list, item), which returns true if item appears in list and returns false ot
    13·1 answer
  • Pls Help Me!!!!!!!!!!! It won’t work when I connect to ITunes!
    12·1 answer
  • Columns are labeled with letters and Rows are labeled with numbers.
    5·1 answer
  • You're setting up some VMs to test an application you're considering making available to employees of the small company you work
    11·1 answer
  • Examples of domain names and usernames<br><br><br><br>​
    11·1 answer
  • Select the four bad password ideas.
    13·2 answers
  • You have been supporting CSM Tech Publishing's Windows Server 2016 server network for over a year. The office has two Windows Se
    12·1 answer
  • People’s personal information is collected _____. Select 4 options.
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!