• 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!
2
0
0

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

Tam metin

(1)

Karadeniz Technical University Department of Computer Engineering

Lecturer Ömer ÇAKIR

COM 2005 Data Structures Final Exam, 01.11.2019, 10:00, D-1

Duration : 61 Minutes

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

SIGNATURE : ………...

EVALUATION

[...] ...

Exam Execution Instructions of Faculty of Enginnering should be obeyed. Questions are related to 1,4,12 of Program Learning Outcomes

void insertOrdered(DoublyNode* newNode, DoublyNode* current) {

if(...) {

newNode->next = current;

newNode->prev = current->prev;

current->prev->next = newNode;

current->prev = newNode;

} else

insertOrdered(newNode, current->next);

}

int main() {

DoublyLinkedList list; DoublyNode* newNode;

newNode = new DoublyNode;

newNode->elem = "Paul"; newNode->score = 720;

list.insertOrdered(newNode, list.header->next);

newNode = new DoublyNode;

newNode->elem = "Rose"; newNode->score = 590;

list.insertOrdered(newNode, list.header->next);

newNode = new DoublyNode;

newNode->elem = "Anna"; newNode->score = 660;

list.insertOrdered(newNode, list.header->next);

newNode = new DoublyNode;

newNode->elem = "Mike"; newNode->score =1105;

list.insertOrdered(newNode, list.header->next);

}

1.

Complete the function insertOrdered(). (25P) Assume that Header’s and Trailer’s scores are 0.

You’ll loose 5P from wrong answer.

(A) if ((current == trailer)

|| (newNode->score <= current->score)) (B) if ((current->next == trailer)

|| (newNode->score <= current->score))

(C) if ((current == trailer)

|| (newNode->score <= current->next->score))

(D) if ((current->next == trailer)

|| (newNode->score <= current->next->score))

8 4 12 2 6 10 14 1 3 5 7 9 11 13 15 2.

Assume that the numbers above are inserted into a binary tree. Assume again that another 3 new binary trees are generated by the output of the inorder, preorder and postorder traversals of this binary tree. Which of the following is the ascending of the levels of these 3 new binary trees? (25P) You’ll loose 5P from wrong answer.

(A) inorder < preorder < postorder

(B) inorder < postorder < preorder (C) preorder < inorder < postorder (D) preorder < postorder < inorder (E) postorder < inorder < preorder (F) postorder < preorder < inorder

(2)

8 4 12 2 6 10 14 1 3 5 7 9 11 13 15 3.

Assuming that the numbers above are inserted into a Heap :

a)

What is the output of the print()? (25P)

b)

What is the output of the print() after removeMin() ? (25P)

0 1 5 4 15

0 2 14

Referanslar

Benzer Belgeler

3 An ability to apply mathematical foundations, algorithmic principles, and computer engineering techniques in the modelling and design of computer-based systems. 3 4 An

• Search in binary trees requires O(log n) time in the average case, but needs O(n) time in the worst-case, when the. unbalanced tree resembles a

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

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

Exam Execution Instructions of Faculty of Enginnering should be obeyed.. Complete the

Cell phones are not allowed to be used as a calculator or a watch. They must be switched off and placed in the pocket. Brief information about the exam will be given at the