Sunday, December 28, 2014

Updated Code

If you have downloaded the code of the tree before Exam2 then please re-download it again now. The code that was uploaded before contains an implementation of the deleteNode function that is different from the one we have discussed in class.

To make sure that you have the right file, check if the file name is BST_NewDelete.cpp, if the file name is BST.cpp/h then please re-download the code again.

Tuesday, December 23, 2014

Previous Exams

Here is a link for the solution of the exam we have solved in class (Thanks to Safaa Horize).

Here is also an alternative link for the previous exams.


Sunday, December 21, 2014

Assignment 3 and an Alternative Link For the Code

Assignment 3 is ready! Check it out in the assignments tab.

Here is also an alternative link for the code since the university's E-Learning system is down.

Saturday, December 20, 2014

HW2 Solution and Some Tree Operations

Here is the solution for HW2.

Here is also the code we have written in today's session:

- GetMax (3 ways).
- IsComplete (3 ways).
- IsBalanced.


Friday, December 19, 2014

Meeting On Saturday

There will be two sessions this Saturday 20/12/2014 inshaAllah.
The first session will start at 10:00 AM and the second at 12:00 PM.

I haven't had the chance to reserve a room. We will meet where we usually take our lecture and then move to any empty room.

Wednesday, December 17, 2014

Iterative InOrder and PostOrder

We have seen in class the iterative version of the pre-order traversal. The following two links that discuss how post-order and in-order traversals can be implemented iteratively:

http://leetcode.com/2010/04/binary-search-tree-in-order-traversal.html

http://leetcode.com/2010/10/binary-tree-post-order-traversal.html

Thursday, December 11, 2014

Exam Review Session

There will be a review session with the TA on Sunday 14/12/2014 at 3:00 PM in IT 201.

In this session, the TA will answer any questions you have regarding Stacks, Queues and ArrayLists.

Wednesday, December 10, 2014

Session on Recursion

There will be another session on recursion inshaAllah today (Thursday 11/12/2014) with our teaching assistant, Ms. Safaa Horize,  from 3:00 to 5:00 PM at IT 201.

Friday, December 5, 2014

Overloading the "<<" Operator

If you are facing problems implementing the operator overloading of the stream extraction operator "<<", then note the following:

  • The function should be a non-member function. Overloading it as a member function should cause compilation errors when you implement the main function.
  • The function should be inlined (i.e. implemented inside the class).
  • To be able to access the private members of class DLList, the operator overloading function should be a friend of DLList.


To summarize, if you add the following inside the DLList class, your program should compile correctly:

friend ostream & operator<<(ostream & out, DLList<T> & list) {
    // code that prints the list should go here.}



On the other hand, overloading the assignment operator "=" can be done as usual, as a member or a non-member function and inlined or not inlined. In all cases it should work fine.

Here are two links if you wish to read more:
http://www.parashift.com/c++-faq-lite/template-friends.html
http://stackoverflow.com/questions/9814345/cant-overload-operator-as-member-function

Wednesday, December 3, 2014

On Stacks and Queues

The following is a link for a visualization of the queue as an array:
http://www.cosc.canterbury.ac.nz/mukundan/dsal/CQueueAppl.html

Here is also the code we have written in class for printing and reversing queues:
StacksAndQueues.cpp

Some students have also requested that I post the code for checking expressions for bracket consistency. I have drafted a quick solution today that can be found here. Such problems are excellent exercises. It is a pity though that we rarely ask questions on stacks and queues with this level in the exam.

Wall of Fame!

Are you following the updates at the Wall of Fame?
Check them out and please be jealous!!

Tuesday, December 2, 2014

Recursion Review Sessions

By the end of this week, we will have started discussing "trees" in all of the sections, which is the second major topic in this course after linked lists.

When dealing with trees, we will often write recursive code. Therefore, it is very important that you review your information about recursion.

Our TA is willing thankfully to give two review sessions on recursion: Wednesday from 10:00 - 11:00 and Thursday from 12:00 -1:00 (at lab 103).

Make sure to attend, especially if you are not fluent in recursion or if you need a refresher!

Monday, December 1, 2014

Assignment 2 Deadline

The deadline for assignment 2 has been postponed until 7/12/2014 11:55 PM.

Bittawfeeq!