onlineclasses

Hashing in detail – Part Three

Introduction This is the third post in Hashing - Online Classes. Please check the previous articles Hashing in detail – Part One and Hashing in detail – Part Two. In the first two articles we established a better understanding of the data structure which can be used to store objects using hashing, we also learnt about handling collisions and chaining. In "Hashing in detail - Part Three" post we will extend the discussion and wrap up basic concepts of hashing. Purpose of the article In the article Hashing in detail - Part 3 we will learn another collision resolution method called Open...
Read More

Interview Question – Pirate and the Gold Chest

Interview Question – Pirate and the Gold Chest : Once there were five pirates, each of them equally rational, intelligent and greedy. The pirates can be numbered as P1, P2, P3, P4 and P5 such that P5 has 1 years of service experience, P4 has 2 years of experience, P3, P2 and P1 has 3, 4 and 5 years of experience respectively. One day they find a chest of 100 gold coins and they decided to divide it among themselves. Everyone being equally greedy wanted maximum profit, so they decided for the following solution: 1) Each pirate will get a chance to propose a distribution rule, and then a ...
Read More

Interview Question – Find top three horses

Interview Question - Find top three horses : You are given five race tracks and twenty five horses.Find the minimum number of races you need to organize to find the fastest three horses. Here five race tracks means that only five horses can run at a time. Solution The trick to approach these type of probelm is to consider the corner cases, most of the times what seems obvious is not what is true. Lets name the five tracks as T1 , T2, T3 , T4 , T5 and we organize five races in the beginning Let us say that we have the horses named from A - Y. Lets organize the below races on the ...
Read More

Hashing in detail – Part Two

Introduction This is the second post in Hashing - Online Classes. This is in continuation of the article Hashing in detail – Part One, in which we understood the meaning of the word hash, hash code and hashing. We established a better understanding of the data structure which can be used to store objects using hashing. Also, we found that storing, searching and fetching objects from a hash table is almost a constant time operation and hence, it is an effective mechanism. Purpose of the article The article Hashing in detail – Part Two is to focus on the challenges we face while emplo...
Read More

Hashing in detail – Part One

Introduction This is the first post in Hashing - Online Classes. I always wanted to write this article after writing couple of articles on sorting algorithms. It doesn't make any difference, but of course it helps to establish a flow to the reader. There is a lot to understand and learn about hashing and I do not consider it good to throw Hashing on someone as the first article. Please read any of my articles in the Sorting Series before reading further, so that a mindset is properly developed. Purpose of the Article The article Hashing in detail - Part One might not end up in just one ...
Read More

Comb Sort – An extension over the Bubble Sort

Introduction This article is in continuation of the article Improving Bubble Sort – A detailed explanation which I wrote to explain the basic idea behind bubble sort. Purpose of the article This is an improvement over Bubble Sort, an improvement which is pretty much similar to Shell Sort over Insertion Sort. To know more about the relationship between Shell Sort and Insertion Sort, please read the articles in my previous posts. What are we trying to improve? Before we try to improve, we must know what to improve. The thing which is clear is that Bubble sort takes more time (or may I say m...
Read More

Improving Bubble Sort – A detailed explanation

Introduction Ever wondered why bubble sort is slow? Does it look similar to Insertion Sort ? Can it be improved to have better than quadratic time in average cases? Here we start with a detailed analysis of bubble sort in the easiest possible way. Bubble Sort as the name suggests, bubbles up the heaviest (or may be lightest, depending on the comparison operator) elements to the top. Purpose of the article The article Improving Bubble Sort, is dedicated to explain the mechanism behind bubble sort in detail, apart from that, it also offers an improved bubble sort. Moreover, it also helps us ...
Read More