• Sonuç bulunamadı

Karadeniz Technical University Department of Computer Engineering

N/A
N/A
Protected

Academic year: 2021

Share "Karadeniz Technical University Department of Computer Engineering "

Copied!
1
0
0

Yükleniyor.... (view fulltext now)

Tam metin

(1)

Karadeniz Technical University Department of Computer Engineering

Lecturer Omer CAKIR

COM 205 Data Structures Condition Exam, 31.01.2013, 13:00, D1

Time : 75 Minutes

NUMBER : ……… NAME : ………...

Rules to be Obeyed During the Exam SIGNATURE : ………...

EXAM GRADE

[

...

] [

...

]

1. Cell phones are not allowed to be used as a calculator or a watch. They must be switched off and placed in the pocket.

2. Brief information about the exam will be given at the begining, then no one is not allowed to ask a question during the exam.

3. Do not to forget to sign this paper after writing your number and name.

void print(DoublyNode* node) {

if (node == trailer) return;

else print(node->next);

cout << node->elem << endl;

}

void main() {

DoublyLinkedList list;

list.insertOrdered("Paul", 720);

list.insertOrdered("Rose", 590);

list.insertOrdered("Anna", 660);

list.print(list.header->next);

}

1.

a) Write down the output of the program above? (10P)

b) How the output of the program would be if

if(node==trailer) part was changed like if(node->next==trailer). Explain the reason. (30P)

OUTPUT

7 5 4 3 2 1 6 2.

Insert the numbers above into a splay tree? (25P)

 Solve this question on the back side of the paper

void removeOrdered(const string& e, const int& i) {

SinglyNode* current = head;

SinglyNode* previous = head;

if((current->elem == e) && (current->score == i) ) {

head = current->next;

delete current;

return;

}

current = current->next;

while (current != NULL) {

if((current->elem == e)&&(current->score == i)) {

...;

delete current;

return;

}

... ; ... ; }

if(current==NULL) cout<<e<<" is not found"<<endl;

}

3.

Complete removeOrdered() function above that removes an element from a singly linked list. (15P)

4.

dequeue() function of a queue is implemented with circularly linked list function remove() whereas enqueue() requires advance() in addition to add(). Explain the reason.

(20P)

Referanslar

Benzer Belgeler

When the above version of the the MsgBox function is used, a rectangular forrn (we will learn later on that this type of form is called a dialog box) is presented to the user, display

Show the performance of the model by plotting the 1:1 line between observed and predicted values, by determining the Mean Square Error (MSE) and by calculating

Students have to obey Engineering Faculty Exam Execution Instructions.. Assume that the numbers above are inserted into a

Assume that numbers of each choice are inserted into a seperate binary tree.. In this case one tree is different from

Students have to obey Engineering Faculty Exam Execution Instructions.. Assume that the numbers above are inserted into a

 Accessory fruit can be simple, aggregate, or multiple, i.e., they can include one or more pistils and other parts from the same flower, or the pistils and other parts of

If f is differentiable at a, then f is continuous at a.. The proof is in

eld, and it is the unique function eld with this genus, up to isomorphism. More- over, it has a very large automorphism group. Until recently there was no known maximal function