SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Linked ListLinked List
고급게임알고리즘고급게임알고리즘
서진택 , jintaeks@gmail.com
동서대학교 , 디지털콘텐츠학부
2016 년 3 월
Presentation Outline
 Linked List
 Logarithm
 Binary Search Tree
 B-tree
2
Linked list
 a linear collection of data elements, called nodes
pointing to the next node by means of pointer.
 a data structure consisting of a group of nodes which 
together represent a sequence.
 can be used to implement several other common 
abstract data types, including lists (the abstract data 
type), stacks, queues.
 the list elements can easily be inserted or removed
without reallocation or reorganization of the entire
structure.
3
Advantages
 a dynamic data structure, which can grow and be
pruned, allocating and deallocating memory while the
program is running.
 Insertion and deletion node operations are easily
implemented in a linked list.
 Linear data structures such as stacks and queues are
easily executed with a linked list.
 the list elements can easily be inserted or removed
without reallocation or reorganization of the entire
structure.
4
Disadvantages
 They have a tendency to use more memory due to pointers
requiring extra storage space. 
 Nodes in a linked list must be read in order from the
beginning as linked lists are inherently 
sequential access.
 Nodes are stored incontiguously, greatly increasing
the time required to access individual elements within
the list.
5
Terms
 Each record of a linked list is often called an
'element' or 'node'.
 The field of each node that contains the address of
the next node is usually called the 'next link' or 'next
pointer'. The remaining fields are known as the 'data',
'information', 'value', 'cargo', or 'payload' fields.
 The 'head' of a list is its first node. The 'tail' of a
list may refer either to the rest of the list after
the head, or to the last node in the list.
6
head
tail
data next link
Singly linked list
 Singly linked lists contain nodes which have a data
field as well as a 'next' field, which points to the next
node in line of nodes.
 Operations that can be performed on singly linked
lists include insertion, deletion and traversal.
7
Doubly linked list
 each node contains, besides the next-node link, a second
link field pointing to the 'previous' node in the
sequence.
 The two links may be called 'forward('s') and
'backwards', or 'next' and 'prev'('previous').
 Many modern operating systems use doubly linked lists
to maintain references to active processes, threads,
and other dynamic objects.
 A common strategy for rootkits to evade detection is to 
unlink themselves from these lists.
8
Multiple linked list
 each node contains two or more link fields, each field
being used to connect the same set of data records in
a different order (e.g., by name, by department, by
date of birth, etc.).
9
Practice: Tree
 Implement a node for a tree data structure.
 a node can have zero or more child nodes.
10
 Root – The top node in a tree. 
 Child – A node directly connected to another node when 
moving away from the Root.
 Parent – The converse notion of a   child.
 Siblings – Nodes with the same parent. 
 Descendant – A node reachable by repeated proceeding 
from parent to child.
 Ancestor – A node reachable by repeated proceeding from 
child to parent.
 Leaf – A node with no children. 
 Internal node – A node with at least one child 
 External node – A node with no children. 
11
 Degree – Number of sub trees of a node. 
 Edge – Connection between one node to another. 
 Path – A sequence of nodes and edges connecting a node 
with a descendant.
 Level – The level of a node is defined by 1 + (the 
number of connections between the node and the root).
 Height of node – The height of a node is the number of 
edges on the longest downward path between that node
and a leaf.
 Height of tree – The height of a tree is the height of 
its root node.
12
 when node '6' is concerned;
 the degree is 2, number of child nodes.
 the path from root is '2''7''6'
 node '6' is at level 3.
13
child
sibling
parent
ancestor
descendent
 the height of a tree is 4.
14
leaf
Circular Linked list
 In the last node of a list, the link field often 
contains a null reference, a special value used to 
indicate the lack of further nodes.
 A less common convention is to make it point to the
first node of the list; in that case the list is said
to be 'circular' or 'circularly linked'; otherwise it is
said to be 'open' or 'linear'.
15
Sentinel nodes
 In some implementations an extra 'sentinel' or 'dummy'
node may be added before the first data record or
after the last one.
 This convention simplifies and accelerates some list-
handling algorithms, by ensuring that all links can be
safely dereferenced and that every list (even one that
contains no data elements) always has a "first" and
"last" node.
16
List handles
 Since a reference to the first node gives access to
the whole list, that reference is often called the
'address', 'pointer', or 'handle' of the list.
 Algorithms that manipulate linked lists usually get
such handles to the input lists and return the handles
to the resulting lists.
 In some situations, it may be convenient to refer to a
list by a handle that consists of two links, pointing
to its first and last nodes.
17
example: list handle
int main()
{
std::list<int> intList;
intList.assign({ 1, 3, 5 });
std::list<int>::iterator listHandle = intList.begin();
listHandle++; // listHandle indicates node '3'
intList.insert(listHandle, 9); // 1, 9, 3, 5 and listHandle indicates '3'
consistently
intList.insert(listHandle, 99); // 1, 9, 99, 3, 5
for (int c : intList) {
std::cout << c << 'n';
}
return 0;
}
18
example
int main()
{
std::list<int> intList;
intList.assign({ 1, 3, 5 });
std::list<int>::iterator listHandle = intList.begin();
listHandle++; // listHandle indicates node '3'
intList.insert(listHandle, 9); // 1, 9, 3, 5 and listHandle indicates '3'
consistently
intList.insert(listHandle, 99); // 1, 9, 99, 3, 5
for (int c : intList) {
std::cout << c << 'n';
}
return 0;
}
19
example
int main()
{
std::list<int> intList;
intList.assign({ 1, 3, 5 });
std::list<int>::iterator listHandle = intList.begin();
listHandle++; // listHandle indicates node '3'
intList.insert(listHandle, 9); // 1, 9, 3, 5 and listHandle indicates '3'
consistently
intList.insert(listHandle, 99); // 1, 9, 99, 3, 5
for (int c : intList) {
std::cout << c << 'n';
}
return 0;
}
20
Singly linked list
struct KNode
{
int data;
KNode* next;
};
InsertAfter( KNode* node, KNode* newNode);
21
Singly linked list
RemoveAfter( KNode* node);
22
Practice: simple linked list
 implement a KLinkedList which uses KNode.
 KLinkedList must support below methods:
– InsertAfter()
– RemoveAfter()
23
Linked lists vs. dynamic arrays
24
logarithm.
 In mathematics, the logarithm is the   inverse operation to   
exponentiation.
 That means the logarithm of a number is the exponent to 
which another fixed value, the base, must be raised to
produce that number.
 In simple cases the logarithm counts repeated
multiplication.
 For example, the base 10 logarithm of 1000 is 3, as 10 to           
the power 3 is 1000 (1000 = 10×10×10 = 10                3
); the
multiplication is repeated three times.
25
 The logarithm
of x to   base b, denoted
logb(x), is the unique
real number y such that 
 by
=   x.
 For example, as 64 = 
26
, we have log  2(64) = 6.
 The logarithm to
base 10 (that is     b = 10) is 
called the 
common logarithm and has 
many applications in
science and engineering.
26
 A full 3-ary tree can be used to visualize the
exponents of 3 and how the logarithm function relates
to them.
27
big O notation
 find node in a linked list.
– O(n)
 bubble sort.
– O(n2
)
 binary search.
– O(log(n))
28
Practice: skill inventory with timer
 In morpg game, we maintains skill inventories.
 When a skill is used, there is a delay time so we must
wait to reuse the skill again.
 We maintains skill nodes using a linked list.
 On each frame move, we must calculate expiring times
of all activated skill nodes in the skill inventory.
 implement skill inventory with efficient algorithm.
– modify KNode and KLinkedList.
29
Binary search tree
 Binary search requires that we have fast access to two
elements—specifically the median elements above and
below the given node.
 To combine these ideas, we need a “linked list” with
two pointers per node.
– This is the basic idea behind binary search trees.
 A rooted binary tree is recursively defined as either
being (1) empty, or (2) consisting of a node called
the root, together with two rooted binary trees called
the left and right subtrees, respectively.
30
 A binary search tree labels each node in a binary tree
with a single key such that for any node labeled x, all
nodes in the left subtree of x have keys < x while all
nodes in the right subtree of x have keys > x.
31
implementing binary search trees
typedef struct tree {
item_type item; // data item
struct tree* parent; // pointer to
parent
struct tree* left; // pointer to
left child
struct tree* right; // pointer to
right child
} tree;
32
searching in a tree
tree *search_tree(tree *l, item_type x)
{
if (l == NULL) return(NULL);
if (l->item == x) return(l);
if (x < l->item)
return( search_tree(l->left, x) );
else
return( search_tree(l->right, x) );
}
33
finding minimum element in a tree
tree *find_minimum(tree *t)
{
tree *min; // pointer to minimum
if (t == NULL) return(NULL);
min = t;
while (min->left != NULL)
min = min->left;
return(min);
}
34
traversing in a tree
void traverse_tree(tree *l)
{
if (l != NULL) {
traverse_tree(l->left);
process_item(l->item);
traverse_tree(l->right);
}
}
35
insertion in a tree
insert_tree(tree **l, item_type x, tree *parent)
{
tree *p; /* temporary pointer */
if (*l == NULL) {
p = malloc(sizeof(tree)); /* allocate new node */
p->item = x;
p->left = p->right = NULL;
p->parent = parent;
*l = p; /* link into parent’s record */
return;
}
if (x < (*l)->item)
insert_tree(&((*l)->left), x, *l);
else
insert_tree(&((*l)->right), x, *l);
}
36
deletion from a tree
37
How good are binary search trees?
 Unfortunately, bad things can happen when building
trees through insertion.
 The data structure has no control over the order of
insertion. Consider what happens if the user inserts
the keys in sorted order. The operations insert(a),
followed by insert(b), insert(c), insert(d), . . .
will produce a skinny linear height tree where only
right pointers are used.
38
B-tree
 In computer science, a   B-tree is a self-balancing tree   
data structure that keeps data sorted and allows 
searches, sequential access, insertions, and deletions
in logarithmic time. 
 The B-tree is a generalization of a binary search 
tree in that a node can have more than two children. 
39
 In B-trees, internal (non-leaf) nodes can have a
variable number of child nodes within some pre-defined
range. When data is inserted or removed from a node,
its number of child nodes changes. In order to
maintain the pre-defined range, internal nodes may be
joined or split.
 Each internal node of a B-tree will contain a number
of keys. The keys act as separation values which divide 
its subtrees. 
 For example, if an internal node has 3 child nodes (or
subtrees) then it must have 2 keys: a1 and   a2. All values
in the leftmost subtree will be less than a1, all
values in the middle subtree will be between a1 and  a2,
and all values in the rightmost subtree will be
greater than a2.40
Insertion
 If the node contains fewer than the maximum legal
number of elements, then there is room for the new
element. Insert the new element in the node, keeping
the node's elements ordered.
 Otherwise the node is full, evenly split it into two
nodes so:
– A single median is chosen from among the leaf's elements and
the new element.
– Values less than the median are put in the new left node and
values greater than the median are put in the new right node,
with the median acting as a separation value.
– The separation value is inserted in the node's parent, which may
cause it to be split, and so on(rule A). If the node has no
parent (i.e., the node was the root), create a new root above
this node (increasing the height of the tree)(rule B).
41
42
rule B applied for '2'
only rule A applied
rule B applied for '6'
Initial construction
 For example, if the leaf nodes have maximum size 4 and
the initial collection is the integers 1 through 24,
we would initially construct 4 leaf nodes containing 5
values each and 1 which contains 4 values:
 suppose the internal nodes contain at most 2 values (3
child pointers).
43
 We build the next level up from the leaves by taking
the last element from each leaf node except the last
one.
 Again, each node except the last will contain one
extra value. In the example, suppose the internal
nodes contain at most 2 values (3 child pointers).
44
 This process is continued until we reach a level with
only one node and it is not overfilled.
45
example: std::map
#include <iostream>
#include <map>
int main()
{
std::map<int,char> example = {{1,'a'},{2,'b'}};
auto search = example.find(2);
if(search != example.end()) {
std::cout << "Found " << search->first << " " << search->second
<< 'n';
}
else {
std::cout << "Not foundn";
}
}
46
References
 https://en.wikipedia.org/wiki/Linked_list
 https://en.wikipedia.org/wiki/B-tree
 Skiena, The Algorithm Design Manual
47

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure pptNalinNishant3
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search TreeShivam Singh
 
Ch13 Binary Search Tree
Ch13 Binary Search TreeCh13 Binary Search Tree
Ch13 Binary Search Treeleminhvuong
 
e computer notes - Binary search tree
e computer notes - Binary search treee computer notes - Binary search tree
e computer notes - Binary search treeecomputernotes
 
THREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREETHREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREESiddhi Shrivas
 
Binary Search Tree (BST)
Binary Search Tree (BST)Binary Search Tree (BST)
Binary Search Tree (BST)M Sajid R
 
data structure(tree operations)
data structure(tree operations)data structure(tree operations)
data structure(tree operations)Waheed Khalid
 
Binary tree and Binary search tree
Binary tree and Binary search treeBinary tree and Binary search tree
Binary tree and Binary search treeMayeesha Samiha
 
Data structure
Data structureData structure
Data structureMohd Arif
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Hassan Ahmed
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search TreeAbhishek L.R
 
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARIntroduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARBHARATH KUMAR
 
trees in data structure
trees in data structure trees in data structure
trees in data structure shameen khan
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueGhaffar Khan
 
Chapter 1( intro &amp; overview)
Chapter 1( intro &amp; overview)Chapter 1( intro &amp; overview)
Chapter 1( intro &amp; overview)MUHAMMAD AAMIR
 

Was ist angesagt? (20)

Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Ch13 Binary Search Tree
Ch13 Binary Search TreeCh13 Binary Search Tree
Ch13 Binary Search Tree
 
e computer notes - Binary search tree
e computer notes - Binary search treee computer notes - Binary search tree
e computer notes - Binary search tree
 
Binary trees
Binary treesBinary trees
Binary trees
 
THREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREETHREADED BINARY TREE AND BINARY SEARCH TREE
THREADED BINARY TREE AND BINARY SEARCH TREE
 
Binary Search Tree (BST)
Binary Search Tree (BST)Binary Search Tree (BST)
Binary Search Tree (BST)
 
data structure(tree operations)
data structure(tree operations)data structure(tree operations)
data structure(tree operations)
 
Binary tree and Binary search tree
Binary tree and Binary search treeBinary tree and Binary search tree
Binary tree and Binary search tree
 
Data structure
Data structureData structure
Data structure
 
Binary tree
Binary treeBinary tree
Binary tree
 
Tree - Data Structure
Tree - Data StructureTree - Data Structure
Tree - Data Structure
 
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...Data structure,abstraction,abstract data type,static and dynamic,time and spa...
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMARIntroduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
Introduction of Data Structures and Algorithms by GOWRU BHARATH KUMAR
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
Unit iv data structure-converted
Unit  iv data structure-convertedUnit  iv data structure-converted
Unit iv data structure-converted
 
Trees
TreesTrees
Trees
 
Chapter 1( intro &amp; overview)
Chapter 1( intro &amp; overview)Chapter 1( intro &amp; overview)
Chapter 1( intro &amp; overview)
 

Ähnlich wie 02 linked list_20160217_jintaekseo

Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data StructureJazz Jinia Bhowmik
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdfSulabhPawaia
 
1 list datastructures
1 list datastructures1 list datastructures
1 list datastructuresNguync91368
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEVenugopalavarma Raja
 
Data Structure and Algorithm Lesson 2.pptx
Data Structure and Algorithm Lesson 2.pptxData Structure and Algorithm Lesson 2.pptx
Data Structure and Algorithm Lesson 2.pptxJoannahClaireAlforqu
 
datastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptxdatastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptxAsthaChaurasia4
 
Static arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdfStatic arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdfanjanacottonmills
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptxssuserd2f031
 
Data structures introduction
Data structures   introductionData structures   introduction
Data structures introductionmaamir farooq
 
Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)pushpalathakrishnan
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm KristinaBorooah
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductionsirshad17
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfraji175286
 
Linked List Basics
Linked List BasicsLinked List Basics
Linked List BasicsKaustavRoy40
 

Ähnlich wie 02 linked list_20160217_jintaekseo (20)

Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
 
Data Structure
Data StructureData Structure
Data Structure
 
Data structure
 Data structure Data structure
Data structure
 
1 list datastructures
1 list datastructures1 list datastructures
1 list datastructures
 
csc211_lecture_21.pptx
csc211_lecture_21.pptxcsc211_lecture_21.pptx
csc211_lecture_21.pptx
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
 
Data Structure and Algorithm Lesson 2.pptx
Data Structure and Algorithm Lesson 2.pptxData Structure and Algorithm Lesson 2.pptx
Data Structure and Algorithm Lesson 2.pptx
 
datastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptxdatastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptx
 
Static arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdfStatic arrays are structures whose size is fixed at compile time and.pdf
Static arrays are structures whose size is fixed at compile time and.pdf
 
Linked List
Linked ListLinked List
Linked List
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
3.ppt
3.ppt3.ppt
3.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
Data structures introduction
Data structures   introductionData structures   introduction
Data structures introduction
 
Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdf
 
Linked List Basics
Linked List BasicsLinked List Basics
Linked List Basics
 

Mehr von JinTaek Seo

Neural network 20161210_jintaekseo
Neural network 20161210_jintaekseoNeural network 20161210_jintaekseo
Neural network 20161210_jintaekseoJinTaek Seo
 
05 heap 20161110_jintaeks
05 heap 20161110_jintaeks05 heap 20161110_jintaeks
05 heap 20161110_jintaeksJinTaek Seo
 
Hermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksHermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksJinTaek Seo
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seoJinTaek Seo
 
03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksBeginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksBeginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksBeginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksBeginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...JinTaek Seo
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksJinTaek Seo
 
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksBeginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksBeginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksBeginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksBeginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksJinTaek Seo
 
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksBeginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksJinTaek Seo
 

Mehr von JinTaek Seo (20)

Neural network 20161210_jintaekseo
Neural network 20161210_jintaekseoNeural network 20161210_jintaekseo
Neural network 20161210_jintaekseo
 
05 heap 20161110_jintaeks
05 heap 20161110_jintaeks05 heap 20161110_jintaeks
05 heap 20161110_jintaeks
 
Hermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeksHermite spline english_20161201_jintaeks
Hermite spline english_20161201_jintaeks
 
01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo01 stack 20160908_jintaek_seo
01 stack 20160908_jintaek_seo
 
03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks03 fsm how_toimplementai_state_20161006_jintaeks
03 fsm how_toimplementai_state_20161006_jintaeks
 
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeksBeginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
Beginning direct3d gameprogramming10_shaderdetail_20160506_jintaeks
 
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeksBeginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
Beginning direct3d gameprogramming09_shaderprogramming_20160505_jintaeks
 
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeksBeginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
Beginning direct3d gameprogramming08_usingtextures_20160428_jintaeks
 
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeksBeginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
Beginning direct3d gameprogramming07_lightsandmaterials_20161117_jintaeks
 
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeksBeginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
Beginning direct3d gameprogramming06_firststepstoanimation_20161115_jintaeks
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
 
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeksBeginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
Beginning direct3d gameprogramming04_3dfundamentals_20160414_jintaeks
 
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeksBeginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
Beginning direct3d gameprogramming02_overviewofhalandcom_20160408_jintaeks
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
 
Beginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeksBeginning direct3d gameprogramming01_20161102_jintaeks
Beginning direct3d gameprogramming01_20161102_jintaeks
 
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeksBeginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
Beginning direct3d gameprogramming03_programmingconventions_20160414_jintaeks
 
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeksBeginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
Beginning direct3d gameprogrammingmath06_transformations_20161019_jintaeks
 
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeksBeginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
Beginning direct3d gameprogrammingmath05_matrices_20160515_jintaeks
 
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeksBeginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
Beginning direct3d gameprogrammingmath04_calculus_20160324_jintaeks
 
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeksBeginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
Beginning direct3d gameprogrammingmath03_vectors_20160328_jintaeks
 

Kürzlich hochgeladen

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 

Kürzlich hochgeladen (20)

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 

02 linked list_20160217_jintaekseo

  • 1. Linked ListLinked List 고급게임알고리즘고급게임알고리즘 서진택 , jintaeks@gmail.com 동서대학교 , 디지털콘텐츠학부 2016 년 3 월
  • 2. Presentation Outline  Linked List  Logarithm  Binary Search Tree  B-tree 2
  • 3. Linked list  a linear collection of data elements, called nodes pointing to the next node by means of pointer.  a data structure consisting of a group of nodes which  together represent a sequence.  can be used to implement several other common  abstract data types, including lists (the abstract data  type), stacks, queues.  the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure. 3
  • 4. Advantages  a dynamic data structure, which can grow and be pruned, allocating and deallocating memory while the program is running.  Insertion and deletion node operations are easily implemented in a linked list.  Linear data structures such as stacks and queues are easily executed with a linked list.  the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure. 4
  • 5. Disadvantages  They have a tendency to use more memory due to pointers requiring extra storage space.   Nodes in a linked list must be read in order from the beginning as linked lists are inherently  sequential access.  Nodes are stored incontiguously, greatly increasing the time required to access individual elements within the list. 5
  • 6. Terms  Each record of a linked list is often called an 'element' or 'node'.  The field of each node that contains the address of the next node is usually called the 'next link' or 'next pointer'. The remaining fields are known as the 'data', 'information', 'value', 'cargo', or 'payload' fields.  The 'head' of a list is its first node. The 'tail' of a list may refer either to the rest of the list after the head, or to the last node in the list. 6 head tail data next link
  • 7. Singly linked list  Singly linked lists contain nodes which have a data field as well as a 'next' field, which points to the next node in line of nodes.  Operations that can be performed on singly linked lists include insertion, deletion and traversal. 7
  • 8. Doubly linked list  each node contains, besides the next-node link, a second link field pointing to the 'previous' node in the sequence.  The two links may be called 'forward('s') and 'backwards', or 'next' and 'prev'('previous').  Many modern operating systems use doubly linked lists to maintain references to active processes, threads, and other dynamic objects.  A common strategy for rootkits to evade detection is to  unlink themselves from these lists. 8
  • 9. Multiple linked list  each node contains two or more link fields, each field being used to connect the same set of data records in a different order (e.g., by name, by department, by date of birth, etc.). 9
  • 10. Practice: Tree  Implement a node for a tree data structure.  a node can have zero or more child nodes. 10
  • 11.  Root – The top node in a tree.   Child – A node directly connected to another node when  moving away from the Root.  Parent – The converse notion of a   child.  Siblings – Nodes with the same parent.   Descendant – A node reachable by repeated proceeding  from parent to child.  Ancestor – A node reachable by repeated proceeding from  child to parent.  Leaf – A node with no children.   Internal node – A node with at least one child   External node – A node with no children.  11
  • 12.  Degree – Number of sub trees of a node.   Edge – Connection between one node to another.   Path – A sequence of nodes and edges connecting a node  with a descendant.  Level – The level of a node is defined by 1 + (the  number of connections between the node and the root).  Height of node – The height of a node is the number of  edges on the longest downward path between that node and a leaf.  Height of tree – The height of a tree is the height of  its root node. 12
  • 13.  when node '6' is concerned;  the degree is 2, number of child nodes.  the path from root is '2''7''6'  node '6' is at level 3. 13 child sibling parent ancestor descendent
  • 14.  the height of a tree is 4. 14 leaf
  • 15. Circular Linked list  In the last node of a list, the link field often  contains a null reference, a special value used to  indicate the lack of further nodes.  A less common convention is to make it point to the first node of the list; in that case the list is said to be 'circular' or 'circularly linked'; otherwise it is said to be 'open' or 'linear'. 15
  • 16. Sentinel nodes  In some implementations an extra 'sentinel' or 'dummy' node may be added before the first data record or after the last one.  This convention simplifies and accelerates some list- handling algorithms, by ensuring that all links can be safely dereferenced and that every list (even one that contains no data elements) always has a "first" and "last" node. 16
  • 17. List handles  Since a reference to the first node gives access to the whole list, that reference is often called the 'address', 'pointer', or 'handle' of the list.  Algorithms that manipulate linked lists usually get such handles to the input lists and return the handles to the resulting lists.  In some situations, it may be convenient to refer to a list by a handle that consists of two links, pointing to its first and last nodes. 17
  • 18. example: list handle int main() { std::list<int> intList; intList.assign({ 1, 3, 5 }); std::list<int>::iterator listHandle = intList.begin(); listHandle++; // listHandle indicates node '3' intList.insert(listHandle, 9); // 1, 9, 3, 5 and listHandle indicates '3' consistently intList.insert(listHandle, 99); // 1, 9, 99, 3, 5 for (int c : intList) { std::cout << c << 'n'; } return 0; } 18
  • 19. example int main() { std::list<int> intList; intList.assign({ 1, 3, 5 }); std::list<int>::iterator listHandle = intList.begin(); listHandle++; // listHandle indicates node '3' intList.insert(listHandle, 9); // 1, 9, 3, 5 and listHandle indicates '3' consistently intList.insert(listHandle, 99); // 1, 9, 99, 3, 5 for (int c : intList) { std::cout << c << 'n'; } return 0; } 19
  • 20. example int main() { std::list<int> intList; intList.assign({ 1, 3, 5 }); std::list<int>::iterator listHandle = intList.begin(); listHandle++; // listHandle indicates node '3' intList.insert(listHandle, 9); // 1, 9, 3, 5 and listHandle indicates '3' consistently intList.insert(listHandle, 99); // 1, 9, 99, 3, 5 for (int c : intList) { std::cout << c << 'n'; } return 0; } 20
  • 21. Singly linked list struct KNode { int data; KNode* next; }; InsertAfter( KNode* node, KNode* newNode); 21
  • 23. Practice: simple linked list  implement a KLinkedList which uses KNode.  KLinkedList must support below methods: – InsertAfter() – RemoveAfter() 23
  • 24. Linked lists vs. dynamic arrays 24
  • 25. logarithm.  In mathematics, the logarithm is the   inverse operation to    exponentiation.  That means the logarithm of a number is the exponent to  which another fixed value, the base, must be raised to produce that number.  In simple cases the logarithm counts repeated multiplication.  For example, the base 10 logarithm of 1000 is 3, as 10 to            the power 3 is 1000 (1000 = 10×10×10 = 10                3 ); the multiplication is repeated three times. 25
  • 26.  The logarithm of x to   base b, denoted logb(x), is the unique real number y such that   by =   x.  For example, as 64 =  26 , we have log  2(64) = 6.  The logarithm to base 10 (that is     b = 10) is  called the  common logarithm and has  many applications in science and engineering. 26
  • 27.  A full 3-ary tree can be used to visualize the exponents of 3 and how the logarithm function relates to them. 27
  • 28. big O notation  find node in a linked list. – O(n)  bubble sort. – O(n2 )  binary search. – O(log(n)) 28
  • 29. Practice: skill inventory with timer  In morpg game, we maintains skill inventories.  When a skill is used, there is a delay time so we must wait to reuse the skill again.  We maintains skill nodes using a linked list.  On each frame move, we must calculate expiring times of all activated skill nodes in the skill inventory.  implement skill inventory with efficient algorithm. – modify KNode and KLinkedList. 29
  • 30. Binary search tree  Binary search requires that we have fast access to two elements—specifically the median elements above and below the given node.  To combine these ideas, we need a “linked list” with two pointers per node. – This is the basic idea behind binary search trees.  A rooted binary tree is recursively defined as either being (1) empty, or (2) consisting of a node called the root, together with two rooted binary trees called the left and right subtrees, respectively. 30
  • 31.  A binary search tree labels each node in a binary tree with a single key such that for any node labeled x, all nodes in the left subtree of x have keys < x while all nodes in the right subtree of x have keys > x. 31
  • 32. implementing binary search trees typedef struct tree { item_type item; // data item struct tree* parent; // pointer to parent struct tree* left; // pointer to left child struct tree* right; // pointer to right child } tree; 32
  • 33. searching in a tree tree *search_tree(tree *l, item_type x) { if (l == NULL) return(NULL); if (l->item == x) return(l); if (x < l->item) return( search_tree(l->left, x) ); else return( search_tree(l->right, x) ); } 33
  • 34. finding minimum element in a tree tree *find_minimum(tree *t) { tree *min; // pointer to minimum if (t == NULL) return(NULL); min = t; while (min->left != NULL) min = min->left; return(min); } 34
  • 35. traversing in a tree void traverse_tree(tree *l) { if (l != NULL) { traverse_tree(l->left); process_item(l->item); traverse_tree(l->right); } } 35
  • 36. insertion in a tree insert_tree(tree **l, item_type x, tree *parent) { tree *p; /* temporary pointer */ if (*l == NULL) { p = malloc(sizeof(tree)); /* allocate new node */ p->item = x; p->left = p->right = NULL; p->parent = parent; *l = p; /* link into parent’s record */ return; } if (x < (*l)->item) insert_tree(&((*l)->left), x, *l); else insert_tree(&((*l)->right), x, *l); } 36
  • 37. deletion from a tree 37
  • 38. How good are binary search trees?  Unfortunately, bad things can happen when building trees through insertion.  The data structure has no control over the order of insertion. Consider what happens if the user inserts the keys in sorted order. The operations insert(a), followed by insert(b), insert(c), insert(d), . . . will produce a skinny linear height tree where only right pointers are used. 38
  • 39. B-tree  In computer science, a   B-tree is a self-balancing tree    data structure that keeps data sorted and allows  searches, sequential access, insertions, and deletions in logarithmic time.   The B-tree is a generalization of a binary search  tree in that a node can have more than two children.  39
  • 40.  In B-trees, internal (non-leaf) nodes can have a variable number of child nodes within some pre-defined range. When data is inserted or removed from a node, its number of child nodes changes. In order to maintain the pre-defined range, internal nodes may be joined or split.  Each internal node of a B-tree will contain a number of keys. The keys act as separation values which divide  its subtrees.   For example, if an internal node has 3 child nodes (or subtrees) then it must have 2 keys: a1 and   a2. All values in the leftmost subtree will be less than a1, all values in the middle subtree will be between a1 and  a2, and all values in the rightmost subtree will be greater than a2.40
  • 41. Insertion  If the node contains fewer than the maximum legal number of elements, then there is room for the new element. Insert the new element in the node, keeping the node's elements ordered.  Otherwise the node is full, evenly split it into two nodes so: – A single median is chosen from among the leaf's elements and the new element. – Values less than the median are put in the new left node and values greater than the median are put in the new right node, with the median acting as a separation value. – The separation value is inserted in the node's parent, which may cause it to be split, and so on(rule A). If the node has no parent (i.e., the node was the root), create a new root above this node (increasing the height of the tree)(rule B). 41
  • 42. 42 rule B applied for '2' only rule A applied rule B applied for '6'
  • 43. Initial construction  For example, if the leaf nodes have maximum size 4 and the initial collection is the integers 1 through 24, we would initially construct 4 leaf nodes containing 5 values each and 1 which contains 4 values:  suppose the internal nodes contain at most 2 values (3 child pointers). 43
  • 44.  We build the next level up from the leaves by taking the last element from each leaf node except the last one.  Again, each node except the last will contain one extra value. In the example, suppose the internal nodes contain at most 2 values (3 child pointers). 44
  • 45.  This process is continued until we reach a level with only one node and it is not overfilled. 45
  • 46. example: std::map #include <iostream> #include <map> int main() { std::map<int,char> example = {{1,'a'},{2,'b'}}; auto search = example.find(2); if(search != example.end()) { std::cout << "Found " << search->first << " " << search->second << 'n'; } else { std::cout << "Not foundn"; } } 46

Hinweis der Redaktion

  1. the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure because the data items need not be stored contiguously in memory.
  2. The order among “brother” nodes matters in rooted trees, so left is different from right. Figure 3.2 gives the shapes of the five distinct binary trees that can be formed on three nodes.
  3. This search tree labeling scheme is very special. For any binary tree on n nodes, and any set of n keys, there is exactly one labeling that makes it a binary search tree. The allowable labelings for three-node trees are given in Figure 3.2.
  4. There are three cases, illustrated in Figure 3.4. Leaf nodes have no children, and so may be deleted by simply clearing the pointer to the given node. The case of the doomed node having one child is also straightforward. There is one parent and one grandchild, and we can link the grandchild directly to the parent without violating the in-order labeling property of the tree. But what of a to-be-deleted node with two children? Our solution is to relabel this node with the key of its immediate successor in sorted order. This successor must be the smallest value in the right subtree, specifically the leftmost descendant in the right subtree (p). Moving this to the point of deletion results in a properlylabeled binary search tree, and reduces our deletion problem to physically removing a node with at most one child—a case that has been resolved above. The full implementation has been omitted here because it looks a little ghastly, but the code follows logically from the description above. The worst-case complexity analysis is as follows. Every deletion requires the cost of at most two search operations, each taking O(h) time where h is the height of the tree, plus a constant amount of pointer manipulation.
  5. Unlike self-balancing binary search trees, the B-tree is optimized for systems that read and write large blocks of data. B-trees are a good example of a data structure for external memory. It is commonly used in databases and filesystems.