Professional Documents
Culture Documents
Δομες Δεδομενων
Δομες Δεδομενων
:
:
-
-
-
231
:
: 7.5 ECTS
(3 ): .
(1 ): /
(2 ):
40% (1)
20% (1)
.: , 14 10:30 12:00
15% (4 )
25% (3 )
231
:
:
E-mail:
:
FST-01 116
22-892748
stellak@cs.ucy.ac.cy
, 13:00-15:00
: -02B111
/: , / 10:30-12:00
:
: -02B111
/: , 16:00 17:00
: 121
/: , 13:30-15:00
http://www.cs.ucy.ac.cy/courses/EPL231/
231
1-3
:
111 ( )
132 ( )
231
222 ( )
223 ( )
233 ( )
242 ( )
428 ( )
431 ( )
433 ( )
442 ( )
447 ( )
451 ( )
231
Mark Allen Weiss, Data Structures and Algorithm
231
1-6
,
.
.
Church Turing
1930.
!
231
1-7
231
1-8
-
- .
, .., vs.
,
.
primitive data types (.. int, char)
.
, ..
( ): {2, 3, 5, 7, 11, 13}
( ): (2, 3, 5, 7, 11, 13)
: 2 3 5
7 11 13
231
- ,
.
(String)
(String)
,
(int)
(int)
(String)
.
,
JAVA
class Address{
String street;
, ,
int number;
. }
class Student{
String name;
int id;
Address saddress;
}
.
231
10
( )
.
.
Value
3669504
3669508
3669512
3669524
3669536
int a[]
=3
Address
4 bytes *
C
int x = 5;
printf("x=%d\tAddress of x=%d\n",
x, &x);
int c = 'A';
printf("c=%c\tAddress of c=%d\n",
c, &c);
int a[]={1,2,3};
for(int i=0; i<3; i++){
printf("a[%d]=%d\tAddress of
a[%d]=%d\n", i,a[i],i,&a[i]);
}
3669504. 3669508 ...
* x86 232 4x109.
x64 8 bytes 264= 18x1018 !
231
11
,
(
, .., array).
,
. :
1. ()
: /
Address
Value
3143928
3143932
3143936
3143940
3143944
3143948
C
int b[][3]={{1,2,3},
{4,5,6}};
for(int i=0; i<2; i++){
for(int j=0; j<3; j++){
printf("Address of
b[%d][%d]=%d\n",
i,j,&b[i][j]);
}
}
231
Address
Address
Address
Address
Address
Address
of
of
of
of
of
of
b[0][0]=
b[0][1]=
b[0][2]=
b[1][0]=
b[1][1]=
b[1][2]=
3143928
3143932
3143936
3143940
3143944
3143944
12
2.
.
(.., , ).
(pointer).
.
: (linked-list)
head
data next
data next
data next
231
NULL
13
:
head
data next
data next
data next
NULL
JAVA
class Node {
char data;
Node next;
}
Node n1, n2, n3;
n1.data='A';
n2.data='B';
n3.data='C';
n1.next=n2;
n2.next=n3;
n3.next=null;
Node
Address
data
next
n2
3143928
3143948
3143928
3143932
n1
3143936
3143940
3143944
n3
3143948
.
JAVA
*. JVM
231
14
;
Abu Jafar Mohammed ibn Musa l-Khowarizmi (790-840)
,
()
,
.
:
( ).
( ).
Wirth: + =
, ,
.
231
15
(.)
231
16
(.)
231
17
(selection problem)
: n
k- .
.. {5, 72, 3, 4, 1, 9, 65} (72,65,9,5,4,3,1)
2os 65, 6os 3, .
(the
selection problem). :
1. Sort-Based: n , a.
. (k-1) , a[k1].
2. Buffer-based: k a.
k=3
a={72,5,3}. , n-k :
a[k-1] ,
. ,
k- , a[k-1].
231
18
;
n=1,000,000 k=500,000
.
.
231
1-19
.
.
,
,
.
i)
ii)
, .
.
,
,
.
231
20
.
.
, .
.
. .
. .
Bit-. (hashing).
.
.
.
231
1-21
:
, .
,
.
.
.
.
.
Java.
231
1-22