Preview

Data Structure Assignment

Powerful Essays
Open Document
Open Document
4612 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Data Structure Assignment
1. -------------------------------------------------
Types of searching 2.1 Binary search tree

In computer science, a binary search tree (BST) is a node based binary tree data structure which has the following properties: * The left subtree of a node contains only nodes with keys less than the node 's key. * The right subtree of a node contains only nodes with keys greater than the node 's key. * Both the left and right subtrees must also be binary search trees. From the above properties it naturally follows that: * Each node (item in the tree) has a distinct key.

Generally, the information represented by each node is a record rather than a single data element. However, for sequencing purposes, nodes are compared according to their keys rather than any part of their their associated records.
The major advantage of binary search trees over other data structures is that the related sorting algorithms and search algorithms such as in-order traversal can be very efficient.
Binary search trees are a fundamental data structure used to construct more abstract data structures such as sets, multisets, and associative arrays.

A binary search tree of size 9 and depth 3, with root 8 and leaves 1, 4, 7 and 13
-------------------------------------------------

-------------------------------------------------
1.2 Linear and sequential search
In computer science, linear search or sequential search is a method for finding a particular value in a list, that consists of checking every one of its elements, one at a time and in sequence, until the desired one is found.
Linear search is the simplest search algorithm; it is a special case of brute-force search. Its worst case cost is proportional to the number of elements in the list; and so is its expected cost, if all list elements are equally likely to be searched for. Therefore, if the list has more than a few elements, other methods (such as binary search or hashing) will be faster,



References: * ^ a b Donald Knuth (1997). The Art of Computer Programming. 3: Sorting and Searching (3rd ed.). Addison-Wesley. pp. 396–408. ISBN 0-201-89685-0. * ^ Gilberg, R.; Forouzan, B. (2001), "8", Data Structures: A Pseudocode Approach With C++, Pacific Grove, CA: Brooks/Cole, p. 339, ISBN 0-534-95216-X * ^ Heger, Dominique A * ^ A. Gibbons and W. Rytter, "Efficient Parallel Algorithms". Cambridge University Press, 1988. * ^ H. Casanova et al, "Parallel Algorithms". Chapman & Hall, 2008.

You May Also Find These Documents Helpful

  • Good Essays

    ECET 370 Week 5 Lab 5

    • 650 Words
    • 3 Pages

    Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. The ArrayList class contains implementations of the first three search methods explained in this week's lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully.…

    • 650 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Nt1310 Unit 1 Test Paper

    • 381 Words
    • 2 Pages

    3. Create a binary search function that tells whether a given value exists in the tree or not.…

    • 381 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Cse 373 Final Note

    • 955 Words
    • 4 Pages

    An ordered or sorted binary tree, is a node based binary tree data structure that has the following properties:…

    • 955 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Trees occur in various venues in computer science: decision trees in algorithms, search trees, and so on. In linguistics, one encounters trees as well, typically as parse trees, which are essentially sentence diagrams, such as those you might have had to do in primary school, breaking a natural-language sentence into its components—clauses, subclauses, nouns, verbs, adverbs, adjectives, prepositions, and so on. What might be the significance of the depth and breadth of a parse tree relative to the sentence it represents? If you need to, look up parse tree and natural language processing on the Internet to see some examples.…

    • 2006 Words
    • 7 Pages
    Good Essays
  • Powerful Essays

    Searching and Sorting Streams and Files Graphics GUI Components and Events Mouse, Keyboard, Sounds, and Images Big-O Analysis of Algorithms The Java Collections Framework Lists and Iterators Stacks and Queues Recursion Revisited Binary Trees Lookup Tables and Hashing Heaps and Priority Queues Design Patterns…

    • 3908 Words
    • 16 Pages
    Powerful Essays
  • Good Essays

    Compter Science

    • 819 Words
    • 4 Pages

    The process of searching for a special pattern of symbols within a larger collection of information…

    • 819 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Coast Live Oak

    • 544 Words
    • 3 Pages

    The bark of young trees is smooth. With age, it develops deep furrows, ridges, and a thickness of about 8 to 9% of bole or branch diameter. The root system consists of a deep taproot that is usually nonfunctional in large trees. Several deep main roots may tap groundwater if present within approximately 36 feet of the soil surface. Coast live oak develops extensive horizontal root branches and surface-feeding roots.…

    • 544 Words
    • 3 Pages
    Good Essays
  • Good Essays

    GCSE Essay - The Tree

    • 478 Words
    • 2 Pages

    In the deep forest, there stands a tree beside a river. It is an ancient tree, standing tall against the sky. On its bows grow lush green leaves of thousandth generation. At its base, grey roots pile on top of one other like an old man's beard. A cicada lies on top of a root with its legs pointing uselessly at the sky.…

    • 478 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    ICS 241 Exam 2

    • 695 Words
    • 19 Pages

    3. Create a forest consisting of single node trees, each of which has a weight (the…

    • 695 Words
    • 19 Pages
    Satisfactory Essays
  • Good Essays

    It surprises me that data structures can look simple but once you start creating them it involves a lot of thinking and planning.…

    • 605 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    CS 220 – Programming w/ Data Structures: You have missed one assignment and one quiz. Your instructor has extended your assignment due date to this Sunday, April 10. Your instructor has also let you to take your Quiz # 2 during his office hours during this week. Let me know if you need additional support to study for this quiz. Your grade to date in this class is 30.2/37 81.62% B.…

    • 354 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Specify the class Admission giving details of the constructor, void fillArrray() and int binSearch(int, int, int). Define the main() function to create an object and call the functions accordingly to enable task.…

    • 777 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Note : This paper contains fifty (50) objective type questions, each question carrying two (2) marks.…

    • 1496 Words
    • 17 Pages
    Good Essays
  • Powerful Essays

    Genetic Programming

    • 3553 Words
    • 15 Pages

    GENETIC PROGRAMMING: AN INTRODUCTION AND SURVEY OF APPLICATIONS M.J. Willis*, H.G Hiden*, P. Marenbach+, B. McKay* and G.A. Montague* * Symbolic Optimisation Research Group (SORG) Dept. of Chemical and Process Engineering University of Newcastle upon Tyne NE1 7RU, UK + Institute of Control Engineering Darmstadt University of Technology Landgraf-Georg-Strasse 4 D-64283 Darmstadt, Germany {Mark. Willis, H.G.Hiden, Ben. McKay, Gary.…

    • 3553 Words
    • 15 Pages
    Powerful Essays
  • Powerful Essays

    artificial intelligence

    • 4107 Words
    • 17 Pages

    Informed search strategy is one that uses problem-specific knowledge beyond the definition of the problem itself. It can find solutions more efficiently than uninformed strategy.…

    • 4107 Words
    • 17 Pages
    Powerful Essays