• 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 Resit Exam, 24.01.2019, 13:20

Duration : 61 Minutes

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

SIGNATURE : ………...

EXAM GRADE

[...] ...

Students have to obey Engineering Faculty Exam Execution Instructions.

Questions are related to 1,4,12 of Program Learning Outcomes

void traverse(TreeNode* v) {

if (v->left != NULL) {

traverse(v->left);

cout << v->elem << " ";

}

if (v->right != NULL) {

cout << v->elem << " ";

traverse(v->right);

} }

1.

What is the output of the function traverse() that is called with the root of the tree below as the argument?

(40P)

8 4

2 6

3

5 7

12

10 14

9 11 13 15

1

8 7 6 5 4 3 2 1

2.

Assume that the numbers above are inserted into a binary tree. Which of the outputs of the inorder, preorder and postorder traversals is different from the other two?

(30P)

You’ll loose 5P from wrong answer.

(A) inorder

(B) preorder

(C) postorder

(2)

void insertOrdered(string& e, int& i) {

DoublyNode* newNode = new DoublyNode;

newNode->elem = e;

newNode->score = i;

DoublyNode* current = header;

while (current->next != trailer) {

if (newNode->score >= current->next->score) current = current->next;

else break;

}

newNode->next = current->next;

newNode->prev = current;

... = ...;

... = ...;

}

3.

Complete the function insertOrdered() (30P) You’ll loose 5P from wrong answer.

(A)

newNode->next->prev = newNode;

current->next->prev = newNode;

(B)

newNode->prev->next = newNode;

current->next = newNode;

(C)

current->next->prev = newNode;

newNode->prev->next = newNode;

(D)

current->next = newNode;

current->next->prev = newNode;

(E)

newNode->prev->next = newNode;

current->next->prev = newNode;

Referanslar

Benzer Belgeler

About relational database's concepts, the pieces of database systems, how the pieces fit together, multi-tier computing architecture and multiple databases, dbase and paradox..

2 The Intel 8080 Microprocessor Instruction Set 3 The Intel 8080 Microprocessor Instruction Set 4 Assembly language, program writing, examples 5 Assembly language, program

Course Objectives To give the the fundamental organization of the computers To teach the MIPS assembly language programming Learning Outcomes When this course has been completed

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

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

Students have to obey Engineering Faculty Exam Execution Instructions... Complete the function