Which Type Of Shoring Should Be Used To Prevent Vertical Movement Of A Vehicle When Its Tires Or Suspension (2024)

The answer provided below has been developed in a clear step by step manner.

Answer:

#include "linked_list.h"

#include <iostream>

using namespace std;

Linked_List::Linked_List(){

length = 0;

head = nullptr;

}

int Linked_List::get_length(){

return this->length;

}

unsigned int Linked_List::push_front(int new_val){

length ++;

Node *new_node = new Node(new_val, head);

head = new_node;

return length;

}

unsigned int Linked_List::push_back(int new_val){

length ++;

if (head == nullptr){ //if it's empty

head = new Node(new_val, nullptr);

}

else{

Node *temp = this-> head; //start from head

while (temp->next != nullptr){

temp = temp->next; //scrolling till the very end

}

//inserting it at the end:

Node *new_node = new Node(new_val, temp->next);

temp-> next = new_node;

}

return length;

}

unsigned int Linked_List::insert(int new_val, unsigned int index){

length++;

Node *temp = new Node(new_val, NULL);

if (index == 0){

temp->next = this->head;

head = temp;

return length;

}

else{

temp = this-> head;

//temp -> val = new_val;

int check = index-1;

for (int i = 0; i< check; i++){

temp = temp->next;

}

Node *new_node = new Node(new_val, temp->next);

temp-> next = new_node;

}

return length;

}

void Linked_List::print(){

Node *temp = this->head;

while (temp != nullptr){

cout << temp->val << " ";

temp = temp->next;

}

cout << endl;

}

void Linked_List::clear(){

delete head;

}

void Linked_List::delete_all_nodes(){

length = 0;

Node* next = nullptr;

Node* temp = head;

while (temp != nullptr){

next = temp->next;

free(temp);

temp = next;

}

head = nullptr;

}

Linked_List::Linked_List(const Linked_List& old_list){

cout << "Invoked the copy constructor!" << endl;

this-> length = old_list.length;

this-> head = nullptr;

Node *temp = old_list.head;

while(temp != nullptr){

Node *test = new Node(temp->val, temp->next);

if (this->head == nullptr){

this->head = test;

}

temp = temp->next;

}

}

Linked_List& Linked_List::operator=(const Linked_List& old_list){

cout << "Invoked the overloaded assignment operator" << endl;

this-> length = old_list.length;

this-> head = nullptr;

Node *temp = old_list.head;

while(temp != nullptr){

Node *test = new Node(temp->val, temp->next);

if (this->head == nullptr){

this->head = test;

}

temp = temp->next;

}

return *this;

}

void Linked_List::check_for_prime(){

int counter = 0;

bool flag = true;

Node *temp = this->head;

while (temp != nullptr){

// this assignment requires that a negative number is never considered to be prime. 0 and 1 are also not considered as prime numbers

if (temp->val > 1){

for (int i = 2; i <= temp->val/2; i++){

if (temp->val % i == 0){ // here we check if there is such number that fully divides our value

flag = false;

break;

}

}

if (flag == true){

counter++;

}

else{ flag = true; }

}

temp = temp->next;

}

cout << "You have " << counter << " prime number(s) in your list. (that's the total number of prime numbers) " << endl;

}

/*

merge_sort(head){

1) check if length <= 1 if so return

2) split unsorted list in half

3) first = merge_sort(first half)

4) second = merge_sort(second half)

5) merge(first, second)

}

*/

Node* merge_sort(Node* head){

Node *temp = head;

int length = 0;

while (temp != nullptr){

temp = temp -> next;

length ++;

}

if (length <= 1){

return head;

}

temp = head;

for (int i = 0; i< ((length-1)/2); i++){

temp = temp -> next;

}

Node *second = temp-> next;

temp-> next = NULL;

temp = head;

head = merge_sort(head);

second = merge_sort(second);

return merge(head, second);

}

Node* merge(Node* first, Node* second){

Node* result = nullptr;

if (first == nullptr){

return second;

}

else if (second == nullptr){

return first;

}

if (first->val <= second->val) {

result = first;

result->next = merge(first->next, second);

}

else{

result = second;

result->next = merge(first, second->next);

}

return result;

}

void Linked_List::sort_ascending(){

if (head == nullptr){

return;

}

head = merge_sort(head);

}

void swap_nodes(Node** head, Node* currX, Node* currY, Node* prevY){

// make 'currY' as new head

*head = currY;

prevY->next = currX;

Node* temp = currX->next;

currX->next = currY->next;

currY->next = temp;

}

Node* selection_sort(Node* head){

// if there is only a single node

if (head->next == NULL){

return head;

}

Node* min = head;

Node* beforeMin = NULL;

Node *temp = head;

while (temp->next != nullptr){

if (temp->next->val >= min->val) {

min = temp->next;

beforeMin = temp;

}

temp = temp->next;

}

if (min != head){

swap_nodes(&head, head, min, beforeMin);

}

// recursively sort the remaining list

head->next = selection_sort(head->next);

return head;

}

void Linked_List::sort_descending(){

if (head == nullptr){

return;

}

head = selection_sort(head);

}

void Linked_List::list_revese(){

Node *temp = head->next;

Node *prev = head;

Node *next = NULL;

head->next = NULL;

while (temp != nullptr){

next = temp->next;

temp->next = prev;

prev = temp;

temp = next;

}

head = prev;

}

To know more about Array List visit:

https://brainly.com/question/17265929

#SPJ4

Which Type Of Shoring Should Be Used To Prevent Vertical Movement Of A Vehicle When Its Tires Or Suspension (2024)

References

Top Articles
Ponyo Full Movie English Free
Jamie Tarses, first female TV network entertainment head, dies at 56
Craigslist Motorcycles Jacksonville Florida
Pitt Authorized User
Co Parts Mn
Volstate Portal
Slapstick Sound Effect Crossword
What's New on Hulu in October 2023
My.doculivery.com/Crowncork
Transformers Movie Wiki
All Buttons In Blox Fruits
Current Time In Maryland
Moonshiner Tyler Wood Net Worth
Mineral Wells Independent School District
Steamy Afternoon With Handsome Fernando
Committees Of Correspondence | Encyclopedia.com
Cambridge Assessor Database
Johnnie Walker Double Black Costco
Tire Plus Hunters Creek
Claio Rotisserie Menu
Lacey Costco Gas Price
Black Lion Backpack And Glider Voucher
A Man Called Otto Showtimes Near Carolina Mall Cinema
Alternatieven - Acteamo - WebCatalog
The Creator Showtimes Near Baxter Avenue Theatres
Filmy Met
Bursar.okstate.edu
Wbli Playlist
Wednesday Morning Gifs
Craigslist Car For Sale By Owner
Natashas Bedroom - Slave Commands
Bitchinbubba Face
Lyca Shop Near Me
One Main Branch Locator
Directions To Advance Auto
Craigslist Free Manhattan
Sam's Club Gas Prices Deptford Nj
Mid America Irish Dance Voy
20 bank M&A deals with the largest target asset volume in 2023
Kent And Pelczar Obituaries
LoL Lore: Die Story von Caitlyn, dem Sheriff von Piltover
Amy Zais Obituary
bot .com Project by super soph
Online College Scholarships | Strayer University
Rovert Wrestling
Unpleasant Realities Nyt
Game Akin To Bingo Nyt
Billings City Landfill Hours
Craigslist Monterrey Ca
Public Broadcasting Service Clg Wiki
Craigslist Yard Sales In Murrells Inlet
Booked On The Bayou Houma 2023
Latest Posts
Article information

Author: Edwin Metz

Last Updated:

Views: 5980

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Edwin Metz

Birthday: 1997-04-16

Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

Phone: +639107620957

Job: Corporate Banking Technician

Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.