Sunday, November 30, 2014

Queue As An Array

For section (SuTuTh):

As we wrote in class the code of the Enqueue method for the queue as an array, we forgot to handle an important case, which is when the queue is empty.

It is not enough in this case to increment last; we have to increment also first, since both first and last are -1 when the queue is empty.

The code should look as follows:

template <class T>
void QueueArray<T>::Enqueue(T& el)
{
    if(IsFull()){
        printf("\n Can't enqueue into a full queue!");
        return;
    }

    if(IsEmpty())
        first = last = 0;
    else if(last == capacity-1)
        last = 0; 
    else
        last++;
    
    data[last] = el;
    size++;

}

Sunday, November 23, 2014

Assignment 2

It is ready. Check it out, start early and have fun!

I am curious to see innovative solutions for the bonus question!

Wednesday, November 12, 2014

Announcements

1) 
As I will be traveling to Egypt tomorrow inshaAllah to attend the annual ACM Arab Collegiate Programming contest, I will not attend the lectures on Sunday and Tuesday.

On Sunday, at 9:00 AM in room 203, Dr. Ghassan will solve the exam. Please attend his lecture as a substitute for our lecture on Sunday. For Tuesday, you are free to attend with Dr. Ghassan or not, as he will start a new subject: Array Lists.

2)
Sister Safaa Horaiz, our teaching assistant, is thankfully willing to help in the course. Her office is at the meeting room under Dr. Arafat's office. You can see her to ask about anything related to the course. Her office hours are:

Sundays: 2:00 - 4:00 PM
Mondays and Wednesdays: 8:00 AM - 1:00 PM.
Tuesdays: 12:00 - 2:00 PM.

I wish you all the best of luck in your exams.

Exam1 - Spring 2014

Here is a link to the first exam of Spring 2014.
Here is also a link to the solutions for the coding questions.

Saturday, November 8, 2014

Monday, November 3, 2014

HW1 Deadline Extension

Due to the overwhelming demand for a deadline extension, and because the e-learning site was down during the weekend, the deadline for assignment 1 is now Sunday 9/11/2014.

Bittawfeeq!