Academia.edu no longer supports Internet Explorer.
To browse Academia.edu and the wider internet faster and more securely, please take a few seconds to upgrade your browser.
2015, International Journal of Advanced Computer Science and Applications
…
6 pages
1 file
Study of binary trees has prominent place in the training course of DSA (Data Structures and Algorithms). Their implementation in C++ however is traditionally difficult for students. To a large extent these difficulties are due not so much to the complexity of algorithms as to language complexity in terms of memory management by raw pointersthe programmer must consider too many details to ensure a reliable, efficient and secure implementation. Evolution of C++ regarded to automated resource management, as well as experience in implementation of linear lists by means of C++ 11/14 lead to an attempt to implement binary search trees (BST) via smart pointers as well. In the present paper, the authors share experience in this direction. Some conclusions about pedagogical aspects and effectiveness of the new classes, compared to traditional library containers and implementation with built-in pointers, are made.
2008
By applying object-oriented design to the definition of a binary search tree, Berman and Duvall [1] designed a data structure comprised of three classes: (i) an EmptyBST class to model empty binary search trees, (ii) a NonEmptyBST class to model non-empty binary search trees, and (iii) a BST base class for common attributes of EmptyBST and NonEmptyBST objects. That paper noted the problem of inserting new values into such a structure: since insertions occur at an EmptyBST object, an EmptyBST would have to "turn into " a NonEmptyBST; a behavior beyond the capabilities of the classes in most languages. This paper presents three C++ solutions to the insertion problem in their order of development. The first solution uses a procedural programming technique, with the second and third solutions shifting to a more object-oriented approach. This chronology illustrates the author's ongoing battle to shift from procedural to object-oriented thinking.
ACM SIGCSE Bulletin, 1996
By applying object-oriented design to the definition of a binary search tree, Berman and Duvall [1] designed a data structure comprised of three classes: (i) an EmptyBST class to model empty binary search trees, (ii) a NonEmptyBST class to model non-empty binary search trees, and (iii) a BST base class for common attributes of EmptyBST and NonEmptyBST objects. That paper noted the problem of inserting new values into such a structure: since insertions occur at an EmptyBST object, an EmptyBST would have to "turn into" a NonEmptyBST; a behavior beyond the capabilities of the classes in most languages.
1974
This project documents the results of an investigation into binary search trees. Because of their favourable characteristics binary search trees have become popular for information storage and retrieval applications in a one level store. The trees may be of two types, weighted and unweighted. Various algorithms are presented, in a machine independent context, for both types and an empirical evaluation is performed. An important software aid used for graphically displaying a binary tree is also described.
ACM SIGCSE Bulletin, 1996
The Binary Search Tree serves as an important example when teaching data structures. We explore new approaches to understanding the implementation of a Binary Search Tree, using concepts from Object-Oriented Programming and C++. The Binary Search Tree illustrates how adopting a new approach and a new language can lead to a new way of thinking about a familiar problem.
2004
Database indexes are the search engines for database management systems. The B+-tree is one of the most widely used data structures and provides an efficient index. An efficient implementation is crucial for a B+tree index. Our B+-tree index is designed to be a container in the style of the C++ Standard Template Library (STL) and implemented efficiently using design patterns and generic programming techniques.
2007
Preface functions and complete programs of substantial length. The exercises and programming projects, moreover, constitute an indispensable part of the book. Many of these are immediate applications of the topic under study, often requesting that programs be written and run, so that algorithms may be tested and compared. Some are larger projects, and a few are suitable for use by a small group of students working together. Our programs are written in the popular object-oriented language C++. We take the view that many object-oriented techniques provide natural implementations for basic principles of data-structure design. In this way, C++ allows us to construct safe, efficient, and simple implementations of data-structures. We recognize that C++ is sufficiently complex that students will need to use the experience of a data structures courses to develop and refine their understanding of the language. We strive to support this development by carefully introducing and explaining various object-oriented features of C++ as we progress through the book. Thus, we begin Chapter 1 assuming that the reader is comfortable with the elementary parts of C++ (essentially, with the C subset), and gradually we add in such object-oriented elements of C++ as classes, methods, constructors, inheritance, dynamic memory management, destructors, copy constructors, overloaded functions and operations, templates, virtual functions, and the STL. Of course, our primary focus is on the data structures themselves, and therefore students with relatively little familiarity with C++ will need to supplement this text with a C++ programming text. SYNOPSIS By working through the first large project (CONWAY's game of Life), Chapter 1 Programming Principles expounds principles of object-oriented program design, top-down refinement, review, and testing, principles that the student will see demonstrated and is expected to follow throughout the sequel. At the same time, this project provides an opportunity for the student to review the syntax of elementary features of C++, the programming language used throughout the book. Chapter 2 introduces the first data structure we study, the stack. The chapter Preface • Synopsis xiii destructors, copy constructors, and overloaded assignment operators, all of which are needed in the safe C++ implementation of linked structures. Chapter 5 continues to elucidate stacks by studying their relationship to prob-Recursion lem solving and programming with recursion. These ideas are reinforced by exploring several substantial applications of recursion, including backtracking and tree-structured programs. This chapter can, if desired, be studied earlier in a course than its placement in the book, at any time after the completion of Chapter 2. More general lists with their linked and contiguous implementations provide Lists and Strings the theme for Chapter 6. The chapter also includes an encapsulated string implementation, an introduction to C++ templates, and an introduction to algorithm analysis in a very informal way. Chapter 7, Chapter 8, and Chapter 9 present algorithms for searching, sorting, Searching and table access (including hashing), respectively. These chapters illustrate the interplay between algorithms and the associated abstract data types, data struc-Sorting tures, and implementations. The text introduces the "big-O " and related notations for elementary algorithm analysis and highlights the crucial choices to be made regarding best use of space, time, and programming effort. These choices require Tables and Information Retrieval that we find analytical methods to assess algorithms, and producing such analyses is a battle for which combinatorial mathematics must provide the arsenal. At an elementary level we can expect students neither to be well armed nor to possess the mathematical maturity needed to hone their skills to perfection. Our goal, therefore, is to help students recognize the importance of such skills in anticipation of later chances to study mathematics. Binary trees are surely among the most elegant and useful of data structures. Their study, which occupies Chapter 10, ties together concepts from lists, searching, Binary Trees and sorting. As recursively defined data structures, binary trees afford an excellent opportunity for the student to become comfortable with recursion applied both to data structures and algorithms. The chapter begins with elementary topics and progresses as far as such advanced topics as splay trees and amortized algorithm analysis. Chapter 11 continues the study of more sophisticated data structures, including Multiway Trees tries, B-trees, and red-black trees. Chapter 12 introduces graphs as more general structures useful for problem Graphs solving, and introduces some of the classical algorithms for shortest paths and minimal spanning trees in graphs. The case study in Chapter 13 examines the Polish notation in considerable detail, exploring the interplay of recursion, trees, and stacks as vehicles for problem Case Study: The Polish Notation solving and algorithm development. Some of the questions addressed can serve as an informal introduction to compiler design. As usual, the algorithms are fully developed within a functioning C++ program. This program accepts as input an expression in ordinary (infix) form, translates the expression into postfix form, and evaluates the expression for specified values of the variable(s). Chapter 13 may be studied anytime after the completion of Section 10.1. The appendices discuss several topics that are not properly part of the book's subject but that are often missing from the student's preparation. Appendix A presents several topics from discrete mathematics. Its final two Mathematical Methods sections, Fibonacci numbers amd Catalan numbers, are more advanced and not xiv Preface needed for any vital purpose in the text, but are included to encourage combinatorial interest in the more mathematically inclined. Appendix B discusses pseudorandom numbers, generators, and applications, Random Numbers a topic that many students find interesting, but which often does not fit anywhere in the curriculum. Appendix C catalogues the various utility and data-structure packages that are Packages and Utility Functions developed and used many times throughout this book. Appendix C discusses declaration and definition files, translation units, the utility package used throughout the book, and a package for calculating CPU times. Appendix D, finally, collects all the Programming Precepts and all the Pointers Programming Precepts, Pointers, and Pitfalls and Pitfalls scattered through the book and organizes them by subject for convenience of reference. COURSE STRUCTURE The prerequisite for this book is a first course in programming, with experience prerequisite using the elementary features of C++. However, since we are careful to introduce sophisticated C++ techniques only gradually, we believe that, used in conjunction with a supplementary C++ textbook and extra instruction and emphasis on C++ language issues, this text provides a data structures course in C++ that remains suitable even for students whose programming background is in another language such as C, Pascal, or Java. A good knowledge of high school mathematics will suffice for almost all the algorithm analyses, but further (perhaps concurrent) preparation in discrete mathematics will prove valuable. Appendix A reviews all required mathematics. This book is intended for courses such as the ACM Course CS2 (Program Design content and Implementation), ACM Course CS7 (Data Structures and Algorithm Analysis), or a course combining these. Thorough coverage is given to most of the ACM/IEEE knowledge units 1 on data structures and algorithms. These include: AL1 Basic data structures, such as arrays, tables, stacks, queues, trees, and graphs; AL2 Abstract data types; AL3 Recursion and recursive algorithms; AL4 Complexity analysis using the big Oh notation; AL6 Sorting and searching; and AL8 Practical problem-solving strategies, with large case studies. The three most advanced knowledge units, AL5 (complexity classes, NP-complete problems), AL7 (computability and undecidability), and AL9 (parallel and distributed algorithms) are not treated in this book.
2015
— To perform Binary Search based on Divide and Conquer Algorithm, determination middle element of a series of elements is necessary. But memory allocation for a singly linked list is dynamic and not contiguous. Hence, determination of middle element becomes difficult. This paper aims to provide an alternative approach using two different pointers to perform binary search on a singly linked list.
International Journal of Advanced Computer Science and Applications, 2015
Students traditionally have difficulties in implementing abstract data structures (ADS) in C++. To a large extent, these difficulties are due to language complexity in terms of memory management with raw pointersthe programmer must take care of too many details to provide reliable, efficient and secure implementation. Since all these technical details distract students from the essence of the studied algorithms, we decided to use in the course in DSA (Data Structures and Algorithms) an automated resource management, provided by the C++ standard ISO/IEC 14882:2011. In this work we share experience of using smart pointers to implement linked lists and discuss pedagogical aspects and effectiveness of the new classes, compared to the traditional library containers and implementation via built-in pointers.
Information and Control, 1984
We introduce a method of representing a broad class of binary search trees in an environment in which pointers and other structural information may be "lost" or "maliciously altered." The fault tolerant representation permits any 2 field changes to be detected and any 1.to be corrected without significantly increasing storage requirements of the binary tree. The detection and correction procedures applied to the entire tree require O(n) time. This discipline is also used to represent binary search trees with a single pointer per datum without altering the cost of searching or updating, if applied in conjunction with any underlying tree balancing scheme (bounded balance, etc.). If no balancing scheme is employed, the trees we form will have significantly shorter search paths than those formed using the straightforward algorithm.
Loading Preview
Sorry, preview is currently unavailable. You can download the paper by clicking the button above.
Software: Practice and Experience, 1993
ACM SIGMETRICS Performance Evaluation Review, 2004
GeoInformatica, 2012