Perform the following operations on a Stack with a capacity of 6:
Enqueue(4)
Enqueue(1)
Enqueue(3)
Dequeue()
Enqueue(8)
Dequeue()
| Index | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Value | ||||||
| Head | ||||||
| Tail |
When Enqueue: Insert at the Tail, then move the Tail to the next index.
When Dequeue: Remove from the Head, then move the Head to the next index.
ALGORITHM BinarySearch(
while
| Values | 3 | 14 | 27 | 31 | 39 | 42 | 55 | 70 | 74 | 81 | 85 | 93 | 98 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Index | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| Cursor |
Note:
For example, in the first iteration,
Implement a Stack in C# using an Array.
Provides the following:
Size: number of elements in the stackEmpty: true if the stack is empty, false otherwisePush: add an element to the top of the stackPop: remove and return the top element of the stackPeek: return the top element of the stack without removing itUse the skeleton provided.
Implement a Circular Linked List in C#, from the following interface:
public interface IQueue {
int Capacity { get; }
int Count { get; }
bool IsEmpty();
bool IsFull();
void Enqueue(int value);
Object Dequeue();
Object Head();
void Clear();
}
Create a CustomerCollection class in C# that stores Customer objects (with FirstName, LastName, and Phone).
Implement the following operations:
Find(string firstName, string lastName): returns the associated Phone numberInsert(string firstName, string lastName)Insert(Customer customer)Delete(string firstName, string lastName)Display(): prints all the Customer objects