Question: Create a vector called 'mathSequence' with the first 1 0 terms of the Fibonacci sequence. Then a ) Extend the sequence by adding the next

Create a vector called 'mathSequence' with the first 10 terms of the Fibonacci sequence. Then
a) Extend the sequence by adding the next 5 Fibonacci numbers.
b) Remove all even numbers from the sequence.
c) Replace each number with its square root (rounded to two decimal places).
d) Find the sum of all elements in the vector.
e) Determine if the golden ratio (approximately 1.618) exists between any two consecutive terms.
Design a program to perform the above operations. Explain how vectors simplify the process of working with mathematical sequences compared to traditional arrays. (25 MARKS)
3.23.2 Consider a doubly linked list storing student information (name, Student Number, DP) with the following data: (Alice,40241001,67)<->(Bob,40231002,84)<->(Charlie,40221003,78)<->(David,40201004,67) Perform these tasks:
a) Add a new student (Eve,40231005,3.6) to the end of the list.
b) Remove the student with ID 40231002 from the list.
c) Swap the positions of the first and last students in the list.
d) Sort the list based on DP in descending order.
e) Find and print the name of the student with the highest DP.
Write C++ code to implement these operations and explain the advantages of using a doubly linked list in this scenario.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!