SlideShare a Scribd company logo
C++ Program:
N-number queue rotations.
[16] Write methods void Queue::lRotate(int n) and void Queue::rRotate(int n) which rotate the
queue by n-number elements.
Solution
void rRotate(int& root){
item* tmpRoot = itemArray[root];
int ogLeft = tmpRoot->left;
tmpRoot->left = itemArray[ogLeft]->right;
itemArray[ogLeft]->right = root;
root = ogLeft; //to be made the (sub)root outside the method
}
void lRotate(int& root){
item* tmpRoot = itemArray[root];
int ogRight = tmpRoot->right;
tmpRoot->right = itemArray[ogRight]->left;
itemArray[ogRight]->left = root;
root = ogRight; //to be made the (sub)root outside the method
}

More Related Content

PDF
My protease appears to affect bacteria, but not my own cells. What t.pdf
PDF
Name the phases in interphase, and describe what happens during those.pdf
PDF
Look for at least four definitions of accounting (from four differen.pdf
PDF
Match the word or phrase with the best description of it. ;An express.pdf
PDF
JAVAThe mean of a list of numbers is its arithmetic average. The .pdf
PDF
Know and understand the contributions of Hooke, van Leeuwenhoek, Cohn.pdf
PDF
ImplementDijkstra’s algorithm using the graph class you implemente.pdf
PDF
Illegal numbers.a. Complete the method find which accepts a collec.pdf
My protease appears to affect bacteria, but not my own cells. What t.pdf
Name the phases in interphase, and describe what happens during those.pdf
Look for at least four definitions of accounting (from four differen.pdf
Match the word or phrase with the best description of it. ;An express.pdf
JAVAThe mean of a list of numbers is its arithmetic average. The .pdf
Know and understand the contributions of Hooke, van Leeuwenhoek, Cohn.pdf
ImplementDijkstra’s algorithm using the graph class you implemente.pdf
Illegal numbers.a. Complete the method find which accepts a collec.pdf

More from gopalk44 (20)

PDF
how many chromosomes will be found in each cell at the end of anapha.pdf
PDF
how are the technological approaches of cloning and IPSCs similar to.pdf
PDF
HELP! Thought I can figure this one out but got it wrong. I have one.pdf
PDF
From a recent statistical analysis for the last five years, on an av.pdf
PDF
Find asymptotic upperlower bounds. Find asymptotic upperlower boun.pdf
PDF
Explain how a wireless device can help an organization perform busin.pdf
PDF
Exam scores were normal in BIO 200. Jasons exam score was one stan.pdf
PDF
Discuss the various types of business crimes, a business liability f.pdf
PDF
Describe the different types of ribs. Which ribs are considered “fal.pdf
PDF
Circle the best answer to the following questions. From the Bohr mod.pdf
PDF
Below are two possible tree topologies. How many clades are different.pdf
PDF
WriteBelow are a list of descriptions that apply to either post s.pdf
PDF
Write the letter(s) of answers to the questions below. I. ksentify th.pdf
PDF
Write Assembly code (8086) that implements the function of (A.B) +C..pdf
PDF
Who was Floyd Allport and what are his main achievementsWho was.pdf
PDF
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
PDF
Within the Discussion Board area, write 400-600 words that respond to.pdf
PDF
Which statement is true with regards to acetylation of histones Dea.pdf
PDF
Which of the following is not a measure of variabilitya) Variance.pdf
PDF
What is the maximum probability of committing a Type I error called.pdf
how many chromosomes will be found in each cell at the end of anapha.pdf
how are the technological approaches of cloning and IPSCs similar to.pdf
HELP! Thought I can figure this one out but got it wrong. I have one.pdf
From a recent statistical analysis for the last five years, on an av.pdf
Find asymptotic upperlower bounds. Find asymptotic upperlower boun.pdf
Explain how a wireless device can help an organization perform busin.pdf
Exam scores were normal in BIO 200. Jasons exam score was one stan.pdf
Discuss the various types of business crimes, a business liability f.pdf
Describe the different types of ribs. Which ribs are considered “fal.pdf
Circle the best answer to the following questions. From the Bohr mod.pdf
Below are two possible tree topologies. How many clades are different.pdf
WriteBelow are a list of descriptions that apply to either post s.pdf
Write the letter(s) of answers to the questions below. I. ksentify th.pdf
Write Assembly code (8086) that implements the function of (A.B) +C..pdf
Who was Floyd Allport and what are his main achievementsWho was.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
Within the Discussion Board area, write 400-600 words that respond to.pdf
Which statement is true with regards to acetylation of histones Dea.pdf
Which of the following is not a measure of variabilitya) Variance.pdf
What is the maximum probability of committing a Type I error called.pdf

Recently uploaded (20)

PDF
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Hazard Identification & Risk Assessment .pdf
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PPTX
Digestion and Absorption of Carbohydrates, Proteina and Fats
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RMMM.pdf make it easy to upload and study
medical_surgical_nursing_10th_edition_ignatavicius_TEST_BANK_pdf.pdf
Computing-Curriculum for Schools in Ghana
Weekly quiz Compilation Jan -July 25.pdf
A powerpoint presentation on the Revised K-10 Science Shaping Paper
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Hazard Identification & Risk Assessment .pdf
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
History, Philosophy and sociology of education (1).pptx
LDMMIA Reiki Yoga Finals Review Spring Summer
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Chinmaya Tiranga quiz Grand Finale.pdf
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Practical Manual AGRO-233 Principles and Practices of Natural Farming
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
UNIT III MENTAL HEALTH NURSING ASSESSMENT
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Digestion and Absorption of Carbohydrates, Proteina and Fats
Final Presentation General Medicine 03-08-2024.pptx
RMMM.pdf make it easy to upload and study

C++ ProgramN-number queue rotations.[16] Write methods void Que.pdf

  • 1. C++ Program: N-number queue rotations. [16] Write methods void Queue::lRotate(int n) and void Queue::rRotate(int n) which rotate the queue by n-number elements. Solution void rRotate(int& root){ item* tmpRoot = itemArray[root]; int ogLeft = tmpRoot->left; tmpRoot->left = itemArray[ogLeft]->right; itemArray[ogLeft]->right = root; root = ogLeft; //to be made the (sub)root outside the method } void lRotate(int& root){ item* tmpRoot = itemArray[root]; int ogRight = tmpRoot->right; tmpRoot->right = itemArray[ogRight]->left; itemArray[ogRight]->left = root; root = ogRight; //to be made the (sub)root outside the method }