The algorithm first iteration selects the smallest element in the array and swaps it with the first element. The second iteration selects the second smallest item and swaps it with the second element. This continues until the second-largest item is swapped with the second to last index leaving the largest element in the last index.
The first iteration of this algorithm considers the second element in the array if it is less than the first element then swaps it. …
A collection is an object that holds references to other objects.
Some of the Collection Interfaces are:
Is an unordered collection that does not contain duplicate elements.
An ordered collection that contains duplicate elements.
List examples are:
ArrayList, LinkedList etc.
Is one with keys/values that aren’t duplicate but unique.
Some of the map classes are:
Hashtable, Hashmap, Hashsets etc.
They help manipulate the collections as mentioned above.
fill — sets every list element to refer to a specific object.
copy — copies references from one list to another.
addAll — appends all elements…
The Linear search algorithm is an algorithm that searches each element in an array in a sequence. If the searched-for element is found, the index of that element will be returned.
The efficiency of a Linear Search — Big O
This algorithm runs in O(n) time. The worst case is this algorithm will have to iterate through every element in an array until the searched-for element is found. In case the array is increased, so will be the number of iterations. …
Big O notation is how hard an algorithm has to work to solve a problem or, in technical terms, the worst-case run time for an algorithm.
O(1) — Constant run-time algorithm.
This is an algorithm that returns an element in a known position regardless of the data size or array. For instance, designing an algorithm to test if the first element of an array is equal to the second.
O(n) — Linear run-time algorithm
For this algorithm, the number of iterations grows as the number of array elements. This is expressed as (n-1) where n is the number of array…
Seek and you shall find, ask and you shall receive as it is mentioned in one of the oldest books ever written. So there I was, seeking for a learning community to acquire a structured flow of web development knowledge and skill. Thanks to the Facebook founder, an OutBox advert appeared on to my Facebook profile feeds giving me a week’s notice to apply for the course. I couldn’t look idly by and procrastinate, come on, I clicked that apply button and onboarded.
One evening, a notification appeared on my phone inviting me to the first class of orientation. Happy…