Binary apple tree: A game approach to tree traversal algorithms

2 downloads 0 Views 1MB Size Report
Traversal Algorithms. Zehra KARAPINAR. Computer Engineering Dep. Faculty of Engineering, Duzce University. Duzce, Turkey zehrakarapinar@duzce.edu.tr.
Binary Apple Tree: A Game Approach to Tree Traversal Algorithms Zehra KARAPINAR

Sultan ZAVRAK

Computer Engineering Dep. Faculty of Engineering, Duzce University Duzce, Turkey [email protected]

Computer Engineering Dep. Faculty of Engineering, Duzce University Duzce, Turkey [email protected]

Arafat SENTURK

Resul KARA

Computer Engineering Dep. Faculty of Engineering, Duzce University Duzce, Turkey [email protected]

Computer Engineering Dep. Faculty of Engineering, Duzce University Duzce, Turkey [email protected]

Pakize ERDOGMUS Computer Engineering Dep. Faculty of Engineering, Duzce University Duzce, Turkey [email protected] Abstract— The computer science students mostly face with the difficulties in learning the topics of algorithms courses. Only listening the topic from the teacher or just writing makes the learning volatile. Instead of listening or writing, if there is something visual, it would be more permanent to learn because visuality increases the learning potential and the time for learning is minimized. The adversities of classical education techniques were intended to be eliminated in this study via computer games which are becoming more and more popular in this age. An educational convenience is provided for the subject of tree traversal algorithms. Tree traversal algorithms are one of the basic and confused concepts in algorithms and programming courses in computer science. A game called “binary apple tree” was established to teach and learn the subject easier. Keywords- tree traversal algorithms, serious games, computer education with games

I.

INTRODUCTION

Games are started to be played since very small ages. Children learn many things from the games. In fact, the game writers mostly aim to teach something to their players. Obligatory written or verbal teaching may result in difficulties in understanding for the children. They learn later and harder in this case, but instead of classical teaching methods, if they are tried to be taught via games, both the learners learn easier and they learn in a short period of time. This is better also for teachers in terms of teaching ease. Preferring games instead of other teaching methods is a general and inborn behavior of human beings. When we are a baby we prefer having our meal

with a game, but not directly and obligatorily. If the mum plays a game with the food, we eat. Else if there is no game, we hardly eat. So, games make something easier. This situation is the same for the students. If an instructor explains a topic just by writing to the whiteboard or just verbally, teaching does not become efficient enough. In fact, if the topic is also a complex one, the students completely wander away from the subject. As a novel approach to teaching, we offer a game for teaching tree traversal algorithms. These algorithms stand for analyzing binary trees. For instance, a tree traversal algorithm may help one to find the maximum element in the tree or the length of the tree, i.e. the number of elements in that tree. To understand those algorithms is often complex and boring for the students who first face with the related course including binary trees. Most of the students try to memorize the algorithms before examinations and they forget them after some days. The purpose of this paper is to make tree traversal algorithms learn easier and permanently. A game called Binary Apple Tree was served to the students and the algorithms were aimed to be taught more enjoyably. In the literature there are many studies related to simplify teaching with games. In [1], a game was made for facilitating data structures course. Two data structures that are stacks and queues are visualized. In [2], the principles of distributed systems were aimed to teach by taking the advantage of game design and implementation. A tangible game-based learning system for Worldwide Interoperability for Microwave Access (WIMAX) Cell Design problem with Erceg model is developed in [3]. A tangible interface that can be used as a learning tool and an interactive platform for the students, learners and educators was created. [4] is again a game called

978-1-4673-2334-5/12/$31.00 ©2012 IEEE

ShapeMaker which utilizes a table-based tactile interface that bridges physical actions with digital results and allows its players to learn basic concepts of programming by playing a card game. [5] gives a game approach to make easier to learn/teach object-oriented concepts and programming. II.

BINARY APPLE TREE

This paper has been prepared for both the students and the instructors to make them understand/explain binary trees as easy and enjoyable as possible. A. Tree Traversal Algorithms To understand what the binary tree algorithms are, let us first define what a binary tree is. A binary tree in computer science is a data structure in which each and every node has at most two child nodes distinguished as left or right. Ancestor of all nodes is called as root and any node in the tree can be reached by starting from the root and following the references either through the left or right child. Binary trees are used to implement binary search trees and binary heaps. The purpose why we traverse along a binary tree is to examine each of its nodes. There are many traversal algorithms constituted for binary trees. The nodes of a tree may be examined to find the largest element or to count the number of elements in the tree, for example. Tree traversal algorithms are first divided into two main groups as breath-first and depth-first. In depth-first algorithms we move along the branches of the tree while we move level by level in breath-first search. Depth first search has three different traversals- inorder, preorder, postorder. In inorder traversal we first visit the left child, and then the root, and lastly the right child. Root, left child, and right child are visited respectively in preorder traversal. Lastly, to traverse as postorder, root is visited after the child nodes are visited and left child is visited before the right child.

Figure 1. Print screen of the game

2) How To Play In the first step, when the user opens the game the computer plays the game according to the option chosen. Then, the user starts playing. The user first chooses whether to traverse breath-first or depth-first. If he/she selects depth-first traversal, he is asked to choose inorder, preorder, or postorder. According to the choice, binary apple tree game starts. Nodes of a binary tree are visualized as apples and the tree as a real apple tree. There are some numbers on the apples as contents of nodes. User of the game is the one who collects apples from the tree based on the options chosen before the game starts. User collects apples and throws them to a wicker basket. Apples drop to this wicker basket on end. Basket here plays the role of stack data structure. After the user collects every apple in the tree, the apples are checked whether they are collected in the right order. If so, the user wins the game. Otherwise, he/she loses and advised to review the algorithms.

Breath-first traversal, known as level order traversal, is some more different than depth-first traversal. Instead of following the branches of the tree, the levels of the tree are visited. A first-in-first-out queue data structure is used to implement level order traversal. B. Game Information 1) Development Platform We have prepared our game with GameMaker provided by Yo Yo Games. Interfaces of GameMaker are quite easy to understand. Game environment was constituted with drag and drop operations. Good tutorials were provided. We form first our room, i.e. interface of our game, and then we created the objects and actions. It is seen as the following:

Figure 2. Winner’s screen here!

Figure 3. Loser’s screen

III.

METHODOLOGY

Figure 4. A Sample Tree

We present the methodology of the study related to a game called “Binary Apple Tree” that we established for tree traversal algorithms in this part of the paper.

2.

Find the maximum and minimum elements of the tree above. IV.

A. Sample Space To realize our purpose we set up two subsets among the first year Computer Engineering students of Duzce University. Groups consist of 10 students. These two groups are proved to be identical by an examination applied. The prepared game have been given to the first group and a classical education related to tree traversal algorithms have been given to the second group of the students. These students have learnt tree traversal algorithms properly and permanently. B. Procedure The topic “binary tree traversal algorithms” is a one-week subject. During a week, education in two styles- classical and with game- has been given to two groups. In the classical education, just verbal and written content served to the students and in the second group, after a brief explanation about the topic, the prepared game has been given them. They were asked to play the game. After both activities were over, an examination related to tree traversal algorithms was given to the students in two groups. The purpose of exposing both groups to the same examination was to compare the learning performances of them. Some of the exam questions are the followings: 1.

Considering the below binary search tree, perform inorder, preorder, and postorder traversals and write down the appearances of stacks after each traversals.

RESULTS

The answers of the students to the examination mentioned above are checked and compared as groups. At the end of the examination results, we have seen that the performance of the students who have been subjected to a new teaching method for tree traversal algorithms was better. On the average, the students who are exposed to the classical education have been taken 62 and the students who are exposed to the education with game have been taken 83. Therefore, our proposal is quite beneficial for the students and the teachers since it simplifies learning/teaching and shortens learning/teaching time as understood from the exam. REFERENCES [1]

[2]

[3]

[4]

[5]

Bing Tan; Jet Lim Kim Seng; , "Game-based Learning for Data Structures: A case study," Computer Engineering and Technology (ICCET), 2010 2nd International Conference on , vol.6, no., pp.V6-718V6-721, 16-18 April 2010. Amoroso, A.; Marfia, G.; , "P-2-P games for computer science," Multimedia and Expo (ICME), 2010 IEEE International Conference on , vol., no., pp.1382-1386, 19-23 July 2010. Mohebzada, J.G.; Bhojani, A.H.; , "The cubes: A tangible game-based learning system," Innovations in Information Technology (IIT), 2011 International Conference on , vol., no., pp.179-184, 25-27 April 2011. Masso, N.; Grace, L.; , "Shapemaker: A game-based introduction to programming," Computer Games (CGAMES), 2011 16th International Conference on , vol., no., pp.168-171, 27-30 July 2011. Rais, A.E.; Sulaiman, S.; Syed-Mohamad, S.M.; , "Game-based approach and its feasibility to support the learning of object-oriented concepts and programming," Software Engineering (MySEC), 2011 5th Malaysian Conference in , vol., no., pp.307-312, 13-14 Dec. 2011.