Assignment - Kindly help am stack

Discuss all kind of algorithms and data structures from their mathematical and programming sides.

Moderators: Darobat, RecursiveS, Dante Shamest, Bugdude, Wizard

Assignment - Kindly help am stack

Postby mweshk » Fri Jul 13, 2012 6:52 am

1. A Queue ADT can be implemented as an Array or a Linked List.
Required:
Considering all the possible operations of a Queue, implement the Queue ADT as an
abstract C++ class. Inherit from the abstract class, some two classes to implement the
queue using an array and a linked list.
Use some sample data to test ALL the operations and preferably print some sample
output.
2. Algorithm Analysis.
Compare the asymptotic analysis for the following two pieces of code. Show
your calculations for each code.
Code 1
sum = 0;
for (i=1; i<=n; i++)
for (j=1; j<=n; j++)
sum++;
Code 2
sum = 0;
for (i=1; i<=n; i++)
for (j=1; j<=i; j++)
sum++;
for (k=0; k<n; k++)
A[k] = k;
mweshk
 
Posts: 3
Joined: Fri Jul 13, 2012 4:34 am

Return to Algorithms & Data Structures

Who is online

Users browsing this forum: No registered users and 1 guest