Chat with us, powered by LiveChat C++ Question - EssayAbode

C++ Question

1:Consider using bubble sort to process the following list of numbers into ascending order

(smallest to largest), where we make passes from the right (the end) back to the left

(beginning):

5 4 1 2 3

What would be the order of the numbers after making only the two passes through the list?

2:create a general-purpose Date class:

Date( int theMonth = 3, int theDay = 11, int theYear = 2022) { month = theMonth; day = theDay; year = theYear; }

how many different ways can we call the constructor How many [ 0 . . 5 ] of the options below would compile and run and call the constructor above?

I. Date aDate();

II. Date aDate = {5, 3, 2022};

III. Date aDate(5, 3, 2022);

IV. Date aDate(5);

V. Date aDate(5, 3);

3:Which of the following options is not an advantage an array has over a linked list? a) It uses less memory

b) Accessing an array entry is typically faster than accessing a list element

c) An element can be inserted in the middle without having to shift other elements

d) We can use memory arithmetic to jump to a particular part

4:Assume you have a Node class and pHead is a pointer to the head of the following list of Nodes:

class Node { public: int data; Node *pNext; };

11 9 7 5 3 1

What is the output from the statement? cout << pHead->pNext->pNext->pNext->data;

5:hat advantage does a linked list have over an array?

a) Linked lists take up less space in memory

b) We typically know the size of a linked list when the program is compiled

c) Traversing a linked list to find a value in a node is faster than finding a value in an array

d) It takes less computation time to insert a new node in the middle of a linked list than it does to insert a new value into the middle of an array.

6. Consider implementing a doubly linked list, such as the one below. Which two options below would be a benefit for such a list? For example, if you think the answer is E and F, put E and F.

look at the attached picture.

a) It is easier to traverse the list forwards and backwards

b) When removing a node, you only have to modify one of its pointers

c) You do not have to use recursion to reverse the list

d) When inserting a new node only pHead needs to be updated

Related Tags

Academic APA Assignment Business Capstone College Conclusion Course Day Discussion Double Spaced Essay English Finance General Graduate History Information Justify Literature Management Market Masters Math Minimum MLA Nursing Organizational Outline Pages Paper Presentation Questions Questionnaire Reference Response Response School Subject Slides Sources Student Support Times New Roman Title Topics Word Write Writing