Sale!

ECE-C301 Lab 9 solution

$30.00

ECE-C301 Advanced Programming for Engineers
Laboratory Assignment: Week 9
Name:
(15 Points) Modify your Fibonacci computation program from Week 7’s laboratory assignment to accept a command line
argument specifying how many elements to compute. Now, instead of using an array stored on the stack to store the Fibonacci
elements, dynamically allocate the necessary memory for storing the solution on the heap.
Additionally, your program should print usage information to the screen if the user runs your program without specifying
how many Fibonacci elements to compute.

Category:

Description

5/5 - (1 vote)

ECE-C301 Advanced Programming for Engineers
Laboratory Assignment: Week 9
Name:
(15 Points) Modify your Fibonacci computation program from Week 7’s laboratory assignment to accept a command line
argument specifying how many elements to compute. Now, instead of using an array stored on the stack to store the Fibonacci
elements, dynamically allocate the necessary memory for storing the solution on the heap.
Additionally, your program should print usage information to the screen if the user runs your program without specifying
how many Fibonacci elements to compute.
Compile, run, and show your working code to the TA.
TA Initials
(15 Points) The linked list implementation covered in lecture allowed for elements to only be added and removed from the
top (i.e. the end nearest the head). As a result, the link list from class implemented a data structure known as a Stack.
Sometimes Stacks are also referred to as “First In Last Out” buffers (i.e. a FILO). This is because items added to the list
first will be the last items to be removed.
Another data structure that can be easily implemented using a linked list is a Queue. A Queue is also sometimes referred to
as a “First in First Out” buffer (i.e. a FIFO). All you need are a pair of functions: one function should add new items to
one end of the list and the other function should remove items from the opposite end of the list. Since you must traverse the
entire linked list to find the end, deciding which end to add items to and which end to remove items from really depends on
if it is more important for items to be added to the queue quickly or removed from the queue quickly.
Based on the linked list implementation covered in lecture, design a Queue that is faster at removing items than it is at
adding new items.
Compile, run, and show your working code to the TA.
TA Initials
1