[algogeeks] Hash Table

2011-10-24 Thread kumar raja
I have read that Hash table provides storing/search operations in constant
time.

Is it true?? How to prove it??

I have not found any sort of proof for it...

-- 
Regards
Kumar Raja
M.Tech(SIT)
IIT Kharagpur,
10it60...@iitkgp.ac.in

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table

2011-09-03 Thread sukran dhawan
good material

On Sat, Sep 3, 2011 at 1:59 PM, payal gupta  wrote:

> this might be hlpful...
> Regards,
> PAYAL GUPTA
>
>
> On Sat, Sep 3, 2011 at 10:44 AM, Rahul Verma wrote:
>
>> I am facing some difficulty in the implementation of Hash Table. Anyone
>> can please share the good resources for Hash Table?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/DmcDxyNXfwEJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table ( A hashtable class in c++)

2011-09-02 Thread Aj G
#include
#include
#include
#include
using namespace std;


// It is not advisable to list all elements in this hash table.
#define HASH_SIZE 51439
class HashTable
{
public:
  vector< map > table;

  HashTable()
  {
table = vector< map >(HASH_SIZE);
  }

  int hashF(long long key)
  {
if( key < 0)
  {
key = key + HASH_SIZE*( abs(key)/HASH_SIZE + 1);
  }
return  key%HASH_SIZE;
  }

  pair< map::iterator, bool > insert(long long key, int
value)
  {
int index = hashF(key);
return table[index].insert(pair(key,value));
  }

  int getCount(long long key)
  {
int index = hashF(key);
int count = table[index].count(key);

return count;
  }

  int getValue(long long key)
  {
int index = hashF(key);
return table[index][key];
  }

};


On Sat, Sep 3, 2011 at 10:44 AM, Rahul Verma wrote:

> I am facing some difficulty in the implementation of Hash Table. Anyone can
> please share the good resources for Hash Table?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/DmcDxyNXfwEJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Hash Table

2011-09-02 Thread Rahul Verma
I am facing some difficulty in the implementation of Hash Table. Anyone can 
please share the good resources for Hash Table?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/DmcDxyNXfwEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table Objective Question

2011-08-11 Thread manvir siyo
please help me.. can u tell me regarding written test of De shaw company..
please if anyone knows please tell me.. please

On Thu, Aug 11, 2011 at 10:58 PM, paul suganthan
wrote:

> if the hash function evaluates to 3 or 4 , collision occurs and by linear
> probing they are put into 5(nearest free entry). Also 5 and 6 are empty.
>
> But if the hash value points to 7,8,9,10 or 1 , they will be put into
> 2(nearest free entry).
>
>
> On Thu, Aug 11, 2011 at 10:53 PM, Mani Bharathi 
> wrote:
>
>> how do u say that they will lead to 2?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/d9eo_cbjCvwJ.
>>
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>   --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table Objective Question

2011-08-11 Thread paul suganthan
if the hash function evaluates to 3 or 4 , collision occurs and by linear
probing they are put into 5(nearest free entry). Also 5 and 6 are empty.

But if the hash value points to 7,8,9,10 or 1 , they will be put into
2(nearest free entry).

On Thu, Aug 11, 2011 at 10:53 PM, Mani Bharathi wrote:

> how do u say that they will lead to 2?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/d9eo_cbjCvwJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table Objective Question

2011-08-11 Thread Mani Bharathi
how do u say that they will lead to 2?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/d9eo_cbjCvwJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table Objective Question

2011-08-11 Thread paul suganthan
Total number of entries=10

The entries that may lead to 2 are 7,8,9,10,1,2

So its 6/10 = 0.6

Paul

On Thu, Aug 11, 2011 at 10:33 PM, Mani Bharathi wrote:

> how?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/cDA2OA_0FnAJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table Objective Question

2011-08-11 Thread Mani Bharathi
how?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/cDA2OA_0FnAJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Hash Table Objective Question

2011-08-11 Thread bagaria.ka...@gmail.com
0.6 is the answer i blv


On 8/11/11, Mani Bharathi  wrote:
>
>
> *A hash table can store a maximum of 10 records, currently there are records
> in location 1, 3,4,7,8,9,10. The probability of a new record going into
> location 2, with hash functions resolving collisions by linear probing is*
>
> a.0.1 b. 0.6 c. 0.2 d. 0.5
>
> What is the answer? How?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/lm6wAjg3PPYJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Thanks and Regards

*Karan Bagaria*
*MCA Final Year*
Training and Placement Representative
*NIT Durgapur*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Hash Table Objective Question

2011-08-11 Thread Mani Bharathi


*A hash table can store a maximum of 10 records, currently there are records 
in location 1, 3,4,7,8,9,10. The probability of a new record going into 
location 2, with hash functions resolving collisions by linear probing is*

a.0.1 b. 0.6 c. 0.2 d. 0.5

What is the answer? How?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/lm6wAjg3PPYJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] hash table

2011-08-05 Thread saurabh singh
How can the element be regained from hash table?

On Sat, Aug 6, 2011 at 2:41 AM, mohit verma  wrote:

> yes you can... for randomness , the key value will be key=rand() and now
> implement your hash function with this key.
>
>
> On Fri, Aug 5, 2011 at 4:53 PM, Kamakshii Aggarwal 
> wrote:
>
>> can we implement random() function on a hash table in O(1) .
>>
>> --
>> Regards,
>> Kamakshi
>> kamakshi...@gmail.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> 
> *MOHIT VERMA*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Saurabh Singh
B.Tech (Computer Science)
MNNIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] hash table

2011-08-05 Thread mohit verma
yes you can... for randomness , the key value will be key=rand() and now
implement your hash function with this key.

On Fri, Aug 5, 2011 at 4:53 PM, Kamakshii Aggarwal wrote:

> can we implement random() function on a hash table in O(1) .
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 

*MOHIT VERMA*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] hash table

2011-08-05 Thread Kamakshii Aggarwal
can we implement random() function on a hash table in O(1) .

-- 
Regards,
Kamakshi
kamakshi...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Hash Table Design

2010-09-30 Thread amit
Design a hash table to store phone #s. Your job is to write a hash
function that has a parameter username, and generate a key. Username
is unique, length 5 and can be A-Z, 0-9, space. Write a hash function
that generate keys without collisions and use minimum memory.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.