Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Sequential and binary search implemented in Java

Lars Vogel

Version 0.3

26.10.2009

Revision History
Revision 0.101.09.2009Lars Vogel
Created
Revision 0.203.10.2009Lars Vogel
Adjusted article
Revision 0.326.10.2009Lars Vogel
Finished binary search

Search Algorithms in Java

This article describes different search algorithms for searching elements in collections. Currently sequential search and binary search are described.


Table of Contents

1. Searching in collections
2. Sequential Search
2.1. Overview
2.2. Implementation
2.3. Test
2.4. Complexity Analysis
3. Binary Search
3.1. Overview
3.2. Implementation
3.3. Test
3.4. Complexity Analysis
4. Thank you
5. Questions and Discussion
6. Links and Literature
6.1. Source Code
6.2. General

1. Searching in collections

The following article will discuss the implementation of different search algorithms in Java for finding elements in a collections.

Searching in collection is done to answer the questions:

  • Does the element exists in the collections

  • Get the element from the collection

  • Delete the element from the collection

Collection in this article is used in the broader sense and not in the strict Java sense. For example collection we are looking at my be array or lists.