Q2: a) Create a function void print() in QueueArray class that prints the elements from first to last. b) Create a function void reverseK(QueueArray q, int k) that reverse the first k elements in the q. if k = 0, it does nothing (return ;) else it reverses the first k element as: If the q [1,2,3,4] reverse(q,3) makes the q to be [3,2,1,4] If the q [7,8,2,14,5] reverse(q,4) makes the q to be [14,2,8,7,5] Test your functions in the main driver

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question
In c++
Q2: a) Create a function void print() in QueueArray class that prints the elements from first to last.
b) Create a function void reverseK(QueueArray<int> q, int k) that reverse the first k elements in
the q. if k = 0, it does nothing (return ;) else it reverses the first k element as:
If the q [1,2,3,4] reverse(q,3) makes the q to be [3,2,1,4]
If the q [7,8,2,14,5] reverse(q,4) makes the q to be [14,2,8,7,5]
Test your functions in the main driver
Transcribed Image Text:Q2: a) Create a function void print() in QueueArray class that prints the elements from first to last. b) Create a function void reverseK(QueueArray<int> q, int k) that reverse the first k elements in the q. if k = 0, it does nothing (return ;) else it reverses the first k element as: If the q [1,2,3,4] reverse(q,3) makes the q to be [3,2,1,4] If the q [7,8,2,14,5] reverse(q,4) makes the q to be [14,2,8,7,5] Test your functions in the main driver
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,