• Sonuç bulunamadı

1. 2. 90 Minutes Karadeniz Technical University Department of Computer Engineering Lecturer Omer CAKIR COM 205 Data Structures Final Exam, 01.02.2015, 15:00, D-1, D-8 Time :

N/A
N/A
Protected

Academic year: 2021

Share "1. 2. 90 Minutes Karadeniz Technical University Department of Computer Engineering Lecturer Omer CAKIR COM 205 Data Structures Final Exam, 01.02.2015, 15:00, D-1, D-8 Time :"

Copied!
2
0
0

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

Tam metin

(1)

Karadeniz Technical University Department of Computer Engineering

Lecturer Omer CAKIR

COM 205 Data Structures

Final Exam, 01.02.2015, 15:00, D-1, D-8 Time : 90 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.

1.

Insert 3 into the splay tree above.

(30P)

int Hash (char* key) {

int sum = 0;

for (int j=0; j<4; j += 2) sum += 4*key[j] + key[j+1];

sum = sum % 11 ; return sum;

}

dictionary.txt list liste nuts findik object nesne order duzen parent baba queue kuyruk stack yigin tree agac

2.

Write words from dictionary.txt to relative.txt using Hash() function to calculate relative addresses and linear probing as a collision resolving method. In addition, add related words to linked lists using synonym chaining method. (30P)

relative.txt a-97 n-110

0 b-98 o-111

1 c-99 p-112

2 d-100 q-113

3 e-101 r-114

4 f-102 s-115

5 g-103 t-116

6 h-104 u-117

7 i-105 v-118

8 j-106 w-119

9 k-107 x-120

10 l-108 y-121

ASCII Table  m-109 z-122

0

1

2

3

4

5

6

7

8

9

10

(2)

bool empty() {

return (header->next == trailer);

}

void addFront(const int& i) {

add(header->next, i);

}

void add(DoublyNode* v, int& i) {

DoublyNode* u = new DoublyNode;

u->score = i;

...

...

...

...

}

void main() {

DoublyLinkedList list;

list.addFront(750);

list.addFront(720);

}

3.

Taking into account the lines represented by ... in the function add() answer the following choices :

i)

(20P) (You’ll loose 5Ps from wrong answer) If the lines are like these

v->prev->next = u;

v->prev = u;

u->prev = v->prev;

u->next = v;

the linked list will be : (A)

750 720

Header Trailer

(B)

720 750

Header Trailer

(C)

750 720

Header Trailer

(D)

720 750

Header Trailer

(E)

750 720

Header Trailer

ii)

(20P) (You’ll loose 5Ps from wrong answer) If the lines are like these

v->prev = u;

v->prev->next = u;

u->prev = v->prev;

u->next = v;

the linked list will be : (A)

750 720

Header Trailer

(B)

720 750

Header Trailer

(C)

750 720

Header Trailer

(D)

720 750

Header Trailer

(E)

750 720

Header Trailer

Referanslar

Benzer Belgeler

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

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

Write words from dictionary.txt to relative.txt using Hash() function to calculate relative addresses and linear probing as a collision resolving method.. In addition,

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

Brief information about the exam will be given at the begining, then no one is not allowed to ask a question during the exam.. print2() calls itself

Complete removeOrdered() function above that removes an element from a doubly

insertOrdered() that insert elements with ascending order into a doubly linked list gives an error because line sequence of one or more code block written in bold is changed.. Write

Write the sentences from dictionary.txt to relative.txt like above using Hash() function above.. Use linear probing as a collision